Archived
1

Added "Use English Tags" Preference

This commit is contained in:
Kim Wittenburg
2015-10-21 10:27:58 +02:00
committed by Kim Wittenburg
parent 98d6d492d0
commit f75c16cb27
4 changed files with 60 additions and 18 deletions

View File

@@ -502,11 +502,11 @@ CA
<objects>
<viewController title="iTunes Store" id="eFs-7W-C1H" customClass="StorePreferencesViewController" customModule="TagTunes" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" id="Xpd-Fo-HYN" customClass="PreferenceView" customModule="AppKitPlus">
<rect key="frame" x="0.0" y="0.0" width="450" height="197"/>
<rect key="frame" x="0.0" y="0.0" width="450" height="212"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button translatesAutoresizingMaskIntoConstraints="NO" id="HT2-V6-Vrs">
<rect key="frame" x="18" y="68" width="184" height="18"/>
<rect key="frame" x="18" y="54" width="184" height="18"/>
<animations/>
<buttonCell key="cell" type="check" title="Use low resolution artwork" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="pp5-kZ-w5f">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
@@ -517,17 +517,16 @@ CA
</connections>
</button>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ODz-LZ-Acs">
<rect key="frame" x="30" y="20" width="402" height="42"/>
<rect key="frame" x="30" y="20" width="402" height="28"/>
<animations/>
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" id="NMm-Jw-bon">
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" title="This option only affects artwork displayed in TagTunes. Saved artwork will always have full resolution." id="NMm-Jw-bon">
<font key="font" metaFont="smallSystem"/>
<string key="title">This option one affects artwork displayed in TagTunes. Saved artwork will always have full resolution. Using this option may make searching faster but will also slow down saving.</string>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dA4-F6-y0G">
<rect key="frame" x="227" y="154" width="19" height="27"/>
<rect key="frame" x="227" y="169" width="19" height="27"/>
<animations/>
<stepperCell key="cell" continuous="YES" alignment="left" minValue="1" maxValue="200" doubleValue="1" id="qF2-IP-GuD"/>
<connections>
@@ -535,7 +534,7 @@ CA
</connections>
</stepper>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="tZ6-50-jBC">
<rect key="frame" x="18" y="160" width="98" height="17"/>
<rect key="frame" x="18" y="175" width="98" height="17"/>
<animations/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Search Results:" id="aTC-x8-iNw">
<font key="font" metaFont="system"/>
@@ -544,7 +543,7 @@ CA
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Fxp-Bf-M0J">
<rect key="frame" x="122" y="157" width="100" height="22"/>
<rect key="frame" x="122" y="172" width="100" height="22"/>
<constraints>
<constraint firstAttribute="width" constant="100" id="Slg-G8-db4"/>
</constraints>
@@ -563,7 +562,7 @@ CA
</connections>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="QpH-uA-EUO">
<rect key="frame" x="18" y="132" width="84" height="17"/>
<rect key="frame" x="18" y="147" width="84" height="17"/>
<animations/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="iTunes Store:" id="M6p-MI-JS7">
<font key="font" metaFont="system"/>
@@ -572,7 +571,7 @@ CA
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="k1x-7X-WP5">
<rect key="frame" x="106" y="125" width="105" height="26"/>
<rect key="frame" x="106" y="140" width="105" height="26"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="100" id="FjM-26-Vzy"/>
</constraints>
@@ -583,12 +582,12 @@ CA
<menu key="menu" id="Snk-Ps-hdB"/>
</popUpButtonCell>
<connections>
<binding destination="eFs-7W-C1H" name="content" keyPath="iTunesStores" id="tGj-cU-CGC"/>
<binding destination="eFs-7W-C1H" name="selectedIndex" keyPath="currentITunesStoreIndex" previousBinding="tGj-cU-CGC" id="Hdo-09-3JW"/>
<binding destination="eFs-7W-C1H" name="content" keyPath="iTunesStores" id="tGj-cU-CGC"/>
</connections>
</popUpButton>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="gzG-qy-YYr">
<rect key="frame" x="30" y="92" width="402" height="28"/>
<rect key="frame" x="30" y="107" width="402" height="28"/>
<animations/>
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" id="xMj-9f-8N6">
<font key="font" metaFont="smallSystem"/>
@@ -597,15 +596,46 @@ CA
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Mtw-lO-h9I">
<rect key="frame" x="138" y="75" width="168" height="26"/>
<animations/>
<popUpButtonCell key="cell" type="push" title="English" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" tag="1" imageScaling="proportionallyDown" inset="2" selectedItem="1wo-cb-tWj" id="wUi-qM-3kU">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="hrO-S2-gum">
<items>
<menuItem title="Same as iTunes Store" id="Y63-oI-goT"/>
<menuItem title="English" state="on" tag="1" id="1wo-cb-tWj"/>
</items>
</menu>
</popUpButtonCell>
<connections>
<binding destination="AI4-XW-81o" name="selectedTag" keyPath="sharedPreferences.useEnglishTags" id="J89-Uj-yog"/>
</connections>
</popUpButton>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="LdU-fV-yc9">
<rect key="frame" x="18" y="81" width="116" height="17"/>
<animations/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Language of Tags:" id="dxA-BL-XqG">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<constraints>
<constraint firstItem="Mtw-lO-h9I" firstAttribute="baseline" secondItem="LdU-fV-yc9" secondAttribute="baseline" id="5ft-Rx-T6s"/>
<constraint firstItem="k1x-7X-WP5" firstAttribute="top" secondItem="Fxp-Bf-M0J" secondAttribute="bottom" constant="8" id="7qz-7n-M4x"/>
<constraint firstItem="Fxp-Bf-M0J" firstAttribute="leading" secondItem="tZ6-50-jBC" secondAttribute="trailing" constant="8" symbolic="YES" id="8FR-UJ-8XC"/>
<constraint firstItem="Mtw-lO-h9I" firstAttribute="leading" secondItem="LdU-fV-yc9" secondAttribute="trailing" constant="8" symbolic="YES" id="8YH-x8-DSd"/>
<constraint firstItem="tZ6-50-jBC" firstAttribute="top" secondItem="Xpd-Fo-HYN" secondAttribute="top" constant="20" symbolic="YES" id="8oj-aa-nCm"/>
<constraint firstItem="LdU-fV-yc9" firstAttribute="leading" secondItem="tZ6-50-jBC" secondAttribute="leading" id="CUz-yq-0Fm"/>
<constraint firstItem="Fxp-Bf-M0J" firstAttribute="baseline" secondItem="tZ6-50-jBC" secondAttribute="baseline" id="FX1-xH-vOa"/>
<constraint firstItem="k1x-7X-WP5" firstAttribute="baseline" secondItem="QpH-uA-EUO" secondAttribute="baseline" id="GfC-VO-PQS"/>
<constraint firstItem="Mtw-lO-h9I" firstAttribute="top" secondItem="gzG-qy-YYr" secondAttribute="bottom" constant="8" id="HOh-z8-KD3"/>
<constraint firstAttribute="trailing" secondItem="gzG-qy-YYr" secondAttribute="trailing" constant="20" symbolic="YES" id="HrQ-7O-26V"/>
<constraint firstItem="tZ6-50-jBC" firstAttribute="leading" secondItem="Xpd-Fo-HYN" secondAttribute="leading" constant="20" symbolic="YES" id="L67-ta-ag1"/>
<constraint firstItem="HT2-V6-Vrs" firstAttribute="top" secondItem="Mtw-lO-h9I" secondAttribute="bottom" constant="8" symbolic="YES" id="NAR-TU-FBm"/>
<constraint firstItem="dA4-F6-y0G" firstAttribute="centerY" secondItem="Fxp-Bf-M0J" secondAttribute="centerY" id="QP4-nn-4oz"/>
<constraint firstItem="dA4-F6-y0G" firstAttribute="leading" secondItem="Fxp-Bf-M0J" secondAttribute="trailing" constant="8" symbolic="YES" id="QmR-Np-Qqg"/>
<constraint firstItem="gzG-qy-YYr" firstAttribute="leading" secondItem="QpH-uA-EUO" secondAttribute="leading" constant="12" id="Uym-vB-f2X"/>
@@ -614,7 +644,6 @@ CA
<constraint firstAttribute="trailing" secondItem="ODz-LZ-Acs" secondAttribute="trailing" constant="20" symbolic="YES" id="cdY-Lu-hG4"/>
<constraint firstItem="QpH-uA-EUO" firstAttribute="leading" secondItem="tZ6-50-jBC" secondAttribute="leading" id="dyb-6z-MWP"/>
<constraint firstItem="HT2-V6-Vrs" firstAttribute="leading" secondItem="tZ6-50-jBC" secondAttribute="leading" id="gtz-u4-bBe"/>
<constraint firstItem="HT2-V6-Vrs" firstAttribute="top" secondItem="gzG-qy-YYr" secondAttribute="bottom" constant="8" symbolic="YES" id="hN4-YB-l3W"/>
<constraint firstItem="ODz-LZ-Acs" firstAttribute="top" secondItem="HT2-V6-Vrs" secondAttribute="bottom" constant="8" symbolic="YES" id="tlc-yV-nZb"/>
<constraint firstItem="k1x-7X-WP5" firstAttribute="leading" secondItem="QpH-uA-EUO" secondAttribute="trailing" constant="8" symbolic="YES" id="uG3-te-Y6Y"/>
</constraints>
@@ -624,7 +653,7 @@ CA
<real key="value" value="450"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="height">
<real key="value" value="197"/>
<real key="value" value="212"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
@@ -632,7 +661,7 @@ CA
<customObject id="8Lt-AO-VZl" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
<customObject id="AI4-XW-81o" customClass="PreferencesSingleton" customModule="TagTunes" customModuleProvider="target"/>
</objects>
<point key="canvasLocation" x="-767" y="1084.5"/>
<point key="canvasLocation" x="-767" y="1092"/>
</scene>
<!--Tags-->
<scene sceneID="oNy-iK-NsG">

