Skip to content

Commit

Permalink
fixes to pre-play screen. new init in detailedmetadata controller
Browse files Browse the repository at this point in the history
  • Loading branch information
ccjensen committed May 7, 2011
1 parent 00b7af5 commit 5426d71
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 19 deletions.
4 changes: 3 additions & 1 deletion PlexATV/Classes/HWDetailedMovieMetadataController.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@
}
@property (retain) NSArray *assets;
@property (retain) PlexPreviewAsset *selectedMediaItemPreviewData;
@property (retain) PlexMediaObject *selectedMediaObject;

- (id)initWithPlexMediaObject:(PlexMediaObject *)aMediaObject;
- (id)initWithPreviewAssets:(NSArray*)previewAssets withSelectedIndex:(int)selIndex;
- (id) initWithPlexContainer:(PlexMediaContainer*)aContainer withSelectedIndex:(int)selIndex;
- (id)initWithPlexContainer:(PlexMediaContainer*)aContainer withSelectedIndex:(int)selIndex;
+ (NSArray *)assetsForMediaObjects:(NSArray *)mediaObjects;
- (void)changeMetadataViewToShowDataForIndex:(int)index;

Expand Down
40 changes: 30 additions & 10 deletions PlexATV/Classes/HWDetailedMovieMetadataController.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#import "PlexAudioSubsController.h"
#import <plex-oss/PlexRequest.h>
#import <plex-oss/PlexMediaObject + VideoDetails.h>
#import "PlexMediaObject+Assets.h"

//these are in the AppleTV.framework, but cannot #import <AppleTV/AppleTV.h> due to
//naming conflicts with Backrow.framework. below is a hack!
Expand All @@ -51,6 +52,7 @@ - (id)storeRentalPlaceholderImage;
@implementation HWDetailedMovieMetadataController
@synthesize assets;
@synthesize selectedMediaItemPreviewData;
@synthesize selectedMediaObject;

+ (NSArray *)assetsForMediaObjects:(NSArray *)mObjects {
NSMutableArray *newAssets = [NSMutableArray arrayWithCapacity:[mObjects count]];
Expand All @@ -70,8 +72,34 @@ + (NSArray *)assetsForMediaObjects:(NSArray *)mObjects {

#pragma mark -
#pragma mark Object/Class Lifecycle
- (id)init {
self = [super init];
if (self) {
self.datasource = self;
self.delegate = self;

//create the popup
listDropShadowControl = [[SMFListDropShadowControl alloc] init];
[listDropShadowControl setCDelegate:self];
[listDropShadowControl setCDatasource:self];
}
return self;
}

- (id)initWithPlexMediaObject:(PlexMediaObject *)aMediaObject {
self = [self init];
if (self) {
self.selectedMediaObject = aMediaObject;
DLog(@"init with media object:%@", self.selectedMediaObject);

self.selectedMediaItemPreviewData = self.selectedMediaObject.previewAsset;
}
return self;
}

- (id)initWithPreviewAssets:(NSArray*)previewAssets withSelectedIndex:(int)selIndex {
if ((self = [super init])) {
self = [self init];
if (self) {
self.assets = previewAssets;
#if LOCAL_DEBUG_ENABLED
DLog(@"init with asset count:%d and index:%d", [self.assets count], selIndex);
Expand All @@ -83,17 +111,9 @@ - (id)initWithPreviewAssets:(NSArray*)previewAssets withSelectedIndex:(int)selIn
currentSelectedIndex = 0;
self.selectedMediaItemPreviewData = [self.assets objectAtIndex:currentSelectedIndex];
} else {
//fail, container has no items
//fail, container has no items
}

self.datasource = self;
self.delegate = self;

//create the popup
listDropShadowControl = [[SMFListDropShadowControl alloc] init];
[listDropShadowControl setCDelegate:self];
[listDropShadowControl setCDatasource:self];

}
return self;
}
Expand Down
13 changes: 5 additions & 8 deletions PlexATV/Classes/PlexNavigationController.m
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,11 @@ - (BRController *)newControllerForObject:(PlexMediaObject *)aMediaObject {
BRController *controller = nil;

//play theme music if we're entering a tv show
[self startPlayingThemeMusicIfAppropiate];
// ========== movie, initiate movie pre-play view ============
if (aMediaObject.hasMedia || [@"Video" isEqualToString:aMediaObject.containerType])
{
PlexPreviewAsset* pma = aMediaObject.previewAsset;
NSArray *test = [NSArray arrayWithObject:pma];
[self navigateToDetailedMetadataController:test withSelectedIndex:0];
}
[[PlexThemeMusicPlayer sharedPlexThemeMusicPlayer] startPlayingThemeMusicIfAppropiateForMediaObject:aMediaObject];
// ========== movie, initiate movie pre-play view ============
if (aMediaObject.hasMedia || [@"Video" isEqualToString:aMediaObject.containerType]) {
return [[HWDetailedMovieMetadataController alloc] initWithPlexMediaObject:aMediaObject];
}
// ============ sound plugin or other type of sound, initiate playback ============
else if ([@"Track" isEqualToString:aMediaObject.containerType]){
return [[PlexPlaybackController alloc] initWithPlexMediaObject:aMediaObject];
Expand Down

0 comments on commit 5426d71

Please # to comment.