Use the "backdrop" name for backdrops.

This commit is contained in:
Damiano Galassi committed 2017-08-07 10:41:35 +02:00
1 parent 427614c3e0
commit fb1d3c7602
3 files changed
+17 -5

No files matched your search

+4 -2
View File
@@ -150,8 +150,10 @@ public class ArtworkSelectorController: NSWindowController, ArtworkImageObjectDe
// MARK: - Load images
override public func windowDidLoad() {
super.windowDidLoad()
if let size = initialSize { window?.setContentSize(size) }
loadMoreArtwork(self)
loadMoreArtworks(count: 8)
if let defaultType = UserDefaults.standard.string(forKey: "SBArtworkSelectorDefault|\(type.rawValue)") {
selectArtwork(type: defaultType)
@@ -200,7 +202,7 @@ public class ArtworkSelectorController: NSWindowController, ArtworkImageObjectDe
let offset = artworks.count
loadMoreArtworks(count: index + 1)
selectArtwork(at: index + offset)
break;
break
}
}
}
+12 -2
View File
@@ -117,7 +117,7 @@ public struct TheMovieDB: MetadataService {
}
if let backdropPath = result.backdrop_path,
let artwork = loadArtwork(filePath: backdropPath, baseURL: imageBaseURL, thumbSize: backdropThumbnailSize, kind: "poster") {
let artwork = loadArtwork(filePath: backdropPath, baseURL: imageBaseURL, thumbSize: backdropThumbnailSize, kind: "backdrop") {
artworks.append(artwork)
}
}
@@ -226,7 +226,7 @@ public struct TheMovieDB: MetadataService {
if let backdropPath = result.backdrop_path,
let url = URL(string: imageBaseURL + "original" + backdropPath),
let thumbURL = URL(string: imageBaseURL + backdropThumbnailSize + backdropPath) {
let remoteImage = RemoteImage(url: url, thumbURL: thumbURL, service: self.name, type: "poster")
let remoteImage = RemoteImage(url: url, thumbURL: thumbURL, service: self.name, type: "backdrop")
artworks.append(remoteImage)
}
}
@@ -335,12 +335,22 @@ public struct TheMovieDB: MetadataService {
artworks.append(contentsOf: seasonImages.flatMap { loadArtwork(filePath: $0.file_path, baseURL: imageBaseURL, thumbSize: posterThumbnailSize, kind: "season") } )
artworks.append(contentsOf: episodeImages.flatMap { loadArtwork(filePath: $0.file_path, baseURL: imageBaseURL, thumbSize: posterThumbnailSize, kind: "episode") } )
}
}
if let existingArtworks = metadata.remoteArtworks {
artworks.append(contentsOf: existingArtworks.toStruct())
}
// add iTunes artwork
if let name = metadata[SBMetadataResultSeriesName] as? String,
let iTunesMetadata = iTunesStore.quickiTunesSearch(tvSeriesName: name,
seasonNum: metadata[SBMetadataResultSeason] as? Int,
episodeNum: metadata[SBMetadataResultEpisodeNumber] as? Int),
let iTunesArtwork = iTunesMetadata.remoteArtworks {
artworks.insert(contentsOf: iTunesArtwork.toStruct(), at: 0)
}
metadata.remoteArtworks = artworks.toClass()
return metadata
+1 -1
View File
@@ -76,7 +76,7 @@ public struct iTunesStore: MetadataService {
// MARK: - Quick iTunes search for metadata
public static func quickiTunesSearch(tvSeriesName: String, seasonNum: Int, episodeNum: Int) -> SBMetadataResult? {
public static func quickiTunesSearch(tvSeriesName: String, seasonNum: Int?, episodeNum: Int?) -> SBMetadataResult? {
guard let language = UserDefaults.standard.string(forKey: "SBMetadataPreference|TV|iTunes Store|Language") else { return nil }
return iTunesStore().search(TVSeries: tvSeriesName, language: language, season: seasonNum, episode: episodeNum).first
}