View File

@@ -40,6 +40,8 @@ import Cocoa
static let iTunesStoreKey = "iTunes Store"
static let useEnglishTagsKey = "Use English Tags"
static let useLowResolutionArtworkKey = "Use Low Resolution Artwork"
static let removeSavedItemsKey = "Remove Saved Items"
@@ -84,6 +86,7 @@ import Cocoa
UserDefaultsConstants.keepSearchResultsKey: false,
UserDefaultsConstants.numberOfSearchResultsKey: 10,
UserDefaultsConstants.iTunesStoreKey: NSLocale.currentLocale().objectForKey(NSLocaleCountryCode)!,
UserDefaultsConstants.useEnglishTagsKey: false,
UserDefaultsConstants.useLowResolutionArtworkKey: false,
UserDefaultsConstants.removeSavedItemsKey: false,
UserDefaultsConstants.keepSavedAlbumsKey: false,
@@ -167,6 +170,16 @@ import Cocoa
return NSUserDefaults.standardUserDefaults().stringForKey(UserDefaultsConstants.iTunesStoreKey)!
}
}
/// If `true` the Search API Request adds the "lang=en" option.
public dynamic var useEnglishTags: Bool {
set {
NSUserDefaults.standardUserDefaults().setBool(newValue, forKey: UserDefaultsConstants.useEnglishTagsKey)
}
get {
return NSUserDefaults.standardUserDefaults().boolForKey(UserDefaultsConstants.useEnglishTagsKey)
}
}
/// If `true` the main table view will use 100x100 artworks instead of full
/// sized images. This option does not affect saving.

