Commit 3fdc850a authored by Soomin Lee's avatar Soomin Lee

VLCMediaSubcategory: Delete file

parent 841e19c8
/*****************************************************************************
* VLCMediaSubcategory.swift
* VLC for iOS
*****************************************************************************
* Copyright (c) 2017 VideoLAN. All rights reserved.
* $Id$
*
* Authors: Carola Nitz <caro # videolan.org>
*
* Refer to the COPYING file of the official project for license.
*****************************************************************************/
import Foundation
enum VLCDataUnit {
case file(VLCMLMedia)
case episode(MLShowEpisode)
case album(MLAlbum)
case label(MLLabel)
}
class VLCMediaSubcategoryModel<T>: NSObject {
var files: [T]
var indicatorInfoName: String
var changeNotificationName: Notification.Name
var includesFunc: (VLCDataUnit) -> Bool
var appendFunc: (VLCDataUnit) -> Void
var indicatorInfo: IndicatorInfo {
return IndicatorInfo(title: indicatorInfoName)
}
init(files: [T],
indicatorInfoName: String,
notificationName: Notification.Name,
includesFunc: @escaping (VLCDataUnit) -> Bool,
appendFunc: @escaping (VLCDataUnit) -> Void) {
self.files = files
self.indicatorInfoName = indicatorInfoName
self.changeNotificationName = notificationName
self.includesFunc = includesFunc
self.appendFunc = appendFunc
}
}
struct VLCMediaSubcategories {
static var movies = VLCMediaSubcategory<VLCMLMedia>(
files: {
// (MLFile.allFiles() as! [MLFile]).filter {
// ($0 as MLFile).isKind(ofType: kMLFileTypeMovie) ||
// ($0 as MLFile).isKind(ofType: kMLFileTypeTVShowEpisode) ||
// ($0 as MLFile).isKind(ofType: kMLFileTypeClip)
// }s
//medialibrary.media(ofType: .video)
VLCMediaLibraryManager.media(ofType: .video)
}(),
indicatorInfoName: NSLocalizedString("MOVIES", comment: ""),
notificationName: .VLCVideosDidChangeNotification,
includesFunc: { (dataUnit: VLCDataUnit) in
if case .file(let f) = dataUnit {
// return f.isMovie()
}
return false
},
appendFunc: { (dataUnit: VLCDataUnit) in
})
static var episodes = VLCMediaSubcategoryModel<MLShowEpisode>(
files: MLShowEpisode.allEpisodes() as! [MLShowEpisode],
indicatorInfoName: NSLocalizedString("EPISODES", comment: ""),
notificationName: .VLCEpisodesDidChangeNotification,
includesFunc: { (dataUnit: VLCDataUnit) in
if case .episode(let f) = dataUnit {
return true
}
return false
},
appendFunc: { (dataUnit: VLCDataUnit) in
})
static var artists = VLCMediaSubcategoryModel<String>(
files: {
let tracksWithArtist = (MLAlbumTrack.allTracks() as! [MLAlbumTrack]).filter { $0.artist != nil && $0.artist != "" }
return tracksWithArtist.map { $0.artist } as! [String]
}(),
indicatorInfoName: NSLocalizedString("ARTISTS", comment: ""),
notificationName: .VLCArtistsDidChangeNotification,
includesFunc: { (dataUnit: VLCDataUnit) in
if case .file(let f) = dataUnit {
// return f.artist != nil
return true
}
return false
},
appendFunc: { (dataUnit: VLCDataUnit) in
})
static var albums = VLCMediaSubcategoryModel<MLAlbum>(
files: MLAlbum.allAlbums() as! [MLAlbum],
indicatorInfoName: NSLocalizedString("ALBUMS", comment: ""),
notificationName: .VLCAlbumsDidChangeNotification,
includesFunc: { (dataUnit: VLCDataUnit) in
if case .album(let f) = dataUnit {
return true
}
return false
},
appendFunc: { (dataUnit: VLCDataUnit) in
})
static var tracks = VLCMediaSubcategoryModel<MLFile>(
files: (MLFile.allFiles() as! [MLFile]).filter { $0.isSupportedAudioFile()},
indicatorInfoName: NSLocalizedString("SONGS", comment: ""),
notificationName: .VLCTracksDidChangeNotification,
includesFunc: { (dataUnit: VLCDataUnit) in
if case .file(let f) = dataUnit {
// return f.isSupportedAudioFile()
return true
}
return false
},
appendFunc: { (dataUnit: VLCDataUnit) in
})
static var genres = VLCMediaSubcategoryModel<String>(
files: {
let albumtracks = MLAlbumTrack.allTracks() as! [MLAlbumTrack]
let tracksWithArtist = albumtracks.filter { $0.genre != nil && $0.genre != "" }
return tracksWithArtist.map { $0.genre }
}(),
indicatorInfoName: NSLocalizedString("GENRES", comment: ""),
notificationName: .VLCGenresDidChangeNotification ,
includesFunc: { (dataUnit: VLCDataUnit) in
if case .file(let f) = dataUnit {
// return f.genre != nil
return true
}
return false
},
appendFunc: { (dataUnit: VLCDataUnit) in
})
static var audioPlaylists = VLCMediaSubcategoryModel<MLLabel>(
files: {
let labels = MLLabel.allLabels() as! [MLLabel]
let audioPlaylist = labels.filter {
let audioFiles = $0.files.filter {
if let file = $0 as? MLFile {
return file.isSupportedAudioFile()
}
return false
}
return !audioFiles.isEmpty
}
return audioPlaylist
}(),
indicatorInfoName: NSLocalizedString("AUDIO_PLAYLISTS", comment: ""),
notificationName: .VLCAudioPlaylistsDidChangeNotification ,
includesFunc: { (dataUnit: VLCDataUnit) in
if case .label(let l) = dataUnit {
let audioFiles = l.files.filter {
if let file = $0 as? MLFile {
return file.isSupportedAudioFile()
} else {
return false
}
}
return !audioFiles.isEmpty
}
return false
},
appendFunc: { (dataUnit: VLCDataUnit) in
})
static var videoPlaylists = VLCMediaSubcategoryModel<MLLabel>(
files: {
let labels = MLLabel.allLabels() as! [MLLabel]
let audioPlaylist = labels.filter {
let audioFiles = $0.files.filter {
if let file = $0 as? MLFile {
return file.isShowEpisode() || file.isMovie() || file.isClip()
}
return false
}
return !audioFiles.isEmpty
}
return audioPlaylist
}(),
indicatorInfoName: NSLocalizedString("VIDEO_PLAYLISTS", comment: ""),
notificationName: .VLCVideoPlaylistsDidChangeNotification ,
includesFunc: { (dataUnit: VLCDataUnit) in
if case .label(let l) = dataUnit {
let videoFiles = l.files.filter {
if let file = $0 as? MLFile {
return file.isShowEpisode() || file.isMovie() || file.isClip()
} else {
return false
}
}
return !videoFiles.isEmpty
}
return false
},
appendFunc: { (dataUnit: VLCDataUnit) in
})
}
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
419A2C661F37A4B70069D224 /* VLCStringsForLocalization.m in Sources */ = {isa = PBXBuildFile; fileRef = 419A2C651F37A4B70069D224 /* VLCStringsForLocalization.m */; }; 419A2C661F37A4B70069D224 /* VLCStringsForLocalization.m in Sources */ = {isa = PBXBuildFile; fileRef = 419A2C651F37A4B70069D224 /* VLCStringsForLocalization.m */; };
419A2C681F37A4B70069D224 /* VLCStringsForLocalization.m in Sources */ = {isa = PBXBuildFile; fileRef = 419A2C651F37A4B70069D224 /* VLCStringsForLocalization.m */; }; 419A2C681F37A4B70069D224 /* VLCStringsForLocalization.m in Sources */ = {isa = PBXBuildFile; fileRef = 419A2C651F37A4B70069D224 /* VLCStringsForLocalization.m */; };
419D7F051F54176900AF69A2 /* VLCTimeNavigationTitleView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 419D7F041F54176900AF69A2 /* VLCTimeNavigationTitleView.xib */; }; 419D7F051F54176900AF69A2 /* VLCTimeNavigationTitleView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 419D7F041F54176900AF69A2 /* VLCTimeNavigationTitleView.xib */; };
41B0948520E6851200DE38AD /* VLCMediaSubcategory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41B0948420E6851200DE38AD /* VLCMediaSubcategory.swift */; };
41B93C011A53833B00102E8B /* VLCProgressView.m in Sources */ = {isa = PBXBuildFile; fileRef = 41B93C001A53833B00102E8B /* VLCProgressView.m */; }; 41B93C011A53833B00102E8B /* VLCProgressView.m in Sources */ = {isa = PBXBuildFile; fileRef = 41B93C001A53833B00102E8B /* VLCProgressView.m */; };
41B93C051A53835300102E8B /* VLCCloudServiceCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 41B93C031A53835300102E8B /* VLCCloudServiceCell.m */; }; 41B93C051A53835300102E8B /* VLCCloudServiceCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 41B93C031A53835300102E8B /* VLCCloudServiceCell.m */; };
41B93C081A53853B00102E8B /* VLCCloudServiceCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 41B93C071A53853B00102E8B /* VLCCloudServiceCell.xib */; }; 41B93C081A53853B00102E8B /* VLCCloudServiceCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 41B93C071A53853B00102E8B /* VLCCloudServiceCell.xib */; };
...@@ -563,7 +562,6 @@ ...@@ -563,7 +562,6 @@
4195747C206A92ED00393A42 /* RemoteNetworkDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoteNetworkDataSource.swift; sourceTree = "<group>"; }; 4195747C206A92ED00393A42 /* RemoteNetworkDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoteNetworkDataSource.swift; sourceTree = "<group>"; };
419A2C651F37A4B70069D224 /* VLCStringsForLocalization.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCStringsForLocalization.m; sourceTree = "<group>"; }; 419A2C651F37A4B70069D224 /* VLCStringsForLocalization.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCStringsForLocalization.m; sourceTree = "<group>"; };
419D7F041F54176900AF69A2 /* VLCTimeNavigationTitleView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = VLCTimeNavigationTitleView.xib; path = Resources/VLCTimeNavigationTitleView.xib; sourceTree = SOURCE_ROOT; }; 419D7F041F54176900AF69A2 /* VLCTimeNavigationTitleView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = VLCTimeNavigationTitleView.xib; path = Resources/VLCTimeNavigationTitleView.xib; sourceTree = SOURCE_ROOT; };
41B0948420E6851200DE38AD /* VLCMediaSubcategory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VLCMediaSubcategory.swift; sourceTree = "<group>"; };
41B0BC861F73ED7D0063BA26 /* VLC-iOSUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "VLC-iOSUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 41B0BC861F73ED7D0063BA26 /* VLC-iOSUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "VLC-iOSUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
41B0BC8A1F73ED7D0063BA26 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 41B0BC8A1F73ED7D0063BA26 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
41B93BFF1A53833B00102E8B /* VLCProgressView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCProgressView.h; path = Sources/VLCProgressView.h; sourceTree = SOURCE_ROOT; }; 41B93BFF1A53833B00102E8B /* VLCProgressView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCProgressView.h; path = Sources/VLCProgressView.h; sourceTree = SOURCE_ROOT; };
...@@ -1276,15 +1274,6 @@ ...@@ -1276,15 +1274,6 @@
path = "VLC-iOS-Tests"; path = "VLC-iOS-Tests";
sourceTree = "<group>"; sourceTree = "<group>";
}; };
41B0948320E6844700DE38AD /* MediaSubcategory */ = {
isa = PBXGroup;
children = (
41B0948420E6851200DE38AD /* VLCMediaSubcategory.swift */,
);
name = MediaSubcategory;
path = Sources/MediaSubcategory;
sourceTree = "<group>";
};
41B0BC871F73ED7D0063BA26 /* VLC-iOS-UITests */ = { 41B0BC871F73ED7D0063BA26 /* VLC-iOS-UITests */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -1563,7 +1552,6 @@ ...@@ -1563,7 +1552,6 @@
children = ( children = (
8DE1879821060D0B00A091D2 /* MediaCategories */, 8DE1879821060D0B00A091D2 /* MediaCategories */,
8DE1877F2105DA2B00A091D2 /* MediaViewControllers */, 8DE1877F2105DA2B00A091D2 /* MediaViewControllers */,
41B0948320E6844700DE38AD /* MediaSubcategory */,
418B145820179E50000447AA /* VLCDragAndDropManager.swift */, 418B145820179E50000447AA /* VLCDragAndDropManager.swift */,
41251ECB1FD0C5C100099110 /* VLC-iOS-Bridging-Header.h */, 41251ECB1FD0C5C100099110 /* VLC-iOS-Bridging-Header.h */,
7D378493183A98D1009EE944 /* VLCPlaylistCollectionViewCell.h */, 7D378493183A98D1009EE944 /* VLCPlaylistCollectionViewCell.h */,
...@@ -3259,7 +3247,6 @@ ...@@ -3259,7 +3247,6 @@
8DE1888C210B459000A091D2 /* ShowEpisodeModel.swift in Sources */, 8DE1888C210B459000A091D2 /* ShowEpisodeModel.swift in Sources */,
4170152C209A1D3600802E44 /* MediaViewController.swift in Sources */, 4170152C209A1D3600802E44 /* MediaViewController.swift in Sources */,
41F9BC7C1F4F20E400268461 /* VLCTrackSelectorView.m in Sources */, 41F9BC7C1F4F20E400268461 /* VLCTrackSelectorView.m in Sources */,
41B0948520E6851200DE38AD /* VLCMediaSubcategory.swift in Sources */,
7D378499183A98D1009EE944 /* VLCPlaylistCollectionViewCell.m in Sources */, 7D378499183A98D1009EE944 /* VLCPlaylistCollectionViewCell.m in Sources */,
DD8F84311B00EB3B0009138A /* VLCPlaybackController+MediaLibrary.m in Sources */, DD8F84311B00EB3B0009138A /* VLCPlaybackController+MediaLibrary.m in Sources */,
418B144720179C00000447AA /* MediaCategoryViewController.swift in Sources */, 418B144720179C00000447AA /* MediaCategoryViewController.swift 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