diff --git a/Changelog.txt b/Changelog.txt
index 93e58fe..702fbe4 100644
--- a/Changelog.txt
+++ b/Changelog.txt
@@ -5,7 +5,7 @@ Version 1.0
Version 1.1
Added:
-+ 'Try again' option for errors.
++ 'Try again' option for errors
+ Options for tags not to be saved
+ Option to use censored names
+ Option for case (in)sensitivity
@@ -19,4 +19,5 @@ Fixed:
Version 1.2
Added:
-+ Option for displayed number of search results
\ No newline at end of file
++ Option for displayed number of search results
++ Option to change the iTunes Store used to get tags
\ No newline at end of file
diff --git a/README.md b/README.md
index d4c5390..fccd91b 100644
--- a/README.md
+++ b/README.md
@@ -24,6 +24,9 @@ The first release of TagTunes includes all functions needed to clean your iTunes
#### How does TagTunes work?
> TagTunes uses Apple's [Search API][Search API] to get its tags.
+#### TagTunes does not find an album but iTunes does
+> There is a different iTunes Store for each country. By default TagTunes uses a store based on your current system settings. You can change the store used by TagTunes in the preferences.
+
#### The tags I got from TagTunes differ from the one's in the iTunes Store.
> Unfortunately Apple's Search API does not always return the name results as the iTunes Store does. This mainly affects composers (which aren't returned by the Search API at all) and track titles.
diff --git a/TagTunes/Base.lproj/Main.storyboard b/TagTunes/Base.lproj/Main.storyboard
index 9f74fad..44aa7c4 100644
--- a/TagTunes/Base.lproj/Main.storyboard
+++ b/TagTunes/Base.lproj/Main.storyboard
@@ -760,11 +760,11 @@ CA
-
+
-
+
@@ -802,7 +802,7 @@ CA
-
+
@@ -854,7 +854,7 @@ CA
-
+
@@ -862,7 +862,7 @@ CA
-
+
@@ -871,7 +871,7 @@ CA
-
+
@@ -889,16 +889,59 @@ CA
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ There is some music that does not exist in all iTunes Stores. You can select a country to search the iTunes Store for that country.
+
+
+
+
+
-
+
+
@@ -908,12 +951,17 @@ CA
+
+
+
+
+
@@ -921,7 +969,7 @@ CA
-
+
@@ -933,7 +981,7 @@ CA
-
+
diff --git a/TagTunes/Preference Controllers.swift b/TagTunes/Preference Controllers.swift
index 68b8bf8..9c71524 100644
--- a/TagTunes/Preference Controllers.swift
+++ b/TagTunes/Preference Controllers.swift
@@ -42,6 +42,20 @@ internal class GeneralPreferencesViewController: NSViewController {
}
}
+ dynamic var iTunesStores: [String] {
+ return NSLocale.ISOCountryCodes().map { NSLocale.currentLocale().displayNameForKey(NSLocaleCountryCode, value: $0)! }
+ }
+
+ dynamic var currentITunesStoreIndex: Int {
+ set {
+ let countryCode = NSLocale.ISOCountryCodes()[newValue]
+ Preferences.sharedPreferences.iTunesStore = countryCode
+ }
+ get {
+ return NSLocale.ISOCountryCodes().indexOf(Preferences.sharedPreferences.iTunesStore)!
+ }
+ }
+
}
internal class TagsPreferencesViewController: NSViewController, NSTableViewDataSource, NSTableViewDelegate, NSMenuDelegate {
diff --git a/TagTunes/Preferences.swift b/TagTunes/Preferences.swift
index a30a5d5..655677e 100644
--- a/TagTunes/Preferences.swift
+++ b/TagTunes/Preferences.swift
@@ -38,6 +38,8 @@ import Cocoa
static let numberOfSearchResultsKey = "Number of Search Results"
+ static let iTunesStoreKey = "iTunes Store"
+
static let removeSavedAlbumsKey = "Remove Saved Albums"
static let useLowResolutionArtworkKey = "Use Low Resolution Artwork"
@@ -79,6 +81,7 @@ import Cocoa
UserDefaultsConstants.overwriteExistingFilesKey: false,
UserDefaultsConstants.keepSearchResultsKey: false,
UserDefaultsConstants.numberOfSearchResultsKey: 10,
+ UserDefaultsConstants.iTunesStoreKey: NSLocale.currentLocale().objectForKey(NSLocaleCountryCode)!,
UserDefaultsConstants.removeSavedAlbumsKey: false,
UserDefaultsConstants.useLowResolutionArtworkKey: false,
UserDefaultsConstants.useCensoredNamesKey: false,
@@ -150,6 +153,18 @@ import Cocoa
}
}
+ /// The iTunes Store from which the metadata should be loaded.
+ ///
+ /// The value of this property must be a valid two-letter ISO country code.
+ public dynamic var iTunesStore: String {
+ set {
+ NSUserDefaults.standardUserDefaults().setObject(newValue, forKey: UserDefaultsConstants.iTunesStoreKey)
+ }
+ get {
+ return NSUserDefaults.standardUserDefaults().stringForKey(UserDefaultsConstants.iTunesStoreKey)!
+ }
+ }
+
/// 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 {
diff --git a/TagTunes/iTunes.swift b/TagTunes/iTunes.swift
index 2218095..ead23b3 100644
--- a/TagTunes/iTunes.swift
+++ b/TagTunes/iTunes.swift
@@ -129,7 +129,7 @@ public struct iTunesAPI {
if searchTerm.isEmpty {
return nil
}
- return NSURL(string: "https://itunes.apple.com/search?term=\(searchTerm)&media=music&entity=album&limit=\(Preferences.sharedPreferences.numberOfSearchResults)&country=de&lang=de_DE")
+ return NSURL(string: "https://itunes.apple.com/search?term=\(searchTerm)&media=music&entity=album&limit=\(Preferences.sharedPreferences.numberOfSearchResults)&country=\(Preferences.sharedPreferences.iTunesStore)")
}
/// Creates an URL that looks up all tracks that belong to the album with the
@@ -138,7 +138,7 @@ public struct iTunesAPI {
///
/// This function respects the user's preferences (See `Preferences` class).
public static func createAlbumLookupURLForId(id: iTunesId) -> NSURL {
- return NSURL(string: "http://itunes.apple.com/lookup?id=\(id)&entity=song&country=de&lang=de_DE&limit=200")!
+ return NSURL(string: "http://itunes.apple.com/lookup?id=\(id)&entity=song&country=\(Preferences.sharedPreferences.iTunesStore)&limit=200")!
}
}