Commit 978ea73f authored by Soomin Lee's avatar Soomin Lee

VLCMediaLibraryManager: Update callback methods

parent 74c14767
...@@ -32,8 +32,8 @@ class AlbumModel: MLBaseModel { ...@@ -32,8 +32,8 @@ class AlbumModel: MLBaseModel {
} }
extension AlbumModel: MediaLibraryObserver { extension AlbumModel: MediaLibraryObserver {
func medialibrary(_ medialibrary: VLCMediaLibraryManager, didAddAlbum album: [VLCMLAlbum]) { func medialibrary(_ medialibrary: VLCMediaLibraryManager, didAddAlbums albums: [VLCMLAlbum]) {
album.forEach({ append($0) }) albums.forEach({ append($0) })
updateView?() updateView?()
} }
} }
...@@ -32,8 +32,8 @@ class ArtistModel: MLBaseModel { ...@@ -32,8 +32,8 @@ class ArtistModel: MLBaseModel {
} }
extension ArtistModel: MediaLibraryObserver { extension ArtistModel: MediaLibraryObserver {
func medialibrary(_ medialibrary: VLCMediaLibraryManager, didAddArtist artist: [VLCMLArtist]) { func medialibrary(_ medialibrary: VLCMediaLibraryManager, didAddArtists artists: [VLCMLArtist]) {
artist.forEach({ append($0) }) artists.forEach({ append($0) })
updateView?() updateView?()
} }
} }
...@@ -44,8 +44,8 @@ extension AudioModel { ...@@ -44,8 +44,8 @@ extension AudioModel {
// MARK: - MediaLibraryObserver // MARK: - MediaLibraryObserver
extension AudioModel: MediaLibraryObserver { extension AudioModel: MediaLibraryObserver {
func medialibrary(_ medialibrary: VLCMediaLibraryManager, didAddAudio audio: [VLCMLMedia]) { func medialibrary(_ medialibrary: VLCMediaLibraryManager, didAddAudios audios: [VLCMLMedia]) {
audio.forEach({ append($0) }) audios.forEach({ append($0) })
updateView?() updateView?()
} }
} }
...@@ -32,8 +32,8 @@ class GenreModel: MLBaseModel { ...@@ -32,8 +32,8 @@ class GenreModel: MLBaseModel {
} }
extension GenreModel: MediaLibraryObserver { extension GenreModel: MediaLibraryObserver {
func medialibrary(_ medialibrary: VLCMediaLibraryManager, didAddGenre genre: [VLCMLGenre]) { func medialibrary(_ medialibrary: VLCMediaLibraryManager, didAddGenres genres: [VLCMLGenre]) {
genre.forEach({ append($0) }) genres.forEach({ append($0) })
updateView?() updateView?()
} }
} }
...@@ -31,8 +31,8 @@ class ShowEpisodeModel: MLBaseModel { ...@@ -31,8 +31,8 @@ class ShowEpisodeModel: MLBaseModel {
} }
extension ShowEpisodeModel: MediaLibraryObserver { extension ShowEpisodeModel: MediaLibraryObserver {
func medialibrary(_ medialibrary: VLCMediaLibraryManager, didAddShowEpisode showEpisode: [VLCMLMedia]) { func medialibrary(_ medialibrary: VLCMediaLibraryManager, didAddShowEpisodes showEpisodes: [VLCMLMedia]) {
showEpisode.forEach({ append($0) }) showEpisodes.forEach({ append($0) })
updateView?() updateView?()
} }
} }
...@@ -43,8 +43,8 @@ extension VideoModel { ...@@ -43,8 +43,8 @@ extension VideoModel {
// MARK: - MediaLibraryObserver // MARK: - MediaLibraryObserver
extension VideoModel: MediaLibraryObserver { extension VideoModel: MediaLibraryObserver {
func medialibrary(_ medialibrary: VLCMediaLibraryManager, didAddVideo video: [VLCMLMedia]) { func medialibrary(_ medialibrary: VLCMediaLibraryManager, didAddVideos videos: [VLCMLMedia]) {
video.forEach({ append($0) }) videos.forEach({ append($0) })
updateView?() updateView?()
} }
} }
......
...@@ -20,30 +20,31 @@ extension NSNotification { ...@@ -20,30 +20,31 @@ extension NSNotification {
} }
@objc protocol MediaLibraryObserver: class { @objc protocol MediaLibraryObserver: class {
// Video
@objc optional func medialibrary(_ medialibrary: VLCMediaLibraryManager, @objc optional func medialibrary(_ medialibrary: VLCMediaLibraryManager,
didUpdateVideo video: [VLCMLMedia]) didUpdateVideo video: [VLCMLMedia])
@objc optional func medialibrary(_ medialibrary: VLCMediaLibraryManager, @objc optional func medialibrary(_ medialibrary: VLCMediaLibraryManager,
didAddVideo video: [VLCMLMedia]) didAddVideos videos: [VLCMLMedia])
@objc optional func medialibrary(_ medialibrary: VLCMediaLibraryManager, @objc optional func medialibrary(_ medialibrary: VLCMediaLibraryManager,
didAddShowEpisode showEpisode: [VLCMLMedia]) didAddShowEpisodes showEpisodes: [VLCMLMedia])
// Audio // Audio
@objc optional func medialibrary(_ medialibrary: VLCMediaLibraryManager, @objc optional func medialibrary(_ medialibrary: VLCMediaLibraryManager,
didAddAudio audio: [VLCMLMedia]) didAddAudios audios: [VLCMLMedia])
@objc optional func medialibrary(_ medialibrary: VLCMediaLibraryManager, @objc optional func medialibrary(_ medialibrary: VLCMediaLibraryManager,
didAddAlbumTrack audio: [VLCMLMedia]) didAddAlbumTracks tracks: [VLCMLMedia])
@objc optional func medialibrary(_ medialibrary: VLCMediaLibraryManager, @objc optional func medialibrary(_ medialibrary: VLCMediaLibraryManager,
didAddArtist artist: [VLCMLArtist]) didAddArtists artists: [VLCMLArtist])
@objc optional func medialibrary(_ medialibrary: VLCMediaLibraryManager, @objc optional func medialibrary(_ medialibrary: VLCMediaLibraryManager,
didAddAlbum album: [VLCMLAlbum]) didAddAlbums albums: [VLCMLAlbum])
@objc optional func medialibrary(_ medialibrary: VLCMediaLibraryManager, @objc optional func medialibrary(_ medialibrary: VLCMediaLibraryManager,
didAddGenre genre: [VLCMLGenre]) didAddGenres genres: [VLCMLGenre])
} }
class VLCMediaLibraryManager: NSObject { class VLCMediaLibraryManager: NSObject {
...@@ -167,28 +168,28 @@ extension VLCMediaLibraryManager { ...@@ -167,28 +168,28 @@ extension VLCMediaLibraryManager {
// MARK: VLCMediaLibraryDelegate // MARK: VLCMediaLibraryDelegate
extension VLCMediaLibraryManager: VLCMediaLibraryDelegate { extension VLCMediaLibraryManager: VLCMediaLibraryDelegate {
func medialibrary(_ medialibrary: VLCMediaLibrary, didAddMedia media: [VLCMLMedia]) { func medialibrary(_ medialibrary: VLCMediaLibrary, didAddMedia media: [VLCMLMedia]) {
let video = media.filter {( $0.type() == .video )} let videos = media.filter {( $0.type() == .video )}
let audio = media.filter {( $0.type() == .audio )} let audio = media.filter {( $0.type() == .audio )}
let showEpisode = media.filter {( $0.subtype() == .showEpisode )} let showEpisodes = media.filter {( $0.subtype() == .showEpisode )}
let albumTrack = media.filter {( $0.subtype() == .albumTrack )} let albumTrack = media.filter {( $0.subtype() == .albumTrack )}
for observer in observers { for observer in observers {
observer.value.observer?.medialibrary?(self, didAddVideo: video) observer.value.observer?.medialibrary?(self, didAddVideos: videos)
observer.value.observer?.medialibrary?(self, didAddAudio: audio) observer.value.observer?.medialibrary?(self, didAddAudios: audio)
observer.value.observer?.medialibrary?(self, didAddShowEpisode: showEpisode) observer.value.observer?.medialibrary?(self, didAddShowEpisodes: showEpisodes)
observer.value.observer?.medialibrary?(self, didAddAlbumTrack: albumTrack) observer.value.observer?.medialibrary?(self, didAddAlbumTracks: albumTrack)
} }
} }
func medialibrary(_ medialibrary: VLCMediaLibrary, didAdd artists: [VLCMLArtist]) { func medialibrary(_ medialibrary: VLCMediaLibrary, didAdd artists: [VLCMLArtist]) {
for observer in observers { for observer in observers {
observer.value.observer?.medialibrary?(self, didAddArtist: artists) observer.value.observer?.medialibrary?(self, didAddArtists: artists)
} }
} }
func medialibrary(_ medialibrary: VLCMediaLibrary, didAdd albums: [VLCMLAlbum]) { func medialibrary(_ medialibrary: VLCMediaLibrary, didAdd albums: [VLCMLAlbum]) {
for observer in observers { for observer in observers {
observer.value.observer?.medialibrary?(self, didAddAlbum: albums) observer.value.observer?.medialibrary?(self, didAddAlbums: albums)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment