Add a preference to select the preferred artwork in the queue.

This commit is contained in:
Damiano Galassi committed 2016-11-22 11:27:11 +01:00
1 parent 2dda6bc6e2
commit 8744676fe8
6 files changed
+115 -38

No files matched your search

+59 -15
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11542" systemVersion="16B2555" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11761" systemVersion="16C48b" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11542"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11761"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -15,7 +15,7 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="UlG-O3-eNc" userLabel="OptionsView">
<rect key="frame" x="0.0" y="0.0" width="357" height="382"/>
<rect key="frame" x="0.0" y="0.0" width="357" height="411"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<button translatesAutoresizingMaskIntoConstraints="NO" id="zEH-aV-Tl7">
@@ -33,7 +33,7 @@
</connections>
</button>
<button toolTip="Search metadata online" translatesAutoresizingMaskIntoConstraints="NO" id="9GN-f6-r2j">
<rect key="frame" x="110" y="356" width="105" height="18"/>
<rect key="frame" x="110" y="385" width="105" height="18"/>
<buttonCell key="cell" type="check" title="Fetch Metadata" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" state="on" inset="2" id="QNO-e1-WUJ">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="smallSystem"/>
@@ -158,7 +158,7 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" preferredMaxLayoutWidth="200" translatesAutoresizingMaskIntoConstraints="NO" id="eTL-yP-QQ5">
<rect key="frame" x="123" y="337" width="48" height="14"/>
<rect key="frame" x="123" y="366" width="48" height="14"/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Movies:" id="W6m-cd-JMe">
<font key="font" metaFont="smallSystemBold"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -169,7 +169,7 @@
</connections>
</textField>
<textField verticalHuggingPriority="750" preferredMaxLayoutWidth="200" translatesAutoresizingMaskIntoConstraints="NO" id="bDo-OD-bck">
<rect key="frame" x="123" y="291" width="63" height="14"/>
<rect key="frame" x="123" y="320" width="63" height="14"/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="TV Shows:" id="PCe-Pw-D2s">
<font key="font" metaFont="smallSystemBold"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -188,7 +188,7 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" preferredMaxLayoutWidth="200" translatesAutoresizingMaskIntoConstraints="NO" id="S7L-mA-j3Y">
<rect key="frame" x="18" y="358" width="89" height="14"/>
<rect key="frame" x="18" y="387" width="89" height="14"/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Add item:" id="9ls-xq-YGz">
<font key="font" metaFont="smallSystemBold"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -225,7 +225,7 @@
</connections>
</popUpButton>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ZVm-yi-3cE">
<rect key="frame" x="177" y="336" width="111" height="17"/>
<rect key="frame" x="177" y="365" width="111" height="17"/>
<constraints>
<constraint firstAttribute="width" constant="111" id="GuB-yU-C8O"/>
</constraints>
@@ -252,7 +252,7 @@
</connections>
</popUpButton>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="tLh-V3-OfB">
<rect key="frame" x="192" y="290" width="111" height="17"/>
<rect key="frame" x="192" y="319" width="111" height="17"/>
<popUpButtonCell key="cell" type="roundRect" bezelStyle="roundedRect" alignment="left" controlSize="small" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="UOb-Qe-IPw">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystem"/>
@@ -276,7 +276,7 @@
</connections>
</popUpButton>
<textField verticalHuggingPriority="750" preferredMaxLayoutWidth="200" translatesAutoresizingMaskIntoConstraints="NO" id="BWL-Nn-iGH">
<rect key="frame" x="133" y="271" width="63" height="14"/>
<rect key="frame" x="133" y="300" width="63" height="14"/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Language:" id="1dC-y4-0rx">
<font key="font" metaFont="smallSystemBold"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -286,8 +286,19 @@
<binding destination="-2" name="enabled" keyPath="self.options.SBQueueMetadata" id="A11-N0-4xV"/>
</connections>
</textField>
<textField verticalHuggingPriority="750" preferredMaxLayoutWidth="200" translatesAutoresizingMaskIntoConstraints="NO" id="Ns9-7q-hsh">
<rect key="frame" x="123" y="273" width="54" height="14"/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Artwork:" id="1HP-Np-D97">
<font key="font" metaFont="smallSystemBold"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<binding destination="-2" name="enabled" keyPath="self.options.SBQueueMetadata" id="yVt-sh-KZm"/>
</connections>
</textField>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Ce4-O7-Iu4">
<rect key="frame" x="202" y="270" width="111" height="17"/>
<rect key="frame" x="202" y="299" width="111" height="17"/>
<popUpButtonCell key="cell" type="roundRect" bezelStyle="roundedRect" alignment="left" controlSize="small" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="nqF-p0-mT7">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystem"/>
@@ -311,7 +322,7 @@
</connections>
</popUpButton>
<textField verticalHuggingPriority="750" preferredMaxLayoutWidth="200" translatesAutoresizingMaskIntoConstraints="NO" id="73q-gi-fe2">
<rect key="frame" x="133" y="317" width="63" height="14"/>
<rect key="frame" x="133" y="346" width="63" height="14"/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Language:" id="VkG-jW-ibO">
<font key="font" metaFont="smallSystemBold"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -322,7 +333,7 @@
</connections>
</textField>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="5rh-cM-iOg">
<rect key="frame" x="202" y="316" width="111" height="17"/>
<rect key="frame" x="202" y="345" width="111" height="17"/>
<popUpButtonCell key="cell" type="roundRect" bezelStyle="roundedRect" alignment="left" controlSize="small" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="gZb-sF-UQs">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystem"/>
@@ -439,6 +450,34 @@
</binding>
</connections>
</button>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="08Q-2k-0Gb">
<rect key="frame" x="183" y="271" width="109" height="17"/>
<popUpButtonCell key="cell" type="roundRect" title="Provider Default" bezelStyle="roundedRect" alignment="left" controlSize="small" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" selectedItem="YjX-6f-SPu" id="1t8-o9-ckI">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystem"/>
<menu key="menu" title="OtherViews" id="0zS-9Z-m6I">
<items>
<menuItem title="Provider Default" id="YjX-6f-SPu">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="iTunes" tag="1" id="QR6-hq-GZL">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Episode" tag="2" id="7zv-RG-1w4">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Season" tag="3" id="mps-yj-l7z">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
</menu>
</popUpButtonCell>
<connections>
<accessibilityConnection property="title" destination="Ns9-7q-hsh" id="Ket-SC-hm0"/>
<binding destination="-2" name="enabled" keyPath="self.options.SBQueueMetadata" id="Iqc-R5-L9d"/>
<binding destination="-2" name="selectedTag" keyPath="options.SBQueueProviderArtwork" id="P2I-s3-oH6"/>
</connections>
</popUpButton>
</subviews>
<constraints>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="slL-2h-MPl" secondAttribute="trailing" constant="20" id="0EO-hK-q5e"/>
@@ -447,12 +486,13 @@
<constraint firstItem="86l-GG-SpO" firstAttribute="baseline" secondItem="vJ5-JB-k1m" secondAttribute="baseline" id="30V-Om-Uhz"/>
<constraint firstItem="86l-GG-SpO" firstAttribute="top" secondItem="DVM-Js-DwK" secondAttribute="bottom" constant="4" id="3mA-zf-zZm"/>
<constraint firstItem="ZZk-4j-Ji7" firstAttribute="top" secondItem="slL-2h-MPl" secondAttribute="bottom" constant="4" id="3me-TJ-211"/>
<constraint firstItem="Ns9-7q-hsh" firstAttribute="leading" secondItem="bDo-OD-bck" secondAttribute="leading" id="5sA-0F-meJ"/>
<constraint firstItem="muY-E0-hVI" firstAttribute="width" secondItem="vJ5-JB-k1m" secondAttribute="width" id="5tG-uE-aeE"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="5rh-cM-iOg" secondAttribute="trailing" priority="750" constant="20" id="7Da-zR-5Y7"/>
<constraint firstItem="ZVm-yi-3cE" firstAttribute="leading" secondItem="eTL-yP-QQ5" secondAttribute="trailing" constant="8" id="7T2-6l-HYr"/>
<constraint firstItem="NhN-Lg-awX" firstAttribute="baseline" secondItem="DVM-Js-DwK" secondAttribute="baseline" id="8Cp-6o-kA4"/>
<constraint firstItem="ccd-Xn-Dj3" firstAttribute="top" secondItem="Ce4-O7-Iu4" secondAttribute="bottom" constant="14" id="9qO-nZ-2Ga"/>
<constraint firstItem="DVM-Js-DwK" firstAttribute="leading" secondItem="NhN-Lg-awX" secondAttribute="trailing" constant="5" id="A1k-kg-a8J"/>
<constraint firstItem="ccd-Xn-Dj3" firstAttribute="top" secondItem="08Q-2k-0Gb" secondAttribute="bottom" constant="15" id="Bq9-Tm-H1q"/>
<constraint firstItem="DVM-Js-DwK" firstAttribute="top" secondItem="ZZk-4j-Ji7" secondAttribute="bottom" constant="16" id="Ckz-u5-DHH"/>
<constraint firstItem="etc-K7-Atw" firstAttribute="top" secondItem="TV6-Sk-Bqr" secondAttribute="bottom" constant="6" id="DLe-Jt-ggK"/>
<constraint firstItem="tLh-V3-OfB" firstAttribute="baseline" secondItem="bDo-OD-bck" secondAttribute="baseline" id="DkA-18-WbB"/>
@@ -470,6 +510,7 @@
<constraint firstItem="zEH-aV-Tl7" firstAttribute="leading" secondItem="MGZ-hB-jhx" secondAttribute="leading" id="Nlo-A9-ESw"/>
<constraint firstItem="22k-mA-HyA" firstAttribute="top" secondItem="etc-K7-Atw" secondAttribute="bottom" constant="6" id="OTk-pM-SaL"/>
<constraint firstItem="ZVm-yi-3cE" firstAttribute="width" secondItem="5rh-cM-iOg" secondAttribute="width" id="PZr-W4-6ok"/>
<constraint firstItem="08Q-2k-0Gb" firstAttribute="top" secondItem="Ce4-O7-Iu4" secondAttribute="bottom" constant="12" id="Psc-21-kax"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="DVM-Js-DwK" secondAttribute="trailing" constant="20" id="THN-Kq-Zh9"/>
<constraint firstItem="86l-GG-SpO" firstAttribute="leading" secondItem="vJ5-JB-k1m" secondAttribute="trailing" constant="5" id="TeG-3v-fcb"/>
<constraint firstItem="Uoo-hZ-D1f" firstAttribute="leading" secondItem="S7L-mA-j3Y" secondAttribute="leading" id="TjC-EV-4Xa"/>
@@ -493,6 +534,7 @@
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="yI9-2a-q2a" secondAttribute="trailing" constant="20" id="d2E-dG-y9d"/>
<constraint firstItem="73q-gi-fe2" firstAttribute="baseline" secondItem="5rh-cM-iOg" secondAttribute="baseline" id="dQ5-0I-48F"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="etc-K7-Atw" secondAttribute="trailing" constant="20" id="dkQ-8f-2fd"/>
<constraint firstItem="08Q-2k-0Gb" firstAttribute="baseline" secondItem="Ns9-7q-hsh" secondAttribute="baseline" id="fG1-Oh-vZ3"/>
<constraint firstItem="TV6-Sk-Bqr" firstAttribute="leading" secondItem="ccd-Xn-Dj3" secondAttribute="leading" id="hnH-5m-uQi"/>
<constraint firstItem="TV6-Sk-Bqr" firstAttribute="top" secondItem="ccd-Xn-Dj3" secondAttribute="bottom" constant="6" id="i86-G2-ukZ"/>
<constraint firstItem="5rh-cM-iOg" firstAttribute="top" secondItem="ZVm-yi-3cE" secondAttribute="bottom" constant="4" id="iUq-0X-QIX"/>
@@ -510,10 +552,12 @@
<constraint firstItem="22k-mA-HyA" firstAttribute="leading" secondItem="etc-K7-Atw" secondAttribute="leading" id="nJP-73-hpw"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="ZZk-4j-Ji7" secondAttribute="trailing" constant="20" id="o5D-5D-f9z"/>
<constraint firstItem="MGZ-hB-jhx" firstAttribute="top" secondItem="KWg-Ak-bB6" secondAttribute="bottom" constant="23" id="ppd-vB-wtt"/>
<constraint firstItem="08Q-2k-0Gb" firstAttribute="leading" secondItem="Ns9-7q-hsh" secondAttribute="trailing" constant="8" id="pqo-4J-2VU"/>
<constraint firstItem="ZZk-4j-Ji7" firstAttribute="baseline" secondItem="swT-iM-shZ" secondAttribute="baseline" id="prq-pC-1Vf"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="86l-GG-SpO" secondAttribute="trailing" constant="20" id="qRH-fx-yda"/>
<constraint firstItem="5rh-cM-iOg" firstAttribute="leading" secondItem="73q-gi-fe2" secondAttribute="trailing" constant="8" id="r5f-g8-Pns"/>
<constraint firstItem="eTL-yP-QQ5" firstAttribute="top" secondItem="9GN-f6-r2j" secondAttribute="bottom" constant="8" id="rfs-O9-wMC"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="08Q-2k-0Gb" secondAttribute="trailing" constant="54" id="rwm-CD-0kE"/>
<constraint firstItem="MGZ-hB-jhx" firstAttribute="baseline" secondItem="Uoo-hZ-D1f" secondAttribute="baseline" id="tXr-4J-GsO"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="MGZ-hB-jhx" secondAttribute="trailing" constant="20" id="tZB-I8-Qao"/>
<constraint firstItem="5rh-cM-iOg" firstAttribute="width" secondItem="tLh-V3-OfB" secondAttribute="width" id="u3l-hm-QNJ"/>
@@ -522,7 +566,7 @@
<constraint firstItem="zEH-aV-Tl7" firstAttribute="top" secondItem="yI9-2a-q2a" secondAttribute="bottom" constant="6" id="yi7-mU-teZ"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="ccd-Xn-Dj3" secondAttribute="trailing" constant="20" id="zrg-ax-2rw"/>
</constraints>
<point key="canvasLocation" x="34" y="78"/>
<point key="canvasLocation" x="-328" y="-5"/>
</customView>
<arrayController objectClassName="Set" automaticallyPreparesContent="YES" id="vyv-na-Xpo" userLabel="Set Controller">
<declaredKeys>
+10 -1
View File
@@ -24,12 +24,21 @@ NS_ASSUME_NONNULL_BEGIN
/**
* An actions that fetches metadata online.
*/
typedef NS_ENUM(NSUInteger, SBQueueMetadataActionPreferredArtwork) {
SBQueueMetadataActionPreferredArtworkDefault,
SBQueueMetadataActionPreferredArtworkiTunes,
SBQueueMetadataActionPreferredArtworkEpisode,
SBQueueMetadataActionPreferredArtworkSeason,
};
@interface SBQueueMetadataAction : NSObject <SBQueueActionProtocol>
- (instancetype)initWithMovieLanguage:(NSString *)movieLang
tvShowLanguage:(NSString *)tvLang
movieProvider:(NSString *)movieProvider
tvShowProvider:(NSString *)tvShowProvider;
tvShowProvider:(NSString *)tvShowProvider
preferredArtwork:(SBQueueMetadataActionPreferredArtwork)preferredArtwork;
@end
/**
+32 -13
View File
@@ -93,6 +93,7 @@
NSString *_tvShowLanguage;
NSString *_movieProvider;
NSString *_tvShowProvider;
SBQueueMetadataActionPreferredArtwork _preferredArtwork;
}
- (instancetype)init {
@@ -109,7 +110,8 @@
- (instancetype)initWithMovieLanguage:(NSString *)movieLang
tvShowLanguage:(NSString *)tvLang
movieProvider:(NSString *)movieProvider
tvShowProvider:(NSString *)tvShowProvider {
tvShowProvider:(NSString *)tvShowProvider
preferredArtwork:(SBQueueMetadataActionPreferredArtwork)preferredArtwork {
if (!movieLang || !tvLang || !movieProvider || !tvShowProvider) {
return nil;
}
@@ -120,6 +122,7 @@
_tvShowLanguage = [tvLang copy];
_movieProvider = [movieProvider copy];
_tvShowProvider = [tvShowProvider copy];
_preferredArtwork = preferredArtwork;
}
return self;
}
@@ -144,15 +147,18 @@
// Parse FileName and search for metadata
NSDictionary<NSString *, NSString *> *parsed = [SBMetadataHelper parseFilename:url.lastPathComponent];
NSString *type = parsed[@"type"];
NSString *provider = nil;
if ([@"movie" isEqualToString:type]) {
provider = _movieProvider;
currentSearcher = [SBMetadataImporter importerForProvider:_movieProvider];
NSArray<SBMetadataResult *> *results = [currentSearcher searchMovie:parsed[@"title"] language:_movieLanguage];
if (results.count) {
metadata = [currentSearcher loadMovieMetadata:results.firstObject language:_movieLanguage];
}
}
else if ([@"tv" isEqualToString:type]) {
else /*if ([@"tv" isEqualToString:type]) */ {
provider = _tvShowProvider;
currentSearcher = [SBMetadataImporter importerForProvider:_tvShowProvider];
NSArray *results = [currentSearcher searchTVSeries:parsed[@"seriesName"]
language:_tvShowLanguage
@@ -165,19 +171,30 @@
if (metadata.artworkFullsizeURLs.count) {
NSURL *artworkURL = metadata.artworkFullsizeURLs.firstObject;
NSString *preferredArtworkType = nil;
if ([type isEqualToString:@"tv"]) {
if (metadata.artworkFullsizeURLs.count > 1) {
int i = 0;
for (NSString *artworkProviderName in metadata.artworkProviderNames) {
NSArray<NSString *> *a = [artworkProviderName componentsSeparatedByString:@"|"];
if (a.count > 1 && ![a[1] isEqualToString:@"episode"]) {
artworkURL = metadata.artworkFullsizeURLs[i];
break;
}
i++;
}
switch (_preferredArtwork) {
case SBQueueMetadataActionPreferredArtworkiTunes:
preferredArtworkType = @"iTunes";
break;
case SBQueueMetadataActionPreferredArtworkEpisode:
preferredArtworkType = [NSString stringWithFormat:@"%@|%@", provider, @"episode"];
break;
case SBQueueMetadataActionPreferredArtworkSeason:
preferredArtworkType = [NSString stringWithFormat:@"%@|%@", provider, @"season"];
break;
default:
preferredArtworkType = [NSString stringWithFormat:@"%@|%@", provider, @"poster"];
break;
}
NSUInteger index = 0;
for (NSString *name in metadata.artworkProviderNames) {
if ([name hasPrefix:preferredArtworkType]) {
artworkURL = metadata.artworkFullsizeURLs[index];
break;
}
index += 1;
}
MP42Image *artwork = [self loadArtwork:artworkURL];
@@ -237,6 +254,7 @@
_tvShowLanguage = [coder decodeObjectOfClass:[NSString class] forKey:@"_tvShowLanguage"];
_movieProvider = [coder decodeObjectOfClass:[NSString class] forKey:@"_movieProvider"];
_tvShowProvider = [coder decodeObjectOfClass:[NSString class] forKey:@"_tvShowProvider"];
_preferredArtwork = [coder decodeIntForKey:@"_preferredArtwork"];
return self;
}
@@ -246,6 +264,7 @@
[coder encodeObject:_tvShowLanguage forKey:@"_tvShowLanguage"];
[coder encodeObject:_movieProvider forKey:@"_movieProvider"];
[coder encodeObject:_tvShowProvider forKey:@"_tvShowProvider"];
[coder encodeInt:_preferredArtwork forKey:@"_preferredArtwork"];
}
@end
+5 -4
View File
@@ -256,10 +256,11 @@ static void *SBQueueContex = &SBQueueContex;
SBQueueItem *item = [SBQueueItem itemWithURL:url];
if ([(self.options)[SBQueueMetadata] boolValue]) {
[item addAction:[[SBQueueMetadataAction alloc] initWithMovieLanguage:(self.options)[SBQueueMovieProviderLanguage]
tvShowLanguage:(self.options)[SBQueueTVShowProviderLanguage]
movieProvider:(self.options)[SBQueueMovieProvider]
tvShowProvider:(self.options)[SBQueueTVShowProvider]]];
[item addAction:[[SBQueueMetadataAction alloc] initWithMovieLanguage:self.options[SBQueueMovieProviderLanguage]
tvShowLanguage:self.options[SBQueueTVShowProviderLanguage]
movieProvider:self.options[SBQueueMovieProvider]
tvShowProvider:self.options[SBQueueTVShowProvider]
preferredArtwork:[self.options[SBQueueProviderArtwork] unsignedIntegerValue]]];
}
if ([(self.options)[SBQueueSubtitles] boolValue]) {
+1
View File
@@ -29,6 +29,7 @@ extern NSString * const SBQueueMovieProvider;
extern NSString * const SBQueueTVShowProvider;
extern NSString * const SBQueueMovieProviderLanguage;
extern NSString * const SBQueueTVShowProviderLanguage;
extern NSString * const SBQueueProviderArtwork;
extern NSString * const SBQueueDestination;
+8 -5
View File
@@ -31,6 +31,8 @@ NSString * const SBQueueMovieProvider = @"SBQueueMovieProvider";
NSString * const SBQueueTVShowProvider = @"SBQueueTVShowProvider";
NSString * const SBQueueMovieProviderLanguage = @"SBQueueMovieProviderLanguage";
NSString * const SBQueueTVShowProviderLanguage = @"SBQueueTVShowProviderLanguage";
NSString * const SBQueueProviderArtwork = @"SBQueueProviderArtwork";
NSString * const SBQueueSet = @"SBQueueSet";
@implementation SBQueuePreferences
@@ -40,7 +42,7 @@ NSString * const SBQueueSet = @"SBQueueSet";
if (self) {
_options = [[NSMutableDictionary alloc] init];
NSArray *keys = @[SBQueueFileType, SBQueueOrganize, SBQueueFixTrackLanguage, SBQueueFixTrackLanguageValue, SBQueueFixFallbacks, SBQueueClearTrackName, SBQueueMetadata, SBQueueSubtitles, SBQueueAutoStart, SBQueueOptimize, SBQueueShowDoneNotification, SBQueueMovieProvider, SBQueueTVShowProvider, SBQueueMovieProviderLanguage, SBQueueTVShowProviderLanguage];
NSArray *keys = @[SBQueueFileType, SBQueueOrganize, SBQueueFixTrackLanguage, SBQueueFixTrackLanguageValue, SBQueueFixFallbacks, SBQueueClearTrackName, SBQueueMetadata, SBQueueSubtitles, SBQueueAutoStart, SBQueueOptimize, SBQueueShowDoneNotification, SBQueueMovieProvider, SBQueueTVShowProvider, SBQueueMovieProviderLanguage, SBQueueTVShowProviderLanguage, SBQueueProviderArtwork];
[keys enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
self.options[obj] = [[NSUserDefaults standardUserDefaults] valueForKey:obj];
@@ -78,21 +80,22 @@ NSString * const SBQueueSet = @"SBQueueSet";
SBQueueMovieProvider : @"TheMovieDB",
SBQueueTVShowProvider : @"TheTVDB",
SBQueueMovieProviderLanguage : @"English",
SBQueueTVShowProviderLanguage : @"English"}];
SBQueueTVShowProviderLanguage : @"English",
SBQueueProviderArtwork : @0}];
}
/**
* Save the queue user defaults
*/
- (void)saveUserDefaults {
NSArray<NSString *> *keys = @[SBQueueFileType, SBQueueOrganize, SBQueueFixTrackLanguage, SBQueueFixTrackLanguageValue, SBQueueFixFallbacks, SBQueueClearTrackName, SBQueueMetadata, SBQueueSubtitles, SBQueueAutoStart, SBQueueShowDoneNotification, SBQueueOptimize, SBQueueMovieProvider, SBQueueTVShowProvider, SBQueueMovieProviderLanguage, SBQueueTVShowProviderLanguage];
NSArray<NSString *> *keys = @[SBQueueFileType, SBQueueOrganize, SBQueueFixTrackLanguage, SBQueueFixTrackLanguageValue, SBQueueFixFallbacks, SBQueueClearTrackName, SBQueueMetadata, SBQueueSubtitles, SBQueueAutoStart, SBQueueShowDoneNotification, SBQueueOptimize, SBQueueMovieProvider, SBQueueTVShowProvider, SBQueueMovieProviderLanguage, SBQueueTVShowProviderLanguage, SBQueueProviderArtwork];
[keys enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
[[NSUserDefaults standardUserDefaults] setValue:(self.options)[obj] forKey:obj];
}];
[[NSUserDefaults standardUserDefaults] setValue:[(self.options)[SBQueueDestination] path] forKey:SBQueueDestination];
[[NSUserDefaults standardUserDefaults] setValue:[(self.options)[SBQueueSet] presetName] forKey:SBQueueSet];
[[NSUserDefaults standardUserDefaults] setValue:[self.options[SBQueueDestination] path] forKey:SBQueueDestination];
[[NSUserDefaults standardUserDefaults] setValue:[self.options[SBQueueSet] presetName] forKey:SBQueueSet];
}
- (nullable NSURL *)queueURL {