This repository has been archived by the owner on Jan 3, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
/
GetiPlayerArguments.m
83 lines (74 loc) · 2.25 KB
/
GetiPlayerArguments.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//
// GetiPlayerArgumentsController.m
// Get_iPlayer GUI
//
// Created by Thomas Willson on 8/3/14.
//
//
#import "GetiPlayerArguments.h"
#import "NSFileManager+DirectoryLocations.h"
static GetiPlayerArguments *sharedController = nil;
@implementation GetiPlayerArguments
- (id)init
{
self = [super init];
if (self) {
runCacheUpdateSinceChange = NO;
currentTypeArgument = nil;
if (!sharedController) {
sharedController = self;
}
}
return self;
}
+ (GetiPlayerArguments *)sharedController {
if (!sharedController) {
sharedController = [[self alloc] init];
}
return sharedController;
}
- (NSString *)typeArgumentForCacheUpdate:(BOOL)forCacheUpdate andIncludeITV:(BOOL)includeITV
{
if (forCacheUpdate) {
runCacheUpdateSinceChange = YES;
}
if (runCacheUpdateSinceChange || !currentTypeArgument)
{
NSMutableString *typeArgument = [[NSMutableString alloc] initWithString:@"--type="];
if ([[[NSUserDefaults standardUserDefaults] valueForKey:@"CacheBBC_TV"] isEqualTo:@YES])
[typeArgument appendString:@"tv,"];
if ( [[[NSUserDefaults standardUserDefaults] valueForKey:@"CacheITV_TV"] isEqualTo:@YES] && includeITV )
[typeArgument appendString:@"itv,"];
if ([[[NSUserDefaults standardUserDefaults] valueForKey:@"CacheBBC_Radio"] isEqualTo:@YES])
[typeArgument appendString:@"radio,"];
[typeArgument deleteCharactersInRange:NSMakeRange([typeArgument length]-1,1)];
currentTypeArgument = [typeArgument copy];
return [NSString stringWithString:typeArgument];
}
else {
return currentTypeArgument;
}
}
- (IBAction)typeChanged:(id)sender
{
runCacheUpdateSinceChange=YES;
}
- (NSString *)cacheExpiryArgument:(id)sender
{
//NSString *cacheExpiryArg = [[NSString alloc] initWithFormat:@"-e%d", ([[[NSUserDefaults standardUserDefaults] objectForKey:@"CacheExpiryTime"] intValue]*3600)];
//return cacheExpiryArg;
return @"-e60480000000000000";
}
- (NSString *)profileDirArg
{
return [NSString stringWithFormat:@"--profile-dir=%@", [NSFileManager defaultManager].applicationSupportDirectory];
}
- (NSString *)noWarningArg
{
return @"--nocopyright";
}
- (NSString *)standardListFormat
{
return @"--listformat=<pid>: <type>, ~<name> - <episode>~, <channel>, <web>";
}
@end