-
Notifications
You must be signed in to change notification settings - Fork 12
/
SMFBaseAsset.m
103 lines (98 loc) · 2.35 KB
/
SMFBaseAsset.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
//
// SMFBaseAsset.m
// SoftwareMenuFramework
//
// Created by Thomas Cool on 2/4/10.
// Copyright 2010 Thomas Cool. All rights reserved.
//
#import "SMFBaseAsset.h"
#import "SMFMediaPreview.h"
@implementation SMFBaseAsset
+(SMFBaseAsset *)asset
{
return [[[SMFBaseAsset alloc ]init] autorelease];
}
-(id)init
{
self=[super init];
_meta=[[NSMutableDictionary alloc]init];
_image=[[BRThemeInfo sharedTheme]appleTVIcon];
[_image retain];
return self;
}
-(void)setObject:(id)arg1 forKey:(id)arg2
{
[_meta setObject:arg1 forKey:arg2];
}
-(void)setTitle:(NSString *)title
{
[_meta setObject:title forKey:METADATA_TITLE];
}
-(void)setSummary:(NSString *)summary
{
[_meta setObject:summary forKey:METADATA_SUMMARY];
}
-(void)setCustomKeys:(NSArray *)keys forObjects:(NSArray *)objects
{
if([keys count]==[objects count])
{
[_meta setObject:keys forKey:METADATA_CUSTOM_KEYS];
[_meta setObject:objects forKey:METADATA_CUSTOM_OBJECTS];
}
}
-(BRImage *)coverArt
{
return _image;
}
-(void)setCoverArt:(BRImage *)coverArt
{
//[_image release];
_image=[coverArt retain];
}
-(void)setCoverArtPath:(NSString *)path
{
if ([[NSFileManager defaultManager] fileExistsAtPath:path]) {
[_image release];
_image=[[BRImage imageWithPath:path] retain];
}
}
-(NSDictionary *)orderedDictionary
{
NSMutableDictionary *a=[[NSMutableDictionary alloc] init];
if([_meta objectForKey:METADATA_TITLE]!=nil)
[a setObject:[_meta objectForKey:METADATA_TITLE] forKey:METADATA_TITLE];
if([_meta objectForKey:METADATA_SUMMARY]!=nil)
[a setObject:[_meta objectForKey:METADATA_SUMMARY] forKey:METADATA_SUMMARY];
if ([_meta objectForKey:METADATA_CUSTOM_KEYS]!=nil && [_meta objectForKey:METADATA_CUSTOM_OBJECTS]!=nil) {
[a setObject:[_meta objectForKey:METADATA_CUSTOM_KEYS] forKey:METADATA_CUSTOM_KEYS];
[a setObject:[_meta objectForKey:METADATA_CUSTOM_OBJECTS] forKey:METADATA_CUSTOM_OBJECTS];
}
return [a autorelease];
}
- (id)mediaType
{
return [BRMediaType movie];
}
-(id)assetID
{
return @"BaseAsset";
}
-(id)title
{
return [_meta objectForKey:METADATA_TITLE];
}
-(id)summary
{
return [_meta objectForKey:METADATA_SUMMARY];
}
- (BOOL)hasCoverArt
{
return YES;
}
- (void)dealloc
{
[_image release];
[_meta release];
[super dealloc];
}
@end