MediaLibraryBaseModel.swift 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*****************************************************************************
  2. * MediaLibraryBaseModel.swift
  3. *
  4. * Copyright © 2018 VLC authors and VideoLAN
  5. * Copyright © 2018 Videolabs
  6. *
  7. * Authors: Soomin Lee <bubu@mikan.io>
  8. *
  9. * Refer to the COPYING file of the official project for license.
  10. *****************************************************************************/
  11. extension Notification.Name {
  12. static let VLCMoviesDidChangeNotification = Notification.Name("MoviesDidChangeNotfication")
  13. static let VLCEpisodesDidChangeNotification = Notification.Name("EpisodesDidChangeNotfication")
  14. static let VLCArtistsDidChangeNotification = Notification.Name("ArtistsDidChangeNotfication")
  15. static let VLCAlbumsDidChangeNotification = Notification.Name("AlbumsDidChangeNotfication")
  16. static let VLCTracksDidChangeNotification = Notification.Name("TracksDidChangeNotfication")
  17. static let VLCGenresDidChangeNotification = Notification.Name("GenresDidChangeNotfication")
  18. static let VLCAudioPlaylistsDidChangeNotification = Notification.Name("AudioPlaylistsDidChangeNotfication")
  19. static let VLCVideoPlaylistsDidChangeNotification = Notification.Name("VideoPlaylistsDidChangeNotfication")
  20. static let VLCVideosDidChangeNotification = Notification.Name("VideosDidChangeNotfication")
  21. }
  22. protocol MediaLibraryBaseModel {
  23. associatedtype MLType where MLType: VLCMLObject
  24. var files: [MLType] { get set }
  25. var indicatorName: String { get }
  26. var notificaitonName: Notification.Name { get }
  27. // mutating will depend if we need to handle struc/enum
  28. func append(_ item: MLType)
  29. func isIncluded(_ item: MLType)
  30. }
  31. // protocol can be extended to have the "generic methods" that
  32. // childs will share. No need an in-between class