Commit 9a0614e6 authored by Benjamin Adolphi's avatar Benjamin Adolphi Committed by Felix Paul Kühne

tvOS: Make artwork retrieval a setting

This commit adds a new setting that lets the user decide if artwork retrieval is desired or not.
Signed-off-by: Felix Paul Kühne's avatarFelix Paul Kühne <fkuehne@videolan.org>
parent 93df846a
......@@ -52,7 +52,8 @@
kVLCSettingPlaybackBackwardSkipLength : kVLCSettingPlaybackBackwardSkipLengthDefaultValue,
kVLCSettingFTPTextEncoding : kVLCSettingFTPTextEncodingDefaultValue,
kVLCSettingWiFiSharingIPv6 : kVLCSettingWiFiSharingIPv6DefaultValue,
kVLCAutomaticallyPlayNextItem : @(YES)};
kVLCAutomaticallyPlayNextItem : @(YES),
kVLCSettingDownloadArtwork : @(YES)};
[defaults registerDefaults:appDefaults];
}
......
......@@ -428,6 +428,22 @@
<key>DefaultValue</key>
<integer>5</integer>
</dict>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>Title</key>
<string>SETTINGS_ARTWORK</string>
</dict>
<dict>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
<key>Title</key>
<string>SETTINGS_DOWNLOAD_ARTWORK</string>
<key>Key</key>
<string>download-artwork</string>
<key>DefaultValue</key>
<true/>
</dict>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
......
......@@ -418,6 +418,22 @@
<key>DefaultValue</key>
<integer>5</integer>
</dict>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>Title</key>
<string>SETTINGS_ARTWORK</string>
</dict>
<dict>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
<key>Title</key>
<string>SETTINGS_DOWNLOAD_ARTWORK</string>
<key>Key</key>
<string>download-artwork</string>
<key>DefaultValue</key>
<true/>
</dict>
</array>
<key>StringsTable</key>
<string>Root</string>
......
B/* A single strings file, whose title is specified in your preferences schema. The strings files provide the localized content to display to the user for each of your preferences. */
......
......@@ -21,4 +21,6 @@ extern NSString *const VLCRemoteBrowsingTVCellIdentifier;
@property (nonatomic, weak) IBOutlet UILabel *titleLabel;
@property (nonatomic, weak) IBOutlet UILabel *subtitleLabel;
@property (nonatomic) bool downloadArtwork;
@end
......@@ -46,6 +46,7 @@ NSString *const VLCRemoteBrowsingTVCellIdentifier = @"VLCRemoteBrowsingTVCell";
[self.thumbnailImageView cancelLoading];
self.title = nil;
self.subtitle = nil;
self.downloadArtwork = false;
}
- (void)setCouldBeAudioOnlyMedia:(BOOL)couldBeAudioOnlyMedia
......@@ -64,7 +65,7 @@ NSString *const VLCRemoteBrowsingTVCellIdentifier = @"VLCRemoteBrowsingTVCell";
[self.thumbnailImageView setImageWithURL:thumbnailURL];
} else {
NSString *searchString = self.title;
if (searchString != nil && !_isDirectory) {
if (searchString != nil && !_isDirectory && _downloadArtwork) {
[_artworkProvider searchForArtworkForVideoRelatedString:searchString];
}
}
......@@ -83,7 +84,7 @@ NSString *const VLCRemoteBrowsingTVCellIdentifier = @"VLCRemoteBrowsingTVCell";
- (void)setTitle:(NSString *)title
{
self.titleLabel.text = title;
if (title != nil && !_isDirectory) {
if (title != nil && !_isDirectory && _downloadArtwork) {
[_artworkProvider searchForArtworkForVideoRelatedString:title];
}
}
......
......@@ -16,6 +16,8 @@
@interface VLCServerBrowsingTVViewController : VLCRemoteBrowsingCollectionViewController <VLCNetworkServerBrowserDelegate>
@property (nonatomic) bool downloadArtwork;
- (instancetype)initWithServerBrowser:(id<VLCNetworkServerBrowser>)serverBrowser;
@end
......@@ -36,6 +36,8 @@
_browsingController = [[VLCServerBrowsingController alloc] initWithViewController:self serverBrowser:serverBrowser];
self.title = serverBrowser.title;
self.downloadArtwork = [[NSUserDefaults standardUserDefaults] boolForKey:kVLCSettingDownloadArtwork];
}
return self;
}
......@@ -133,6 +135,10 @@
if (row < items.count) {
id<VLCNetworkServerBrowserItem> item = items[row];
if([cell isKindOfClass:[VLCRemoteBrowsingTVCell class]]) {
((VLCRemoteBrowsingTVCell *) cell).downloadArtwork = self.downloadArtwork;
}
if ([cell conformsToProtocol:@protocol(VLCRemoteBrowsingCell)]) {
[self.browsingController configureCell:(id<VLCRemoteBrowsingCell>)cell withItem:item];
}
......
......@@ -57,6 +57,7 @@
#define kVLCSettingFTPTextEncodingDefaultValue @(5) // ISO Latin 1
#define kVLCSettingSaveHTTPUploadServerStatus @"isHTTPServerOn"
#define kVLCAutomaticallyPlayNextItem @"AutomaticallyPlayNextItem"
#define kVLCSettingDownloadArtwork @"download-artwork"
#define kVLCSettingLastUsedSubtitlesSearchLanguage @"kVLCSettingLastUsedSubtitlesSearchLanguage"
#define kVLCSettingWiFiSharingIPv6 @"wifi-sharing-ipv6"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment