diff options
author | dynaflash <[email protected]> | 2007-12-31 17:24:09 +0000 |
---|---|---|
committer | dynaflash <[email protected]> | 2007-12-31 17:24:09 +0000 |
commit | cb37e52f451a5c2a7c97e937f9d682b637447990 (patch) | |
tree | 6324a2c7ac4eb966d729f4170da13ee33e7b82e8 /macosx | |
parent | a2a317c82d8b98e2fbce23bd4bf1b0ce9bb65c14 (diff) |
Macgui: Enable opening up .eyetv packages directly
- check source to see if the chosen file is a package
- if so, checks for the .eyetv extension
- then finds the program stream in the package and opens it.
- gui does not call hb_scan if source is identified as a package, but is not an .eyetv package to avoid scanning errant packages
- very verbose activity log messages from the gui for packages, would likely comment out for release, mostly to verify in testing.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1156 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/Controller.mm | 71 |
1 files changed, 59 insertions, 12 deletions
diff --git a/macosx/Controller.mm b/macosx/Controller.mm index 565987134..25ed44d8e 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -1081,8 +1081,8 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It returnCode: (int) returnCode contextInfo: (void *) contextInfo { /* we convert the sender content of contextInfo back into a variable called sender - * mostly just for consistency for evaluation later - */ + * mostly just for consistency for evaluation later + */ id sender = (id)contextInfo; /* User selected a file to open */ if( returnCode == NSOKButton ) @@ -1093,17 +1093,17 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It NSString *sourceDirectory = [scanPath stringByDeletingLastPathComponent]; [[NSUserDefaults standardUserDefaults] setObject:sourceDirectory forKey:@"LastSourceDirectory"]; /* we order out sheet, which is the browse window as we need to open - * the title selection sheet right away - */ + * the title selection sheet right away + */ [sheet orderOut: self]; if (sender == fOpenSourceTitleMMenu) { /* We put the chosen source path in the source display text field for the - * source title selection sheet in which the user specifies the specific title to be - * scanned as well as the short source name in fSrcDsplyNameTitleScan just for display - * purposes in the title panel - */ + * source title selection sheet in which the user specifies the specific title to be + * scanned as well as the short source name in fSrcDsplyNameTitleScan just for display + * purposes in the title panel + */ /* Full Path */ [fScanSrcTitlePathField setStringValue: [NSString stringWithFormat:@"%@", scanPath]]; NSString *displayTitlescanSourceName; @@ -1111,7 +1111,7 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It if ([[scanPath lastPathComponent] isEqualToString: @"VIDEO_TS"]) { /* If VIDEO_TS Folder is chosen, choose its parent folder for the source display name - we have to use the title->dvd value so we get the proper name of the volume if a physical dvd is the source*/ + we have to use the title->dvd value so we get the proper name of the volume if a physical dvd is the source*/ displayTitlescanSourceName = [NSString stringWithFormat:[[scanPath stringByDeletingLastPathComponent] lastPathComponent]]; } else @@ -1122,15 +1122,56 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It /* 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]; + } + } } @@ -1251,6 +1292,12 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It 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 */ |