View File

@@ -72,7 +72,7 @@
"M6p-MI-JS7.title" = "iTunes Store:";
/* Class = "NSTextFieldCell"; title = "This option one affects artwork displayed in TagTunes. Saved artwork will always have full resolution. Using this option may make searching faster but will also slow down saving."; ObjectID = "NMm-Jw-bon"; */
"NMm-Jw-bon.title" = "Diese Einstellung ändert nur die Darstellung in TagTunes. Beim Speichern wird das Cover immer mit der höchsten Auflösung gesichert. Wenn diese Optiona aktiviert ist, werden Suchergebnisse schneller geladen, jedoch verlängert sich die Zeit beim Speichern.";
"NMm-Jw-bon.title" = "Diese Einstellung ändert nur die Darstellung in TagTunes. Beim Speichern wird das Cover immer mit der höchsten Auflösung gesichert.";
/* Class = "NSMenuItem"; title = "Services"; ObjectID = "NMo-om-nkz"; */
"NMo-om-nkz.title" = "Dienste";

View File

@@ -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=\(Preferences.sharedPreferences.iTunesStore)")
return NSURL(string: "https://itunes.apple.com/search?term=\(searchTerm)&media=music&entity=album&limit=\(Preferences.sharedPreferences.numberOfSearchResults)&country=\(Preferences.sharedPreferences.iTunesStore)" + (Preferences.sharedPreferences.useEnglishTags ? "&lang=en" : ""))
}
/// 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=\(Preferences.sharedPreferences.iTunesStore)&limit=200")!
return NSURL(string: "http://itunes.apple.com/lookup?id=\(id)&entity=song&country=\(Preferences.sharedPreferences.iTunesStore)&limit=200" + (Preferences.sharedPreferences.useEnglishTags ? "&lang=en" : ""))!
}
}