Changeset 1170

Show
Ignore:
Timestamp:
02/24/2010 06:40:01 PM (2 years ago)
Author:
gbooker
Message:

Corrected some issues with video_ts importing

Location:
branches/PlayerFramework/SapphireFrappliance
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/PlayerFramework/SapphireFrappliance/MetaData/SapphireMObjects/SapphireFileMetaData.m

    r1165 r1170  
    324324{ 
    325325        /*Check modified date*/ 
    326         NSDictionary *props = [[NSFileManager defaultManager] fileAttributesAtPath:self.path traverseLink:YES]; 
     326        NSString *path = nil; 
     327        NSFileManager *fm = [NSFileManager defaultManager]; 
     328        if([self fileContainerTypeValue] == FILE_CONTAINER_TYPE_VIDEO_TS) 
     329        { 
     330                NSString *vtsPath = [self.path stringByAppendingPathComponent:@"VIDEO_TS"]; 
     331                NSEnumerator *fileEnum = [[fm directoryContentsAtPath:vtsPath] objectEnumerator]; 
     332                NSString *file; 
     333                while((file = [fileEnum nextObject]) != nil) 
     334                { 
     335                        NSString *lowerFile = [file lowercaseString]; 
     336                        if([lowerFile hasSuffix:@".ifo"] && ![[lowerFile lastPathComponent] isEqualToString:@"video_ts.ifo"]) 
     337                        { 
     338                                path = [vtsPath stringByAppendingPathComponent:file]; 
     339                                break; 
     340                        } 
     341                } 
     342        } 
     343        else 
     344                path = self.path; 
     345        NSDictionary *props = [fm fileAttributesAtPath:path traverseLink:YES]; 
    327346        int modTime = [[props objectForKey:NSFileModificationDate] timeIntervalSince1970]; 
    328347         
     
    511530                { 
    512531                        SapphireVideoTsParser *dvd = [[SapphireVideoTsParser alloc] initWithPath:path]; 
    513                          
    514                         [fileMeta setObject:[dvd videoFormatsString ] forKey:META_FILE_VIDEO_DESC_KEY]; 
    515                         [fileMeta setObject:[dvd audioFormatsString ] forKey:META_FILE_AUDIO_DESC_KEY]; 
    516                         [fileMeta setObject:[dvd subtitlesString    ] forKey:META_FILE_SUBTITLES_KEY ]; 
    517                         [fileMeta setObject:[dvd mainFeatureDuration] forKey:META_FILE_DURATION_KEY  ]; 
    518                         [fileMeta setObject:[dvd totalSize          ] forKey:META_FILE_SIZE_KEY      ]; 
     532                        id description = [dvd videoFormatsString]; 
     533                        if(description) 
     534                                [fileMeta setObject:description forKey:META_FILE_VIDEO_DESC_KEY]; 
     535                        description = [dvd audioFormatsString]; 
     536                        if(description) 
     537                                [fileMeta setObject:description forKey:META_FILE_AUDIO_DESC_KEY]; 
     538                        description = [dvd mainFeatureDuration]; 
     539                        if(description) 
     540                                [fileMeta setObject:description forKey:META_FILE_DURATION_KEY]; 
     541                        description = [dvd totalSize]; 
     542                        if(description) 
     543                                [fileMeta setObject:description forKey:META_FILE_SIZE_KEY]; 
     544                        description = [dvd subtitlesString]; 
     545                        if(description) 
     546                                [fileMeta setObject:description forKey:META_FILE_SUBTITLES_KEY ]; 
    519547                         
    520548                        [dvd release]; 
  • branches/PlayerFramework/SapphireFrappliance/MetaDataImporting/SapphireVideoTSParser.m

    r913 r1170  
    2424// Instead of declaring them in the header, we declare them here in a category that extends the class. 
    2525 
    26 @interface SapphireVideoTsParser (InternalMethods) 
     26@interface SapphireVideoTsParser () 
    2727 
    2828/*! 
     
    7676#define vts_VideoIsWidescreen(attrs)                 ( attrs[0] & 0x0c) 
    7777 
    78 #define vts_AudioIsDTS(attrs)                        ((attrs[0] & 0xe0) == 0x0c) 
     78#define vts_AudioIsDTS(attrs)                        ((attrs[0] & 0xe0) == 0xc0) 
    7979#define vts_AudioIsSurround(attrs)                   ( attrs[0] & 0x02) 
    8080#define vts_AudioIsCommentary(attrs)                 ( attrs[5] >    1) 
     
    100100static NSString *languageFromEncodedChars( const char firstChar, const char secondChar ) 
    101101{ 
    102         static NSLocale *currentLocale = nil; 
     102        NSLocale *currentLocale = [NSLocale currentLocale]; 
    103103        const char       langCode[]    = { firstChar, secondChar, 0 }; 
    104104         
    105         if( currentLocale == nil ) 
    106                 currentLocale = [NSLocale currentLocale]; 
    107  
    108105        return [currentLocale displayNameForKey:NSLocaleLanguageCode 
    109106                                                                          value:[NSString stringWithCString:langCode encoding:NSASCIIStringEncoding]]; 
     
    319316                audio = commaSeparatedStringFromCollection( audioList ); 
    320317        } 
    321  
    322         if( audio == nil ) 
    323                 audio = BRLocalizedString( @"Not specified", @"No Audio information available for a DVD" );; 
    324318} 
    325319 
     
    355349                subtitles = commaSeparatedStringFromCollection( subtitleList ); 
    356350        } 
    357  
    358         if( subtitles == nil ) 
    359                 subtitles = BRLocalizedString( @"None", @"No Subtitle information available for a DVD" ); 
    360351} 
    361352