forked from tomcool420/SMFramework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SMFAssetPreviewController.m
71 lines (55 loc) · 2.65 KB
/
SMFAssetPreviewController.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
//
// SMFAssetPreviewController.m
// SMFramework
//
// Created by Thomas Cool on 2/8/11.
// Copyright 2011 tomcool.org. All rights reserved.
//
#import "SMFAssetPreviewController.h"
static NSString * const kSMFMovieTitle = @"title";
static NSString * const kSMFMovieSubtitle = @"substitle";
static NSString * const kSMFMovieSummary = @"summary";
static NSString * const kSMFMoviePoster = @"poster";
static NSString * const kSMFMovieHeaders = @"headers";
static NSString * const kSMFMovieColumns = @"columns";
static NSString * const kSMFMovieRating = @"rating";
@implementation SMFAssetPreviewController
@synthesize asset;
-(NSMutableDictionary *)getInformation
{
NSMutableDictionary *d = [[NSMutableDictionary alloc]initWithObjectsAndKeys:
@"",kSMFMovieTitle,
@"",kSMFMovieSubtitle,
@"(no summary)",kSMFMovieSummary,
[NSArray array],kSMFMovieHeaders,
[NSArray array],kSMFMovieColumns,
[BRImage imageWithPath:[[NSBundle bundleForClass:[self class]] pathForResource:@"colorAppleTVNameImage" ofType:@"png"]],kSMFMoviePoster,
@"pg",kSMFMovieRating,
nil];
if ([asset isKindOfClass:[BRBaseMediaAsset class]]) {
NSString *t = [self.asset title];
if (t!=nil) {[d setObject:t forKey:kSMFMovieTitle];}
t = [self.asset publisher];
if (t!=nil) {[d setObject:t forKey:kSMFMovieSubtitle];}
t = [self.asset mediaSummary];
if (t!=nil) {[d setObject:t forKey:kSMFMovieSummary];}
if ([asset respondsToSelector:@selector(coverArt)]) {
BRImage *i = [(BRPhotoMediaAsset *)self.asset coverArt];
if (i==nil) [d setObject:i forKey:kSMFMoviePoster];
}
NSArray *a = [NSArray arrayWithObjects:@"Details",@"Actors",@"Director",@"Producers",nil];
[d setObject:a forKey:kSMFMovieHeaders];
NSArray *cast = [self.asset cast];
if (cast==nil) cast=[NSArray array];
NSArray *directors = [self.asset directors];
if (directors==nil) directors=[NSArray array];
NSArray *producers = [self.asset producers];
if (producers==nil) producers=[NSArray array];
a=[NSArray arrayWithObjects:[NSArray array],cast,directors,producers,nil];
[d setObject:a forKey:kSMFMovieColumns];
t = [self.asset rating];
if (t!=nil) {[d setObject:t forKey:kSMFMovieRating];}
}
return [d autorelease];
}
@end