Archived
1

Added option to use lower resolution artworks in TagTunes

This commit is contained in:
Kim Wittenburg
2015-09-15 14:17:40 +02:00
committed by Kim Wittenburg
parent d49ad31b79
commit dcd7d2620d
4 changed files with 35 additions and 4 deletions

View File

@@ -56,7 +56,7 @@ public class Artwork: iTunesType {
let filePath = directory.stringByAppendingString("/\(filename).tiff")
try NSFileManager.defaultManager().createDirectoryAtPath(directory, withIntermediateDirectories: true, attributes: nil)
let _ = NSFileManager.defaultManager().createFileAtPath(filePath, contents: hiResImage?.TIFFRepresentation, attributes: nil)
let _ = NSFileManager.defaultManager().createFileAtPath(filePath, contents: saveImage?.TIFFRepresentation, attributes: nil)
}
// MARK: Calculated Properties
@@ -103,4 +103,18 @@ public class Artwork: iTunesType {
return cachedHiResImage
}
/// Returns the url of an image that should be used to display this artwork
/// with respect to the user's preferences.
public var displayImageURL: NSURL {
if !Preferences.sharedPreferences.useLowResolutionArtwork && hiResURL != nil {
return hiResURL
}
return url100
}
/// Returns the image that should be used to save this artwork.
public var saveImage: NSImage? {
return hiResImage != nil ? hiResImage : image100
}
}