Commit 06367870 authored by Soomin Lee's avatar Soomin Lee

Add AudioModel

parent 1601ede5
/*****************************************************************************
* AudioModel.swift
*
* Copyright © 2018 VLC authors and VideoLAN
* Copyright © 2018 Videolabs
*
* Authors: Soomin Lee <bubu@mikan.io>
*
* Refer to the COPYING file of the official project for license.
*****************************************************************************/
class AudioModel: MediaLibraryBaseModel {
typealias MLType = VLCMLMedia
var files = [VLCMLMedia]()
var indicatorName: String = NSLocalizedString("SONGS", comment: "")
var notificaitonName: Notification.Name = .VLCAudioDidChangeNotification
required init(medialibrary: VLCMediaLibraryManager) {
medialibrary.addObserver(self)
// created too late so missed the callback asking if he has anything
files = medialibrary.media(ofType: .audio)
}
func isIncluded(_ item: VLCMLMedia) {
}
func append(_ item: VLCMLMedia) {
// need to check more for duplicate and stuff
files.append(item)
}
}
extension AudioModel: MediaLibraryObserver {
func medialibrary(_ medialibrary: VLCMediaLibraryManager, didAddAudio audio: [VLCMLMedia]) {
audio.forEach({ append($0) })
NotificationCenter.default.post(name: notificaitonName, object: nil)
}
}
......@@ -31,9 +31,9 @@ class VLCVideoPlaylistCategoryViewController: VLCMediaCategoryViewController<MLL
}
}
class VLCTrackCategoryViewController: VLCMediaCategoryViewController<MLFile, VideoModel> {
class VLCTrackCategoryViewController: VLCMediaCategoryViewController<VLCMLMedia, AudioModel> {
init(_ services: Services) {
let model = VideoModel(medialibrary: services.medialibraryManager)
let model = AudioModel(medialibrary: services.medialibraryManager)
super.init(services: services, category: model)
}
}
......
......@@ -259,6 +259,7 @@
8DE1887421089B3A00A091D2 /* MediaLibraryBaseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DE1887321089B3A00A091D2 /* MediaLibraryBaseModel.swift */; };
8DE1887621089BB100A091D2 /* VideoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DE1887521089BB100A091D2 /* VideoModel.swift */; };
8DE1888C210B459000A091D2 /* ShowEpisodeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DE1888B210B459000A091D2 /* ShowEpisodeModel.swift */; };
8DE18890210B53E000A091D2 /* AudioModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DE1888F210B53E000A091D2 /* AudioModel.swift */; };
8F91EC79195CEC7900F5BCBA /* VLCOpenInActivity.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F91EC78195CEC7900F5BCBA /* VLCOpenInActivity.m */; };
8F91EC7F195E1DAB00F5BCBA /* AssetsLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8F91EC7E195E1DAB00F5BCBA /* AssetsLibrary.framework */; };
9B088308183D7BEC004B5C2A /* VLCCloudStorageTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B088307183D7BEC004B5C2A /* VLCCloudStorageTableViewController.m */; };
......@@ -949,6 +950,7 @@
8DE1887321089B3A00A091D2 /* MediaLibraryBaseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaLibraryBaseModel.swift; sourceTree = "<group>"; };
8DE1887521089BB100A091D2 /* VideoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoModel.swift; sourceTree = "<group>"; };
8DE1888B210B459000A091D2 /* ShowEpisodeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShowEpisodeModel.swift; sourceTree = "<group>"; };
8DE1888F210B53E000A091D2 /* AudioModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioModel.swift; sourceTree = "<group>"; };
8F91EC77195CEC7900F5BCBA /* VLCOpenInActivity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCOpenInActivity.h; path = Sources/VLCOpenInActivity.h; sourceTree = SOURCE_ROOT; };
8F91EC78195CEC7900F5BCBA /* VLCOpenInActivity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCOpenInActivity.m; path = Sources/VLCOpenInActivity.m; sourceTree = SOURCE_ROOT; };
8F91EC7E195E1DAB00F5BCBA /* AssetsLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AssetsLibrary.framework; path = System/Library/Frameworks/AssetsLibrary.framework; sourceTree = SDKROOT; };
......@@ -2145,6 +2147,7 @@
8DE1887321089B3A00A091D2 /* MediaLibraryBaseModel.swift */,
8DE1887521089BB100A091D2 /* VideoModel.swift */,
8DE1888B210B459000A091D2 /* ShowEpisodeModel.swift */,
8DE1888F210B53E000A091D2 /* AudioModel.swift */,
);
path = MediaLibraryModel;
sourceTree = "<group>";
......@@ -3335,6 +3338,7 @@
7D1052EE1A4DCD1E00295F08 /* VLCOneDriveController.m in Sources */,
414396C22023316C005E3FAF /* AppearanceManager.swift in Sources */,
7D30F3DC183AB2F900FFC021 /* VLCNetworkLoginViewController.m in Sources */,
8DE18890210B53E000A091D2 /* AudioModel.swift in Sources */,
419A2C661F37A4B70069D224 /* VLCStringsForLocalization.m in Sources */,
DDA1B9091CE902EE0076BC45 /* VLCNetworkServerLoginInformation+Keychain.m in Sources */,
7D30F3DF183AB31E00FFC021 /* VLCWiFiUploadTableViewCell.m in Sources */,
......
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