diff --git a/TagTunes/AlbumTableCellView.swift b/TagTunes/AlbumTableCellView.swift
index 1c408e3..49d9df4 100644
--- a/TagTunes/AlbumTableCellView.swift
+++ b/TagTunes/AlbumTableCellView.swift
@@ -120,7 +120,7 @@ public class AlbumTableCellView: AdvancedTableCellView {
public func setupForAlbum(album: Album, loading: Bool, error: NSError?) {
textField?.stringValue = Preferences.sharedPreferences.useCensoredNames ? album.censoredName : album.name
secondaryTextField?.stringValue = album.artistName
- asyncImageView.downloadImageFromURL(album.artwork.hiResURL)
+ asyncImageView.downloadImageFromURL(album.artwork.displayImageURL)
if loading {
textField?.textColor = NSColor.disabledControlTextColor()
rightAccessoryView = loadingIndicator
@@ -163,7 +163,7 @@ public class AlbumTableCellView: AdvancedTableCellView {
textField?.stringValue = Preferences.sharedPreferences.useCensoredNames ? searchResult.censoredName : searchResult.name
textField?.textColor = NSColor.controlTextColor()
secondaryTextField?.stringValue = searchResult.artistName
- asyncImageView.downloadImageFromURL(searchResult.artwork.hiResURL)
+ asyncImageView.downloadImageFromURL(searchResult.artwork.displayImageURL)
if selectable {
button.title = NSLocalizedString("Select", comment: "Button title for 'selecting a search result'")
button.enabled = true
diff --git a/TagTunes/Artwork.swift b/TagTunes/Artwork.swift
index 527d58b..de18c9e 100644
--- a/TagTunes/Artwork.swift
+++ b/TagTunes/Artwork.swift
@@ -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
+ }
+
}
diff --git a/TagTunes/Base.lproj/Main.storyboard b/TagTunes/Base.lproj/Main.storyboard
index fc6f366..262aff4 100644
--- a/TagTunes/Base.lproj/Main.storyboard
+++ b/TagTunes/Base.lproj/Main.storyboard
@@ -831,6 +831,9 @@ CA
+
+
+
@@ -932,7 +935,7 @@ CA
-
+
diff --git a/TagTunes/Preferences.swift b/TagTunes/Preferences.swift
index 2850af2..3e124ad 100644
--- a/TagTunes/Preferences.swift
+++ b/TagTunes/Preferences.swift
@@ -36,6 +36,8 @@ import Cocoa
static let removeSavedAlbumsKey = "Remove Saved Albums"
+ static let useLowResolutionArtworkKey = "Use Low Resolution Artwork"
+
static let useCensoredNamesKey = "Use Censored Names"
static let caseSensitiveKey = "Case Sensitive"
@@ -72,6 +74,7 @@ import Cocoa
UserDefaultsConstants.saveArtworkKey: false,
UserDefaultsConstants.keepSearchResultsKey: false,
UserDefaultsConstants.removeSavedAlbumsKey: false,
+ UserDefaultsConstants.useLowResolutionArtworkKey: false,
UserDefaultsConstants.useCensoredNamesKey: false,
UserDefaultsConstants.caseSensitiveKey: true,
UserDefaultsConstants.clearArtworksKey: false
@@ -121,6 +124,17 @@ import Cocoa
}
}
+ /// If `true` the main table view will use 100x100 artworks instead of full
+ /// sized images. This option does not affect saving.
+ public dynamic var useLowResolutionArtwork: Bool {
+ set {
+ NSUserDefaults.standardUserDefaults().setBool(newValue, forKey: UserDefaultsConstants.useLowResolutionArtworkKey)
+ }
+ get {
+ return NSUserDefaults.standardUserDefaults().boolForKey(UserDefaultsConstants.useLowResolutionArtworkKey)
+ }
+ }
+
// MARK: Tag Preferences
/// If `true` TagTunes displays and saves censored names instead of the