summaryrefslogtreecommitdiffstats
path: root/macosx/HBPreviewController.m
diff options
context:
space:
mode:
authordynaflash <[email protected]>2010-08-06 04:28:33 +0000
committerdynaflash <[email protected]>2010-08-06 04:28:33 +0000
commitba8dab758b4d8edbe76332d3bc8b33424c86c4b0 (patch)
treea8a01cc0b4c4cc34c59338ff8919991ad72525e4 /macosx/HBPreviewController.m
parentcf982f896f80ed72e3c046dee0af49d1a1f4c9e6 (diff)
MacGui: Store live previews in a sub directory in "~/Library/Application Support/HandBrake/Previews" named by pidnum.
- Allows multi-instances to encode live previews without overwriting the live preview for any other instance (since previously we assumed single instance so there was just one live preview file for each container. - Clean up of the previews directory when a single instance is laucnhed to make sure we do not build up a pile of old previews. - Removed old code for live previews which handled the deprecated avi and ogm containers. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3472 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/HBPreviewController.m')
-rw-r--r--macosx/HBPreviewController.m25
1 files changed, 15 insertions, 10 deletions
diff --git a/macosx/HBPreviewController.m b/macosx/HBPreviewController.m
index 7fa8a8449..c0db129ae 100644
--- a/macosx/HBPreviewController.m
+++ b/macosx/HBPreviewController.m
@@ -832,28 +832,33 @@
[fHBController prepareJobForPreview];
+ /* Make sure we have a Preview sub directory with our pidnum attached */
+ NSString *PreviewDirectory = [NSString stringWithFormat:@"~/Library/Application Support/HandBrake/Previews/%d", [fHBController getPidnum]];
+ PreviewDirectory = [PreviewDirectory stringByExpandingTildeInPath];
+ if( ![[NSFileManager defaultManager] fileExistsAtPath:PreviewDirectory] )
+ {
+ [[NSFileManager defaultManager] createDirectoryAtPath:PreviewDirectory
+ withIntermediateDirectories:NO
+ attributes:nil
+ error:nil];
+ }
/* Destination file. We set this to our preview directory
* changing the extension appropriately.*/
if (fTitle->job->mux == HB_MUX_MP4) // MP4 file
{
/* we use .m4v for our mp4 files so that ac3 and chapters in mp4 will play properly */
- fPreviewMoviePath = @"~/Library/Application Support/HandBrake/Previews/preview_temp.m4v";
+ fPreviewMoviePath = [PreviewDirectory stringByAppendingString:@"/preview_temp.m4v"];
}
else if (fTitle->job->mux == HB_MUX_MKV) // MKV file
{
- fPreviewMoviePath = @"~/Library/Application Support/HandBrake/Previews/preview_temp.mkv";
- }
- else if (fTitle->job->mux == HB_MUX_AVI) // AVI file
- {
- fPreviewMoviePath = @"~/Library/Application Support/HandBrake/Previews/preview_temp.avi";
- }
- else if (fTitle->job->mux == HB_MUX_OGM) // OGM file
- {
- fPreviewMoviePath = @"~/Library/Application Support/HandBrake/Previews/preview_temp.ogm";
+ fPreviewMoviePath = [PreviewDirectory stringByAppendingString:@"/preview_temp.mkv"];
}
fPreviewMoviePath = [[fPreviewMoviePath stringByExpandingTildeInPath]retain];
+ [fHBController writeToActivityLog: "Movie Preview path attempt: %s",[fPreviewMoviePath UTF8String] ];
+
+
/* See if there is an existing preview file, if so, delete it */
if( ![[NSFileManager defaultManager] fileExistsAtPath:fPreviewMoviePath] )
{