-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathNSDictionary-DBVidiJobAdditions.m
130 lines (106 loc) · 3.09 KB
/
NSDictionary-DBVidiJobAdditions.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
//
// NSDictionary-DBVidiJobAdditions.m
// Vidi
//
// Created by Mitz Pettel on Tue Feb 25 2003.
// Copyright (c) 2003, 2007 Mitz Pettel. All rights reserved.
//
#import "NSDictionary-DBVidiJobAdditions.h"
#import "DBTVChannel.h"
@implementation NSDictionary (DBVidiJobAdditions)
+ (id)vidiJobWithStartDate:(NSCalendarDate *)start endDate:(NSCalendarDate *)end channel:(DBTVChannel *)channel file:(NSString *)path comments:(NSString *)comments permanent:(BOOL)flag
{
return [self dictionaryWithObjectsAndKeys:
start, DBVidiJobSchedStartDateKey,
end, DBVidiJobSchedEndDateKey,
[channel dictionary], DBVidiJobChannelKey,
path, DBVidiJobSchedFileKey,
comments, DBVidiJobCommentsKey,
DBVidiJobStatusUnscheduled, DBVidiJobStatusKey,
[NSNumber numberWithBool:flag], DBVidiJobIsPermanentKey,
nil
];
}
- (DBTVChannel *)channel
{
return [DBTVChannel channelWithDictionary:[self objectForKey:DBVidiJobChannelKey]];
}
- (NSCalendarDate *)scheduledStartDate
{
id result = [self objectForKey:DBVidiJobSchedStartDateKey];
if (result != nil && ![result isKindOfClass:[NSCalendarDate class]])
result = [[[NSCalendarDate alloc] initWithTimeInterval:0 sinceDate:result] autorelease];
return result;
}
- (NSCalendarDate *)scheduledEndDate
{
id result = [self objectForKey:DBVidiJobSchedEndDateKey];
if (result != nil && ![result isKindOfClass:[NSCalendarDate class]])
result = [[[NSCalendarDate alloc] initWithTimeInterval:0 sinceDate:result] autorelease];
return result;
}
- (NSString *)scheduledFile
{
return [self objectForKey:DBVidiJobSchedFileKey];
}
- (NSDate *)actualStartDate
{
return [self objectForKey:DBVidiJobActualStartDateKey];
}
- (NSDate *)actualEndDate
{
return [self objectForKey:DBVidiJobActualEndDateKey];
}
- (NSString *)actualFile
{
return [self objectForKey:DBVidiJobActualFileKey];
}
- (NSString *)status
{
return [self objectForKey:DBVidiJobStatusKey];
}
- (BOOL)isPermanent
{
return [[self objectForKey:DBVidiJobIsPermanentKey] boolValue];
}
- (unsigned long)chunkSize
{
return [[self objectForKey:DBVidiJobChunkSizeKey] unsignedLongValue];
}
- (int)recurrence
{
return [[self objectForKey:DBVidiJobRecurrenceKey] intValue];
}
- (BOOL)overwrite
{
return [[self objectForKey:DBVidiJobOverwriteKey] boolValue];
}
- (BOOL)isAudio
{
return [[self objectForKey:DBVidiJobIsAudioKey] boolValue];
}
- (UnsignedFixed)audioSampleRate
{
return [[self objectForKey:DBVidiJobAudioSampleRateKey] unsignedLongValue];
}
- (int)audioSampleSize
{
return [[self objectForKey:DBVidiJobAudioSampleSizeKey] intValue];
}
- (int)audioChannels
{
return [[self objectForKey:DBVidiJobAudioChannelsKey] intValue];
}
- (OSType)audioCompression
{
return [[self objectForKey:DBVidiJobAudioCompressionKey] unsignedLongValue];
}
- (NSData *)audioCompressionParameters
{
return [self objectForKey:DBVidiJobAudioCompressionParamsKey];
}
- (NSComparisonResult)compareToVidiJob:(NSDictionary *)otherJob
{
return [[self scheduledStartDate] compare:[otherJob scheduledStartDate]];
}
@end