Use the "backdrop" name for backdrops.
This commit is contained in:
1 parent
427614c3e0
commit
fb1d3c7602
3 files changed
+17
-5
No files matched your search
@@ -150,8 +150,10 @@ public class ArtworkSelectorController: NSWindowController, ArtworkImageObjectDe
|
|||||||
// MARK: - Load images
|
// MARK: - Load images
|
||||||
override public func windowDidLoad() {
|
override public func windowDidLoad() {
|
||||||
super.windowDidLoad()
|
super.windowDidLoad()
|
||||||
|
|
||||||
if let size = initialSize { window?.setContentSize(size) }
|
if let size = initialSize { window?.setContentSize(size) }
|
||||||
loadMoreArtwork(self)
|
|
||||||
|
loadMoreArtworks(count: 8)
|
||||||
|
|
||||||
if let defaultType = UserDefaults.standard.string(forKey: "SBArtworkSelectorDefault|\(type.rawValue)") {
|
if let defaultType = UserDefaults.standard.string(forKey: "SBArtworkSelectorDefault|\(type.rawValue)") {
|
||||||
selectArtwork(type: defaultType)
|
selectArtwork(type: defaultType)
|
||||||
@@ -200,7 +202,7 @@ public class ArtworkSelectorController: NSWindowController, ArtworkImageObjectDe
|
|||||||
let offset = artworks.count
|
let offset = artworks.count
|
||||||
loadMoreArtworks(count: index + 1)
|
loadMoreArtworks(count: index + 1)
|
||||||
selectArtwork(at: index + offset)
|
selectArtwork(at: index + offset)
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ public struct TheMovieDB: MetadataService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let backdropPath = result.backdrop_path,
|
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)
|
artworks.append(artwork)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -226,7 +226,7 @@ public struct TheMovieDB: MetadataService {
|
|||||||
if let backdropPath = result.backdrop_path,
|
if let backdropPath = result.backdrop_path,
|
||||||
let url = URL(string: imageBaseURL + "original" + backdropPath),
|
let url = URL(string: imageBaseURL + "original" + backdropPath),
|
||||||
let thumbURL = URL(string: imageBaseURL + backdropThumbnailSize + 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)
|
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: 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") } )
|
artworks.append(contentsOf: episodeImages.flatMap { loadArtwork(filePath: $0.file_path, baseURL: imageBaseURL, thumbSize: posterThumbnailSize, kind: "episode") } )
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if let existingArtworks = metadata.remoteArtworks {
|
if let existingArtworks = metadata.remoteArtworks {
|
||||||
artworks.append(contentsOf: existingArtworks.toStruct())
|
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()
|
metadata.remoteArtworks = artworks.toClass()
|
||||||
|
|
||||||
return metadata
|
return metadata
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public struct iTunesStore: MetadataService {
|
|||||||
|
|
||||||
// MARK: - Quick iTunes search for metadata
|
// 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 }
|
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
|
return iTunesStore().search(TVSeries: tvSeriesName, language: language, season: seasonNum, episode: episodeNum).first
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user