Fix sorting.

This commit is contained in:
Damiano Galassi committed 2019-10-25 13:32:17 +02:00
1 parent b58c2d0674
commit 3a145931e0
1 file changed
+45 -3
+45 -3
View File
@@ -145,7 +145,8 @@ public class MetadataResult {
.executiveProducer,
.copyright,
.contentID,
.artistID]
.artistID,
.iTunesCountry]
}
fileprivate static var tvShowKeys: [Key] {
@@ -177,9 +178,50 @@ public class MetadataResult {
.contentID,
.artistID,
.playlistID,
.iTunesCountry]
.iTunesCountry,
]
}
fileprivate static var sortedKeys: [Key] {
return [.name,
.seriesName,
.composer,
.genre,
.releaseDate,
.trackNumber,
.diskNumber,
.episodeNumber,
.network,
.episodeID,
.season,
.description,
.longDescription,
.seriesDescription,
.rating,
.studio,
.cast,
.director,
.producers,
.screenwriters,
.executiveProducer,
.copyright,
.contentID,
.artistID,
.playlistID,
.iTunesURL,
.iTunesCountry,
.serviceSeriesID,
.serviceAdditionalSeriesID,
.serviceEpisodeID
]
}
public var localizedDisplayName: String {
return localizedKeys[self] ?? "Null"
}
@@ -241,7 +283,7 @@ public class MetadataResult {
}
lazy var orderedKeys: [Key] = {
let sortedKeys = self.mediaKind == .movie ? Key.movieKeys : Key.tvShowKeys
let sortedKeys = Key.sortedKeys
return Array(dictionary.keys).sorted(by: { (key1: Key, key2: Key) -> Bool in
if let index1 = sortedKeys.firstIndex(of: key1), let index2 = sortedKeys.firstIndex(of: key2) {
return index1 < index2