Ticket #171: dvd_size.diff

File dvd_size.diff, 2.4 KB (added by wazza, 4 years ago)
  • SapphireMetaData.m

     
    17121712                        [fileMeta setObject:[dvd audioFormatsString ] forKey:AUDIO_DESC_KEY]; 
    17131713                        [fileMeta setObject:[dvd subtitlesString    ] forKey:SUBTITLES_KEY ]; 
    17141714                        [fileMeta setObject:[dvd mainFeatureDuration] forKey:DURATION_KEY  ]; 
     1715                        [fileMeta setObject:[dvd totalSize          ] forKey:SIZE_KEY      ]; 
    17151716 
    17161717                        [dvd release]; 
    17171718                } // VIDEO_TS 
  • SapphireVideoTSParser.h

     
    2525        const NSString *audio; 
    2626        const NSString *subtitles; 
    2727        long long       duration; 
     28        const NSNumber *size; 
    2829} 
    2930 
    3031/*! 
     
    8081 * @return  Calculated DVD running time 
    8182 */ 
    8283- (const NSNumber * const) mainFeatureDuration; 
     84 
     85/*! 
     86 * @brief Return the size of a ripped DVD 
     87 * 
     88 * @return  Calculated DVD running time 
     89 */ 
     90- (const NSNumber * const) totalSize; 
     91 
    8392@end 
  • SapphireVideoTSParser.m

     
    182182        NSString  *ifoPath     = nil; 
    183183 
    184184        unsigned long long ifoSz = 0; 
     185        unsigned long long total = 0; 
    185186 
    186187        // The largest IFO file (not including VIDEO_TS.IFO) corresponds to the main feature 
    187188        while( filePath = [enumerator nextObject] ) 
    188189        { 
     190                unsigned long long sz = [[[fm fileAttributesAtPath:[videotsPath stringByAppendingPathComponent:filePath] traverseLink:YES] valueForKey:NSFileSize] unsignedLongLongValue]; 
     191                total += sz; 
     192 
    189193                if( [[filePath lowercaseString] hasSuffix:@".ifo"] && [[filePath lastPathComponent] caseInsensitiveCompare:@"video_ts.ifo"] != NSOrderedSame ) 
    190194                { 
    191                         unsigned long long sz = [[[fm fileAttributesAtPath:[videotsPath stringByAppendingPathComponent:filePath] traverseLink:YES] valueForKey:NSFileSize] unsignedLongLongValue]; 
    192  
    193195                        if ( sz > ifoSz ) 
    194196                        { 
    195197                                ifoPath = [videotsPath stringByAppendingPathComponent:filePath]; 
     
    198200                } 
    199201        } 
    200202 
     203        size = [NSNumber numberWithLongLong:total]; 
     204 
    201205        if( ifoPath != nil ) 
    202206                ifo = [NSFileHandle fileHandleForReadingAtPath:ifoPath]; 
    203207 
     
    403407        return [NSNumber numberWithLongLong:duration]; 
    404408} 
    405409 
     410- (const NSNumber * const) totalSize 
     411{ 
     412        return size; 
     413} 
     414 
    406415@end