Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions HandBrakeBatch.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@
0EEC804A1369B4EA00D05124 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0EEC80481369B4EA00D05124 /* InfoPlist.strings */; };
0EEC804D1369B4EA00D05124 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0EEC804C1369B4EA00D05124 /* main.m */; };
0EEC80531369B4EA00D05124 /* HandBrakeBatchAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0EEC80521369B4EA00D05124 /* HandBrakeBatchAppDelegate.m */; };
0EEC80561369B4EA00D05124 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0EEC80541369B4EA00D05124 /* MainMenu.xib */; };
0EF72315136CFCE100D223F4 /* gpl-3.0.txt in Resources */ = {isa = PBXBuildFile; fileRef = 0EF72314136CFCE100D223F4 /* gpl-3.0.txt */; };
0EF8EF95136CFEB700884AE8 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 0EF8EF93136CFEB700884AE8 /* Credits.rtf */; };
0EF8EFB1136D981000884AE8 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0EF8EFB0136D981000884AE8 /* Sparkle.framework */; };
0EF8EFB6136D9D2200884AE8 /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 0EF8EFB0136D981000884AE8 /* Sparkle.framework */; };
4117F47616B40BED0091DCAD /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4117F47516B40BED0091DCAD /* MainMenu.xib */; };
4117F47916B411140091DCAD /* HBBAppFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4117F47816B411140091DCAD /* HBBAppFunctions.m */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -106,10 +107,12 @@
0EEC804C1369B4EA00D05124 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
0EEC80511369B4EA00D05124 /* HandBrakeBatchAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HandBrakeBatchAppDelegate.h; sourceTree = "<group>"; };
0EEC80521369B4EA00D05124 /* HandBrakeBatchAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HandBrakeBatchAppDelegate.m; sourceTree = "<group>"; };
0EEC80551369B4EA00D05124 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = "<group>"; };
0EF72314136CFCE100D223F4 /* gpl-3.0.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "gpl-3.0.txt"; sourceTree = "<group>"; };
0EF8EF94136CFEB700884AE8 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = "<group>"; };
0EF8EFB0136D981000884AE8 /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Sparkle.framework; sourceTree = "<group>"; };
4117F47516B40BED0091DCAD /* MainMenu.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainMenu.xib; sourceTree = "<group>"; };
4117F47716B411130091DCAD /* HBBAppFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBBAppFunctions.h; sourceTree = "<group>"; };
4117F47816B411140091DCAD /* HBBAppFunctions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBBAppFunctions.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -158,7 +161,7 @@
0E549260136C49BD0094563F /* xib */ = {
isa = PBXGroup;
children = (
0EEC80541369B4EA00D05124 /* MainMenu.xib */,
4117F47516B40BED0091DCAD /* MainMenu.xib */,
0E18546A136C4222004B5558 /* HBBProgressWindow.xib */,
0E987E2013E4062C00A99716 /* Preferences.xib */,
);
Expand Down Expand Up @@ -227,6 +230,8 @@
0E108B6A136C47F200168057 /* HBBProgressController.m */,
0E933F9B14C47C8000A5BB1D /* HBBVideoScan.h */,
0E933F9C14C47C8000A5BB1D /* HBBVideoScan.m */,
4117F47716B411130091DCAD /* HBBAppFunctions.h */,
4117F47816B411140091DCAD /* HBBAppFunctions.m */,
0E549260136C49BD0094563F /* xib */,
0EEC80461369B4EA00D05124 /* Supporting Files */,
);
Expand Down Expand Up @@ -304,7 +309,6 @@
buildActionMask = 2147483647;
files = (
0EEC804A1369B4EA00D05124 /* InfoPlist.strings in Resources */,
0EEC80561369B4EA00D05124 /* MainMenu.xib in Resources */,
0E18546B136C4222004B5558 /* HBBProgressWindow.xib in Resources */,
0E9B490A136C874000FCDC68 /* Icon.icns in Resources */,
0EF72315136CFCE100D223F4 /* gpl-3.0.txt in Resources */,
Expand All @@ -315,6 +319,7 @@
0E6C285C14C288BC004A0FE5 /* iso639-2.db in Resources */,
0EE562F215BFFD8F0054359B /* HandBrakeCLI in Resources */,
0EC6D60415C002F70016775D /* manicure.rb in Resources */,
4117F47616B40BED0091DCAD /* MainMenu.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -335,6 +340,7 @@
0E933F9D14C47C8000A5BB1D /* HBBVideoScan.m in Sources */,
0E337A4715144FCC006150DD /* RSRTVArrayController.m in Sources */,
0EB54A4C1596CDBC00EE2AB4 /* HBBDropView.m in Sources */,
4117F47916B411140091DCAD /* HBBAppFunctions.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -349,14 +355,6 @@
name = InfoPlist.strings;
sourceTree = "<group>";
};
0EEC80541369B4EA00D05124 /* MainMenu.xib */ = {
isa = PBXVariantGroup;
children = (
0EEC80551369B4EA00D05124 /* en */,
);
name = MainMenu.xib;
sourceTree = "<group>";
};
0EF8EF93136CFEB700884AE8 /* Credits.rtf */ = {
isa = PBXVariantGroup;
children = (
Expand Down Expand Up @@ -419,6 +417,7 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_ARC = NO;
CODE_SIGN_IDENTITY = "iPhone Developer: Matt Maher (XF6YX54VVW)";
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -433,6 +432,7 @@
INFOPLIST_FILE = "HandBrakeBatch/HandBrakeBatch-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.7;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SDKROOT = macosx;
WRAPPER_EXTENSION = app;
};
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "1.0">
<ExceptionBreakpoints>
<ExceptionBreakpoint
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
scope = "0"
stopOnStyle = "0">
</ExceptionBreakpoint>
</ExceptionBreakpoints>
</Bucket>
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0450"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0EEC803A1369B4EA00D05124"
BuildableName = "HandBrakeBatch.app"
BlueprintName = "HandBrakeBatch"
ReferencedContainer = "container:HandBrakeBatch.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0EEC803A1369B4EA00D05124"
BuildableName = "HandBrakeBatch.app"
BlueprintName = "HandBrakeBatch"
ReferencedContainer = "container:HandBrakeBatch.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0EEC803A1369B4EA00D05124"
BuildableName = "HandBrakeBatch.app"
BlueprintName = "HandBrakeBatch"
ReferencedContainer = "container:HandBrakeBatch.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0EEC803A1369B4EA00D05124"
BuildableName = "HandBrakeBatch.app"
BlueprintName = "HandBrakeBatch"
ReferencedContainer = "container:HandBrakeBatch.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>HandBrakeBatch.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>0EEC803A1369B4EA00D05124</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
28 changes: 28 additions & 0 deletions HandBrakeBatch/HBBAppFunctions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// HBBAppFunctions.h
// HandBrakeBatch
//
// Created by Matt Maher on 1/26/13.
//
//

#import <Foundation/Foundation.h>

@interface HBBAppFunctions : NSObject


// SEND TO APP
+ (NSString *) getSendToAppPath;
+ (void) setSendToAppPath:(NSString *)path;
+ (NSString *) getSendToAppName;
+ (NSImage *) getIconForSendToApp;
+ (void) setSendToAppName:(NSString *)name;
+ (BOOL) isSendToAppValid;
+ (void) clearAllSendToAppPreferences;
+ (void) openFileWithSendToApp:(NSString *) filePath;


// MMStringFunctions (partials)
+ (NSString *) fRightBackOf:(NSString *)substring inString:(NSString *)inString;
+ (BOOL) string:(NSString *)inString contains:(NSString *)substring;
@end
99 changes: 99 additions & 0 deletions HandBrakeBatch/HBBAppFunctions.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
//
// HBBAppFunctions.m
// HandBrakeBatch
//
// Created by Matt Maher on 1/26/13.
//
//

#import "HBBAppFunctions.h"

@implementation HBBAppFunctions






// --++-- --++-- --++-- --++-- --++-- --++--
#pragma mark -
#pragma mark SEND TO APP (after conversion)
#pragma mark -
static NSString *PREF_SEND_FILE_TO_APP_PATH = @"HBBSendConvertedFileToAppPath";
static NSString *PREF_SEND_FILE_TO_APP_NAME = @"HBBSendConvertedFileToAppName";
+ (NSString *) getSendToAppPath {
return [[NSUserDefaults standardUserDefaults] objectForKey:PREF_SEND_FILE_TO_APP_PATH];
}
+ (void) setSendToAppPath:(NSString *)path {
NSString *filePath = [path stringByReplacingOccurrencesOfString:@"file://localhost" withString:@""];
filePath = [filePath stringByReplacingPercentEscapesUsingEncoding:NSStringEncodingConversionAllowLossy];
[[NSUserDefaults standardUserDefaults] setObject:filePath forKey:PREF_SEND_FILE_TO_APP_PATH];
}
+ (NSString *) getSendToAppName {
return [[NSUserDefaults standardUserDefaults] valueForKey:PREF_SEND_FILE_TO_APP_NAME];
}
+ (void) setSendToAppName:(NSString *)name {
NSString *appName = [name stringByReplacingOccurrencesOfString: @".app" withString:@""];
[[NSUserDefaults standardUserDefaults] setValue:appName forKey:PREF_SEND_FILE_TO_APP_NAME];
}
+ (NSImage *) getIconForSendToApp {
if ([self isSendToAppValid]) {
return [[NSWorkspace sharedWorkspace] iconForFile:[self getSendToAppPath]];
}

return nil;
}
+ (BOOL) isSendToAppValid {
NSString *appPath = [self getSendToAppPath];

if ( ! appPath) {
return NO;
}

NSURL *theURL = [NSURL fileURLWithPath:appPath isDirectory:NO];
return ([theURL checkResourceIsReachableAndReturnError:nil] == YES);
}
+ (void) clearAllSendToAppPreferences {
[[NSUserDefaults standardUserDefaults] removeObjectForKey:PREF_SEND_FILE_TO_APP_NAME];
[[NSUserDefaults standardUserDefaults] removeObjectForKey:PREF_SEND_FILE_TO_APP_PATH];
[[NSUserDefaults standardUserDefaults] synchronize];
}
+ (void) openFileWithSendToApp:(NSString *) filePath {
if ([self isSendToAppValid]) {
NSURL *fileURL = [NSURL fileURLWithPath: filePath];
NSWorkspace * ws = [NSWorkspace sharedWorkspace];
[ws openFile:[fileURL path] withApplication:[self getSendToAppPath]];
}
}



// --++-- --++-- --++-- --++-- --++-- --++--
#pragma mark -
#pragma mark MMStringFunctions
#pragma mark -

+ (NSString *) fRightBackOf:(NSString *)substring inString:(NSString *)inString {
if(inString == nil || substring == nil || [inString length] < 1 || [substring length] < 1) {
return @"";
}

NSArray *parts = [inString componentsSeparatedByString:substring];

// does it exist?
if([parts count] < 1) {
return @"";
}

return [parts objectAtIndex:([parts count] - 1)];
}
+ (BOOL) string:(NSString *)inString contains:(NSString *)substring {
if(substring == nil || inString == nil || [substring length] < 1 || [inString length] < 1) {
return NO;
}

NSRange range = [inString rangeOfString:substring];
return range.location != NSNotFound;
}

@end
12 changes: 11 additions & 1 deletion HandBrakeBatch/HBBProgressController.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#import "HBBProgressController.h"
#import "HBBPresets.h"
#import "HBBLangData.h"
#import "HBBAppFunctions.h"

#define FILES_OK 0
#define FILE_EXISTS 1
Expand Down Expand Up @@ -396,6 +397,11 @@ -(void) taskCompleted:(NSNotification *)notification {
[[NSFileManager defaultManager] moveItemAtURL:[[currentQueue objectAtIndex:0] tempOutputURL] toURL:[[currentQueue objectAtIndex:0] outputURL] error:nil];

[processedQueue addObject:[currentQueue objectAtIndex:0]];

// M.Maher 2013-01-26
// hook to send file to external application after conversion
[self sendConvertedFileToExternalAppIfNeeded:[currentQueue objectAtIndex:0]];

} else {
// Conversion failed! Write log file and do not delete source
[stdErrData writeToURL:[NSURL fileURLWithPath:logFilePath] atomically:NO];
Expand Down Expand Up @@ -493,7 +499,11 @@ -(void) taskCompleted:(NSNotification *)notification {
[self prepareTask];
[backgroundTask launch];
}

- (void) sendConvertedFileToExternalAppIfNeeded:(HBBInputFile *)inputFile {
if ([HBBAppFunctions isSendToAppValid]) {
[HBBAppFunctions openFileWithSendToApp:[inputFile outputPath]];
}
}
- (void) getData: (NSNotification *)aNotification
{
NSData *data = [[aNotification userInfo] objectForKey:NSFileHandleNotificationDataItem];
Expand Down
Loading