Changeset 218

Show
Ignore:
Timestamp:
09/10/07 22:21:54 (1 year ago)
Author:
pmerrill
Message:

Initial framework for Movie meta data support.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Sapphire.xcodeproj/project.pbxproj

    r203 r218  
    5656                FE423A9F0C333DF40035A717 /* Cone.png in Resources */ = {isa = PBXBuildFile; fileRef = FE423A9E0C333DF40035A717 /* Cone.png */; }; 
    5757                FE423ABE0C3341D70035A717 /* Eye.png in Resources */ = {isa = PBXBuildFile; fileRef = FE423ABD0C3341D70035A717 /* Eye.png */; }; 
     58                FE5AAF9E0C5A96EF00932075 /* SapphireMovieChooser.m in Sources */ = {isa = PBXBuildFile; fileRef = FE5AAF9D0C5A96EF00932075 /* SapphireMovieChooser.m */; }; 
    5859                FE5BD4670C3090CD009F2B2E /* ApplianceIcon.png in Resources */ = {isa = PBXBuildFile; fileRef = FE5BD4660C3090CD009F2B2E /* ApplianceIcon.png */; }; 
    5960                FE88FD100C2F564700C55E3F /* SapphireFileDataImporter.m in Sources */ = {isa = PBXBuildFile; fileRef = FE88FD0F0C2F564700C55E3F /* SapphireFileDataImporter.m */; }; 
    6061                FE8D57D40C2DE4AF00BC1768 /* SapphireSettings.m in Sources */ = {isa = PBXBuildFile; fileRef = FE8D57D30C2DE4AF00BC1768 /* SapphireSettings.m */; }; 
     62                FEB9DE9F0C96095A00E7788A /* SapphireMovieImporter.m in Sources */ = {isa = PBXBuildFile; fileRef = FEB9DE9D0C96095A00E7788A /* SapphireMovieImporter.m */; }; 
    6163/* End PBXBuildFile section */ 
    6264 
     
    132134                FE423A9E0C333DF40035A717 /* Cone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Cone.png; sourceTree = "<group>"; }; 
    133135                FE423ABD0C3341D70035A717 /* Eye.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Eye.png; sourceTree = "<group>"; }; 
     136                FE5AAF9C0C5A96EF00932075 /* SapphireMovieChooser.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SapphireMovieChooser.h; sourceTree = "<group>"; }; 
     137                FE5AAF9D0C5A96EF00932075 /* SapphireMovieChooser.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = SapphireMovieChooser.m; sourceTree = "<group>"; }; 
    134138                FE5BD4660C3090CD009F2B2E /* ApplianceIcon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ApplianceIcon.png; sourceTree = "<group>"; }; 
    135139                FE88FD0E0C2F564700C55E3F /* SapphireFileDataImporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SapphireFileDataImporter.h; sourceTree = "<group>"; }; 
     
    137141                FE8D57D20C2DE4AF00BC1768 /* SapphireSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SapphireSettings.h; sourceTree = "<group>"; }; 
    138142                FE8D57D30C2DE4AF00BC1768 /* SapphireSettings.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SapphireSettings.m; sourceTree = "<group>"; }; 
     143                FEB9DE9D0C96095A00E7788A /* SapphireMovieImporter.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = SapphireMovieImporter.m; sourceTree = "<group>"; }; 
     144                FEB9DE9E0C96095A00E7788A /* SapphireMovieImporter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SapphireMovieImporter.h; sourceTree = "<group>"; }; 
    139145/* End PBXFileReference section */ 
    140146 
     
    241247                        isa = PBXGroup; 
    242248                        children = ( 
     249                                FE5AAF9C0C5A96EF00932075 /* SapphireMovieChooser.h */, 
     250                                FE5AAF9D0C5A96EF00932075 /* SapphireMovieChooser.m */, 
    243251                                F5EA8FCC0C30459400B1EC7D /* SapphireMarkMenu.h */, 
    244252                                F5EA8FCD0C30459400B1EC7D /* SapphireMarkMenu.m */, 
     
    308316                        isa = PBXGroup; 
    309317                        children = ( 
     318                                FEB9DE9D0C96095A00E7788A /* SapphireMovieImporter.m */, 
     319                                FEB9DE9E0C96095A00E7788A /* SapphireMovieImporter.h */, 
    310320                                FE88FD0E0C2F564700C55E3F /* SapphireFileDataImporter.h */, 
    311321                                FE88FD0F0C2F564700C55E3F /* SapphireFileDataImporter.m */, 
     
    420430                                F56B765E0C3837CE00E934AA /* SapphireShowChooser.m in Sources */, 
    421431                                F5E849C70C3F008100913832 /* SapphireMetaDataScanner.m in Sources */, 
     432                                FE5AAF9E0C5A96EF00932075 /* SapphireMovieChooser.m in Sources */, 
    422433                                F565A1FD0C5BE81F00AE7110 /* SapphireAudioPlayer.m in Sources */, 
    423434                                F565A34A0C5BF69D00AE7110 /* SapphireAudioMedia.m in Sources */, 
     
    426437                                F51BFEFF0C8CB85D00709A5E /* SapphireCollectionSettings.m in Sources */, 
    427438                                F5B8DEE90C8F85BB00489829 /* SapphireTVDirectory.m in Sources */, 
     439                                FEB9DE9F0C96095A00E7788A /* SapphireMovieImporter.m in Sources */, 
    428440                        ); 
    429441                        runOnlyForDeploymentPostprocessing = 0; 
  • trunk/SapphireApplianceController.m

    r210 r218  
    1919#import "SapphireFileDataImporter.h" 
    2020#import "SapphireTVShowImporter.h" 
     21#import "SapphireMovieImporter.h" 
    2122#import "SapphireAllImporter.h" 
    2223 
     
    109110} 
    110111 
    111 //  
     112 
    112113- (id) initWithScene: (BRRenderScene *) scene 
    113114{ 
     
    144145{ 
    145146        SapphireImporterDataMenu *allImporter   = [self allImporterForCollection:metaCollection]; 
    146  
    147147        NSMutableArray *mutableMasterNames = [[NSMutableArray alloc] init]; 
    148148        NSMutableArray *mutableMasterControllers = [[NSMutableArray alloc] init]; 
     
    289289        SapphireTheme *theme = [SapphireTheme sharedTheme]; 
    290290        if([name isEqual: ALL_IMPORT_MENU_ITEM]) [result setLeftIcon:[theme gem:GEAR_GEM_KEY]]; 
     291//      else if([name isEqual: AGENT_IMPORT_MENU_ITEM]) [result setLeftIcon:[theme gem:GEAR_GEM_KEY]]; 
    291292        else if([name isEqual: SETTINGS_MENU_ITEM]) [result setLeftIcon:[theme gem:GEAR_GEM_KEY]]; 
    292293        else if([name isEqual: RESET_MENU_ITEM]) [result setLeftIcon:[theme gem:CONE_GEM_KEY]]; 
  • trunk/SapphireMetaData.h

    r212 r218  
    1111 
    1212#define META_TVRAGE_IMPORT_KEY                  @"TVRage Source" 
     13#define META_IMDB_IMPORT_KEY                    @"IMDB Source" 
    1314#define META_XML_IMPORT_KEY                             @"XML Source" 
    1415 
     
    3435 
    3536//IMDB Type Info 
     37#define META_MOVIE_TITLE                                @"Title" 
    3638 
    3739//Special Display Only Info 
     
    178180- (NSString *)episodeTitle; 
    179181- (NSString *)showID; 
    180 - (NSString *)showName; 
     182- (NSString *)showName ; 
     183- (void)setMediaType: (unsigned int) type ; 
     184- (int)mediaType ; 
    181185- (NSString *)sizeString; 
    182186 
  • trunk/SapphireMetaData.m

    r216 r218  
    3737#define AUDIO_FORMAT_KEY                        @"Audio Format" 
    3838#define FILE_CLASS_KEY                          @"File Class" 
     39#define MEDIA_TYPE_KEY                          @"Media Type" 
     40/* Media Types: 
     41*       0=      Unknown Media Type (init) 
     42*       1=      TV Show 
     43*       2=      Movie 
     44*       3=      Audio 
     45*       4=      Image 
     46*       5=      Other   (User Selected) 
     47*/ 
    3948 
    4049@implementation NSString (episodeSorting) 
     
    14451454                [fileMeta setObject:[NSNumber numberWithInt:modTime] forKey:MODIFIED_KEY]; 
    14461455                [fileMeta setObject:[props objectForKey:NSFileSize] forKey:SIZE_KEY]; 
     1456                [fileMeta setObject:[NSNumber numberWithUnsignedInt:0] forKey:MEDIA_TYPE_KEY] ; 
    14471457                [fileMeta setObject:[NSNumber numberWithInt:META_FILE_VERSION] forKey:META_VERSION_KEY]; 
    14481458                 
     
    17851795} 
    17861796 
     1797/*! 
     1798* @brief Sets the media type of the file 
     1799 * 
     1800 * @param mediaType The media type of the file 
     1801 */ 
     1802- (void)setMediaType: (unsigned int) type 
     1803{ 
     1804        [metaData setObject:[NSNumber numberWithUnsignedInt:type] forKey:MEDIA_TYPE_KEY]; 
     1805} 
     1806 
     1807/*! 
     1808* @brief Returns the media type of the file 
     1809 * 
     1810 * @return The media type of the file 
     1811 */ 
     1812- (int)mediaType 
     1813{ 
     1814        [self constructCombinedData] ; 
     1815        return [[combinedInfo objectForKey:MEDIA_TYPE_KEY] intValue] ; 
     1816} 
     1817 
    17871818/*Makes a pretty size string for the file*/ 
    17881819- (NSString *)sizeString 
  • trunk/SapphireSettings.m

    r201 r218  
    1414#import "SapphireFileDataImporter.h" 
    1515#import "SapphireTVShowImporter.h" 
     16#import "SapphireMovieImporter.h" 
    1617#import "SapphireCollectionSettings.h" 
    1718 
     
    7374        names = [[NSArray alloc] initWithObjects:       BRLocalizedString(@"   Populate File Data", @"Populate File Data menu item"), 
    7475                                                                                                BRLocalizedString(@"   Fetch Internet Data", @"Fetch Internet Data menu item"), 
     76                                                                                                BRLocalizedString(@"   Start Movie Import", @"Start Movie Import menu item"), 
    7577                                                                                                BRLocalizedString(@"   Hide Collections", @"Hide Collections menu item"), 
    7678                                                                                                BRLocalizedString(@"   Don't Import Collections", @"Don't Import Collections menu item"), 
     
    8587         
    8688        keys = [[NSArray alloc] initWithObjects:                @"", 
     89                                                                                                        @"", 
    8790                                                                                                        @"", 
    8891                                                                                                        @"", 
     
    99102        gems = [[NSArray alloc] initWithObjects:        [theme gem:EYE_GEM_KEY], 
    100103                                                                                                [theme gem:EYE_GEM_KEY], 
     104                                                                                                [theme gem:CONE_GEM_KEY], 
    101105                                                                                                [theme gem:EYE_GEM_KEY], 
    102106                                                                                                [theme gem:EYE_GEM_KEY], 
     
    129133        /*display*/ 
    130134        [[self list] setDatasource:self]; 
    131         [[self list] addDividerAtIndex:4]; 
     135        [[self list] addDividerAtIndex:5]; 
    132136        /*Save our instance*/ 
    133137        sharedInstance = [self retain]; 
     
    373377        result = [BRAdornedMenuItemLayer adornedMenuItemWithScene: [self scene]] ; 
    374378 
    375         if( row > 3 && [self boolForKey:[keys objectAtIndex:row]]) 
     379        if( row > 4 && [self boolForKey:[keys objectAtIndex:row]]) 
    376380        { 
    377381                [result setLeftIcon:[[BRThemeInfo sharedTheme] selectedSettingImageForScene:[self scene]]]; 
     
    436440                [importer release]; 
    437441        } 
     442        /*Start Importing Movie Data*/ 
    438443        else if(row == 2) 
     444        { 
     445                SapphireMovieImporter *importer = [[SapphireMovieImporter alloc] initWithSavedSetting:[[path stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"tvdata.plist"]]; 
     446                SapphireImporterDataMenu *menu = [[SapphireImporterDataMenu alloc] initWithScene:[self scene] metaDataCollection:metaCollection importer:importer]; 
     447                [[self stack] pushController:menu]; 
     448                [menu release]; 
     449                [importer release]; 
     450        } 
     451        else if(row == 3) 
    439452        { 
    440453                SapphireCollectionSettings *colSettings = [[SapphireCollectionSettings alloc] initWithScene:[self scene] collection:metaCollection]; 
     
    445458                [colSettings release]; 
    446459        } 
    447         else if(row == 3
     460        else if(row == 4
    448461        { 
    449462                SapphireCollectionSettings *colSettings = [[SapphireCollectionSettings alloc] initWithScene:[self scene] collection:metaCollection]; 
  • trunk/SapphireShowChooser.h

    r201 r218  
    1414        NSString                *searchStr; 
    1515        int                             selection; 
     16        BRTextControl   *fileName; 
    1617} 
    1718 
    1819- (void)setShows:(NSArray *)showList; 
     20- (void)setFileName:(NSString *)choosingForFileName; 
    1921- (NSArray *)shows; 
    2022- (void)setSearchStr:(NSString *)search; 
  • trunk/SapphireShowChooser.m

    r201 r218  
    2626        selection = -1; 
    2727         
     28        /* Set a control to display the fileName */ 
     29        fileName = [[BRTextControl alloc] initWithScene: scene]; 
     30        [fileName setTextAttributes:[[BRThemeInfo sharedTheme] paragraphTextAttributes]]; 
     31        [fileName setText:@"File:"]; 
     32        NSRect  frame = [[self masterLayer] frame]; 
     33//      frame.size.height = frame.size.height / 16.0f; 
     34//      frame.size.width = frame.size.width * 2.0f / 3.0f; 
     35        frame.origin.y = frame.size.height / 4.0f; 
     36        frame.origin.x = frame.size.width * (2.0f / 9.0f); 
     37        [fileName setFrame: frame]; 
     38         
     39         
     40        [self addControl: fileName];     
    2841        [[self list] setDatasource:self]; 
    2942         
     
    7285 
    7386/*! 
     87* @brief Sets the filename to display 
     88 * 
     89 * @param choosingForFileName The filename being choosen for 
     90 */ 
     91- (void)setFileName:(NSString*)choosingForFileName 
     92{ 
     93        [fileName setText:choosingForFileName];  
     94} 
     95 
     96/*! 
    7497 * @brief The string we searched for 
    7598 * 
     
    99122{ 
    100123        BRAdornedMenuItemLayer *result = [BRAdornedMenuItemLayer adornedMenuItemWithScene:[self scene]]; 
     124 
    101125         
    102126        if(row == 0) 
     127        { 
    103128                /*Put in the special "this is not a show"*/ 
    104129                [[result textItem] setTitle:BRLocalizedString(@"<This is not a TV Show>", @"Mark an episode as not a TV show in the show chooser")]; 
     130        } 
    105131        else 
     132        { 
    106133                /*Put in the show*/ 
    107134                [[result textItem] setTitle:[[shows objectAtIndex:row-1] objectForKey:@"name"]]; 
     135        } 
    108136         
    109137        return result; 
  • trunk/SapphireTVShowImporter.m

    r201 r218  
    1212#import "SapphireShowChooser.h" 
    1313 
     14/* TVRage XPATHS  */ 
    1415#define TVRAGE_SHOWNAME_XPATH @".//h3/text()" 
    1516#define TVRAGE_EPLIST_XPATH @"//*[@class='b']" 
     
    1920#define TVRAGE_SEARCH_XPATH @"//*[@class='b1']/a" 
    2021#define TVRAGE_UNKNOWN_XPATH @"//*[contains(text(), 'Unknown Page')]" 
     22  
     23/* IMDB XPATHS */ 
     24#define IMDB_SEARCH_XPATH @"//td[starts-with(a/@href,'/title')]" 
     25#define IMDB_RESULT_LINK_XPATH @"a/@href" 
     26#define IMDB_RESULT_NAME_XPATH @"normalize-space(string())" 
    2127 
    2228#define TRANSLATIONS_KEY                @"Translations" 
     
    494500                SapphireShowChooser *chooser = [[SapphireShowChooser alloc] initWithScene:[dataMenu scene]]; 
    495501                [chooser setShows:shows]; 
    496                 [chooser setListTitle:[BRLocalizedString(@"Show? ", @"Prompt the user for showname with a file") stringByAppendingString:fileName]]; 
     502                [chooser setFileName:fileName]; 
     503                //[chooser setListTitle:[BRLocalizedString(@"Show? ", @"Prompt the user for showname with a file") stringByAppendingString:fileName]]; 
     504                [chooser setListTitle:BRLocalizedString(@"Select Show Title", @"Prompt the user for showname with a file")]; 
    497505                [chooser setSearchStr:searchStr]; 
    498506                /*And display prompt*/ 
     
    575583- (NSString *)completionText 
    576584{ 
    577         return BRLocalizedString(@"All availble TV Show & Movie data has been imported", @"The TV Show import complete"); 
     585        return BRLocalizedString(@"All availble TV Show data has been imported", @"The TV Show import complete"); 
    578586} 
    579587 
     
    595603- (NSString *)informativeText 
    596604{ 
    597         return BRLocalizedString(@"This tool will attempt to fetch information about your TV Show & Movie files from the Internet (TVRage, IMDB, IMPAwards).  This procedure may take quite some time and could ask you questions.  You may cancel at any time.", @"Description of the tv show import"); 
     605        return BRLocalizedString(@"This tool will attempt to fetch information about your Movie files from the Internet (IMDB/IMPAwards).  This procedure may take quite some time and could ask you questions.  You may cancel at any time.", @"Description of the movie import"); 
    598606} 
    599607