forked from tomcool420/SMFramework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SMFMovieAsset.m
101 lines (97 loc) · 2.05 KB
/
SMFMovieAsset.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
//
// SMMovieAsset.m
// SoftwareMenu
//
// Created by Thomas Cool on 4/16/10.
// Copyright 2010 Thomas Cool. All rights reserved.
//
#import "SMFMovieAsset.h"
@implementation SMFMovieAsset
- (id)initWithMediaURL:(NSURL *)url
{
//This is here to fix 2.2
self = [super initWithMediaProvider:nil];
NSString *urlString = [url absoluteString];
NSString *filename = [url path];
[self setObject:[filename lastPathComponent] forKey:@"id"];
[self setObject:[BRMediaType movie] forKey:@"mediaType"];
[self setObject:urlString forKey:@"mediaURL"];
[self setObject:@"." forKey:@"mediaSummary"];
[self setObject:[filename lastPathComponent] forKey:@"title"];
_image=[[BRThemeInfo sharedTheme]appleTVIcon];
NSLog(@"url: %@",[self mediaURL]);
[_image retain];
return self;
}
-(BRImage *)coverArt
{
return _image;
}
-(id)mediaType
{
return [BRMediaType movie];
}
- (BOOL)hasCoverArt
{
return YES;
}
- (void)dealloc
{
[_image release];
[super dealloc];
}
- (void)setResumeTime:(unsigned int)time
{
resumeTime = time;
}
-(unsigned int)resumeTime
{
return resumeTime;
}
-(void)setCoverArtPath:(NSString *)path
{
if ([[NSFileManager defaultManager] fileExistsAtPath:path]) {
[_image release];
_image=[[BRImage imageWithPath:path] retain];
}
}
-(void)setMediaSummary:(NSString *)summary
{
if (summary!=nil) {
[self setObject:summary forKey:@"mediaSummary"];
}
}
-(void)setTitle:(NSString *)title
{
if (title!=nil) {
[self setObject:title forKey:@"title"];
}
}
/* Overrides the bookmark time */
- (unsigned int)bookmarkTimeInSeconds
{
/*Check for resume time and if none, return bookmark time*/
if(resumeTime == 0)
return [super bookmarkTimeInSeconds];
/*return resume time*/
return resumeTime;
}
//-(id)mediaURL
//{
// return @"/private/var/root/The A-Team (2010).m4v";
//}
-(id)mediaSummary
{
return @"Hello";
//return [_info objectForKey:@"mediaSummary"];
}
//-(id)mediaDescription
//{
// return @"Hello";
//}
-(id)title
{
return @"Title";
//return [_info objectForKey:@"title"];
}
@end