All pastes #826121 Raw Edit

Stuff

public text v1 · immutable
#826121 ·published 2007-12-21 00:35 UTC
rendered paste body
Index: macosx/Controller.mm 
=================================================================== 
--- macosx/Controller.mm   (revision 1136) 
+++ macosx/Controller.mm   (working copy) 
@@ -1120,15 +1120,56 @@ 
             /* we set the source display name in the title selection dialogue */ 
             [fSrcDsplyNameTitleScan setStringValue: [NSString stringWithFormat:@"%@", displayTitlescanSourceName]]; 
             /* We show the actual sheet where the user specifies the title to be scanned 
-                * as we are going to do a title specific scan 
-                */ 
+             * as we are going to do a title specific scan 
+             */ 
             [self showSourceTitleScanPanel:NULL]; 
         } 
         else 
         { 
             /* We are just doing a standard full source scan, so we specify "0" to libhb */ 
             NSString *path = [[sheet filenames] objectAtIndex: 0]; 
-            [self performScan:path scanTitleNum:0];    
+            
+            /* We check to see if the chosen file at path is a package */ 
+            if ([[NSWorkspace sharedWorkspace] isFilePackageAtPath:path]) 
+            { 
+                fprintf( stdout, "MacGui: Trying to open a package\n"); 
+                /* We check to see if this is an .eyetv package */ 
+                if ([[path pathExtension] isEqualToString: @"eyetv"]) 
+                { 
+                    fprintf( stdout, "MacGui: Trying to open eyetv package\n"); 
+                    /* We're looking at an EyeTV package - try to open its enclosed 
+                     .mpg media file */ 
+                    NSString *mpgname; 
+                    int n = [[path stringByAppendingString: @"/"] 
+                             completePathIntoString: &mpgname caseSensitive: NO 
+                             matchesIntoArray: nil 
+                             filterTypes: [NSArray arrayWithObject: @"mpg"]]; 
+                    if (n > 0) 
+                    { 
+                        /* Found an mpeg inside the eyetv package, make it our scan path 
+                        and call performScan on the enclosed mpeg */ 
+                        path = mpgname; 
+                        fprintf( stdout, "MacGui: found mpeg in eyetv package\n"); 
+                        [self performScan:path scanTitleNum:0]; 
+                    } 
+                    else 
+                    { 
+                        /* We did not find an mpeg file in our package, so we do not call performScan */ 
+                        fprintf( stdout, "MacGui: no valid mpeg in eyetv package\n"); 
+                    } 
+                } 
+                else 
+                { 
+                    /* The package is not an eyetv package, so we do not call performScan */ 
+                    fprintf( stdout, "MacGui: Unable to open package\n"); 
+                } 
+            } 
+            else 
+            { 
+                /* path is not a package, so we call perform scan directly on our file */ 
+                [self performScan:path scanTitleNum:0]; 
+            } 
+            
         } 
          
     } 
@@ -1249,6 +1290,12 @@ 
                 we have to use the title->dvd value so we get the proper name of the volume if a physical dvd is the source*/ 
                 sourceDisplayName = [NSString stringWithFormat:[[[NSString stringWithUTF8String: title->dvd] stringByDeletingLastPathComponent] lastPathComponent]]; 
             } 
+            else if ([[NSString stringWithUTF8String: title->dvd] rangeOfString: @".eyetv/"].length != 0) 
+            { 
+                /* Use the name of the EyeTV package instead of the media file */ 
+                sourceDisplayName = [NSString stringWithFormat: @"%@", 
+                                     [[[[NSString stringWithUTF8String: title->dvd] stringByDeletingLastPathComponent] lastPathComponent] stringByDeletingPathExtension]]; 
+            } 
             else 
             { 
                 /* if not the VIDEO_TS Folder, we can assume the chosen folder is the source name */