MediaLibraryBaseModel.swift 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. static let VLCAudioDidChangeNotification = Notification.Name("AudioDidChangeNotfication")
  22. }
  23. protocol MediaLibraryBaseModel {
  24. associatedtype MLType where MLType: VLCMLObject
  25. var files: [MLType] { get set }
  26. var indicatorName: String { get }
  27. var notificaitonName: Notification.Name { get }
  28. // mutating will depend if we need to handle struc/enum
  29. func append(_ item: MLType)
  30. func isIncluded(_ item: MLType)
  31. }
  32. // protocol can be extended to have the "generic methods" that
  33. // childs will share. No need an in-between class