Initial commit

This commit is contained in:
Wojciech Nagrodzki 2012-08-02 20:30:49 +02:00
parent 053d98a2a2
commit 138fd88169
Signed by: wnagrodzki
GPG key ID: E9D0EB0302264569
32 changed files with 6558 additions and 0 deletions

1
.gitignore vendored
View file

@ -13,3 +13,4 @@ build/*
xcuserdata
profile
*.moved-aside
DerivedData

View file

@ -0,0 +1,593 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
2E20C37815003CA800A826A7 /* AppIcon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 2E20C37715003CA800A826A7 /* AppIcon.icns */; };
2E30A1E615024A8100119004 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 2E30A1E515024A8100119004 /* Localizable.strings */; };
2E30A1EE1502845400119004 /* NSData+MD5.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E30A1ED1502845400119004 /* NSData+MD5.m */; };
2E30A1F1150284AD00119004 /* INPURLCreator.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E30A1F0150284AD00119004 /* INPURLCreator.m */; };
2E30A1F41502872E00119004 /* INPMovieFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E30A1F31502872E00119004 /* INPMovieFilter.m */; };
2E4606AE15A4B631009C6878 /* DownloadStatusFailed.png in Resources */ = {isa = PBXBuildFile; fileRef = 2E4606AB15A4B631009C6878 /* DownloadStatusFailed.png */; };
2E4606AF15A4B631009C6878 /* DownloadStatusNotFound.png in Resources */ = {isa = PBXBuildFile; fileRef = 2E4606AC15A4B631009C6878 /* DownloadStatusNotFound.png */; };
2E4606B015A4B631009C6878 /* DownloadStatusSucceeded.png in Resources */ = {isa = PBXBuildFile; fileRef = 2E4606AD15A4B631009C6878 /* DownloadStatusSucceeded.png */; };
2E4606B415A4B6CF009C6878 /* INDownloadResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E4606B315A4B6CF009C6878 /* INDownloadResult.m */; };
2E4847581593D23B00D1EBF4 /* INSubtitleDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E4847571593D23B00D1EBF4 /* INSubtitleDownloader.m */; };
2E577C8414F952E300914F56 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2E577C8314F952E300914F56 /* Cocoa.framework */; };
2E577C8E14F952E300914F56 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 2E577C8C14F952E300914F56 /* InfoPlist.strings */; };
2E577C9014F952E300914F56 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E577C8F14F952E300914F56 /* main.m */; };
2E577C9414F952E300914F56 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 2E577C9214F952E300914F56 /* Credits.rtf */; };
2E577CA214F952E400914F56 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2E577CA114F952E400914F56 /* SenTestingKit.framework */; };
2E577CA314F952E400914F56 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2E577C8314F952E300914F56 /* Cocoa.framework */; };
2E577CAB14F952E400914F56 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 2E577CA914F952E400914F56 /* InfoPlist.strings */; };
2E577CAE14F952E400914F56 /* iNapiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E577CAD14F952E400914F56 /* iNapiTests.m */; };
2E577CDB14F95F6100914F56 /* INPAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E577CD114F95F6100914F56 /* INPAppDelegate.m */; };
2E577CDC14F95F6100914F56 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2E577CD214F95F6100914F56 /* MainMenu.xib */; };
2E577CE414F9620800914F56 /* INPPreferencesWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E577CE314F9620800914F56 /* INPPreferencesWindowController.m */; };
2E577CE614F9631000914F56 /* INPPreferencesWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2E577CE514F9631000914F56 /* INPPreferencesWindow.xib */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
2E577CA414F952E400914F56 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 2E577C7614F952E300914F56 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 2E577C7E14F952E300914F56;
remoteInfo = iNapi;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
2E20C37715003CA800A826A7 /* AppIcon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = AppIcon.icns; sourceTree = "<group>"; };
2E30A1E515024A8100119004 /* Localizable.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; path = Localizable.strings; sourceTree = "<group>"; };
2E30A1EC1502845400119004 /* NSData+MD5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+MD5.h"; sourceTree = "<group>"; };
2E30A1ED1502845400119004 /* NSData+MD5.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+MD5.m"; sourceTree = "<group>"; };
2E30A1EF150284AD00119004 /* INPURLCreator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = INPURLCreator.h; sourceTree = "<group>"; };
2E30A1F0150284AD00119004 /* INPURLCreator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = INPURLCreator.m; sourceTree = "<group>"; };
2E30A1F21502872E00119004 /* INPMovieFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = INPMovieFilter.h; sourceTree = "<group>"; };
2E30A1F31502872E00119004 /* INPMovieFilter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = INPMovieFilter.m; sourceTree = "<group>"; };
2E4606AB15A4B631009C6878 /* DownloadStatusFailed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = DownloadStatusFailed.png; sourceTree = "<group>"; };
2E4606AC15A4B631009C6878 /* DownloadStatusNotFound.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = DownloadStatusNotFound.png; sourceTree = "<group>"; };
2E4606AD15A4B631009C6878 /* DownloadStatusSucceeded.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = DownloadStatusSucceeded.png; sourceTree = "<group>"; };
2E4606B215A4B6CF009C6878 /* INDownloadResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = INDownloadResult.h; sourceTree = "<group>"; };
2E4606B315A4B6CF009C6878 /* INDownloadResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = INDownloadResult.m; sourceTree = "<group>"; };
2E4847561593D23B00D1EBF4 /* INSubtitleDownloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = INSubtitleDownloader.h; sourceTree = "<group>"; };
2E4847571593D23B00D1EBF4 /* INSubtitleDownloader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = INSubtitleDownloader.m; sourceTree = "<group>"; };
2E577C7F14F952E300914F56 /* iNapi.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iNapi.app; sourceTree = BUILT_PRODUCTS_DIR; };
2E577C8314F952E300914F56 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
2E577C8614F952E300914F56 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
2E577C8714F952E300914F56 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
2E577C8814F952E300914F56 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
2E577C8B14F952E300914F56 /* iNapi-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "iNapi-Info.plist"; sourceTree = "<group>"; };
2E577C8D14F952E300914F56 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
2E577C8F14F952E300914F56 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
2E577C9114F952E300914F56 /* iNapi-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "iNapi-Prefix.pch"; sourceTree = "<group>"; };
2E577C9314F952E300914F56 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = "<group>"; };
2E577CA014F952E400914F56 /* iNapiTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = iNapiTests.octest; sourceTree = BUILT_PRODUCTS_DIR; };
2E577CA114F952E400914F56 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; };
2E577CA814F952E400914F56 /* iNapiTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "iNapiTests-Info.plist"; sourceTree = "<group>"; };
2E577CAA14F952E400914F56 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
2E577CAC14F952E400914F56 /* iNapiTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = iNapiTests.h; sourceTree = "<group>"; };
2E577CAD14F952E400914F56 /* iNapiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = iNapiTests.m; sourceTree = "<group>"; };
2E577CD014F95F6100914F56 /* INPAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = INPAppDelegate.h; sourceTree = "<group>"; };
2E577CD114F95F6100914F56 /* INPAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = INPAppDelegate.m; sourceTree = "<group>"; };
2E577CD214F95F6100914F56 /* MainMenu.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainMenu.xib; sourceTree = "<group>"; };
2E577CE214F9620800914F56 /* INPPreferencesWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = INPPreferencesWindowController.h; sourceTree = "<group>"; };
2E577CE314F9620800914F56 /* INPPreferencesWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = INPPreferencesWindowController.m; sourceTree = "<group>"; };
2E577CE514F9631000914F56 /* INPPreferencesWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = INPPreferencesWindow.xib; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
2E577C7C14F952E300914F56 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
2E577C8414F952E300914F56 /* Cocoa.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
2E577C9C14F952E400914F56 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
2E577CA214F952E400914F56 /* SenTestingKit.framework in Frameworks */,
2E577CA314F952E400914F56 /* Cocoa.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
2E4606AA15A4B631009C6878 /* DownloadStatusImages */ = {
isa = PBXGroup;
children = (
2E4606AB15A4B631009C6878 /* DownloadStatusFailed.png */,
2E4606AC15A4B631009C6878 /* DownloadStatusNotFound.png */,
2E4606AD15A4B631009C6878 /* DownloadStatusSucceeded.png */,
);
path = DownloadStatusImages;
sourceTree = "<group>";
};
2E577C7414F952E300914F56 = {
isa = PBXGroup;
children = (
2E577C8914F952E300914F56 /* iNapi */,
2E577CA614F952E400914F56 /* iNapiTests */,
2E577C8214F952E300914F56 /* Frameworks */,
2E577C8014F952E300914F56 /* Products */,
);
sourceTree = "<group>";
};
2E577C8014F952E300914F56 /* Products */ = {
isa = PBXGroup;
children = (
2E577C7F14F952E300914F56 /* iNapi.app */,
2E577CA014F952E400914F56 /* iNapiTests.octest */,
);
name = Products;
sourceTree = "<group>";
};
2E577C8214F952E300914F56 /* Frameworks */ = {
isa = PBXGroup;
children = (
2E577C8314F952E300914F56 /* Cocoa.framework */,
2E577CA114F952E400914F56 /* SenTestingKit.framework */,
2E577C8514F952E300914F56 /* Other Frameworks */,
);
name = Frameworks;
sourceTree = "<group>";
};
2E577C8514F952E300914F56 /* Other Frameworks */ = {
isa = PBXGroup;
children = (
2E577C8614F952E300914F56 /* AppKit.framework */,
2E577C8714F952E300914F56 /* CoreData.framework */,
2E577C8814F952E300914F56 /* Foundation.framework */,
);
name = "Other Frameworks";
sourceTree = "<group>";
};
2E577C8914F952E300914F56 /* iNapi */ = {
isa = PBXGroup;
children = (
2E577CCE14F95F6100914F56 /* Classes */,
2E577CD914F95F6100914F56 /* Externals */,
2E577CDA14F95F6100914F56 /* Resources */,
2E577C8A14F952E300914F56 /* Supporting Files */,
);
path = iNapi;
sourceTree = "<group>";
};
2E577C8A14F952E300914F56 /* Supporting Files */ = {
isa = PBXGroup;
children = (
2E577C8B14F952E300914F56 /* iNapi-Info.plist */,
2E577C8C14F952E300914F56 /* InfoPlist.strings */,
2E577C8F14F952E300914F56 /* main.m */,
2E577C9114F952E300914F56 /* iNapi-Prefix.pch */,
2E577C9214F952E300914F56 /* Credits.rtf */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
2E577CA614F952E400914F56 /* iNapiTests */ = {
isa = PBXGroup;
children = (
2E577CAC14F952E400914F56 /* iNapiTests.h */,
2E577CAD14F952E400914F56 /* iNapiTests.m */,
2E577CA714F952E400914F56 /* Supporting Files */,
);
path = iNapiTests;
sourceTree = "<group>";
};
2E577CA714F952E400914F56 /* Supporting Files */ = {
isa = PBXGroup;
children = (
2E577CA814F952E400914F56 /* iNapiTests-Info.plist */,
2E577CA914F952E400914F56 /* InfoPlist.strings */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
2E577CCE14F95F6100914F56 /* Classes */ = {
isa = PBXGroup;
children = (
2E577CCF14F95F6100914F56 /* AppDelegate */,
2E577CD314F95F6100914F56 /* Controllers */,
2E577CD714F95F6100914F56 /* CustomViews */,
2E577CD814F95F6100914F56 /* Helpers */,
2E577CDF14F95F8000914F56 /* Models */,
);
path = Classes;
sourceTree = "<group>";
};
2E577CCF14F95F6100914F56 /* AppDelegate */ = {
isa = PBXGroup;
children = (
2E577CD014F95F6100914F56 /* INPAppDelegate.h */,
2E577CD114F95F6100914F56 /* INPAppDelegate.m */,
2E577CD214F95F6100914F56 /* MainMenu.xib */,
);
path = AppDelegate;
sourceTree = "<group>";
};
2E577CD314F95F6100914F56 /* Controllers */ = {
isa = PBXGroup;
children = (
2E577CE214F9620800914F56 /* INPPreferencesWindowController.h */,
2E577CE314F9620800914F56 /* INPPreferencesWindowController.m */,
2E577CE514F9631000914F56 /* INPPreferencesWindow.xib */,
);
path = Controllers;
sourceTree = "<group>";
};
2E577CD714F95F6100914F56 /* CustomViews */ = {
isa = PBXGroup;
children = (
);
path = CustomViews;
sourceTree = "<group>";
};
2E577CD814F95F6100914F56 /* Helpers */ = {
isa = PBXGroup;
children = (
2E30A1EC1502845400119004 /* NSData+MD5.h */,
2E30A1ED1502845400119004 /* NSData+MD5.m */,
2E30A1EF150284AD00119004 /* INPURLCreator.h */,
2E30A1F0150284AD00119004 /* INPURLCreator.m */,
2E30A1F21502872E00119004 /* INPMovieFilter.h */,
2E30A1F31502872E00119004 /* INPMovieFilter.m */,
2E4847561593D23B00D1EBF4 /* INSubtitleDownloader.h */,
2E4847571593D23B00D1EBF4 /* INSubtitleDownloader.m */,
);
path = Helpers;
sourceTree = "<group>";
};
2E577CD914F95F6100914F56 /* Externals */ = {
isa = PBXGroup;
children = (
);
path = Externals;
sourceTree = "<group>";
};
2E577CDA14F95F6100914F56 /* Resources */ = {
isa = PBXGroup;
children = (
2E4606AA15A4B631009C6878 /* DownloadStatusImages */,
2E577CE014F95FD000914F56 /* AppIcons */,
2E577CE114F95FD000914F56 /* Localization */,
);
path = Resources;
sourceTree = "<group>";
};
2E577CDF14F95F8000914F56 /* Models */ = {
isa = PBXGroup;
children = (
2E4606B215A4B6CF009C6878 /* INDownloadResult.h */,
2E4606B315A4B6CF009C6878 /* INDownloadResult.m */,
);
path = Models;
sourceTree = "<group>";
};
2E577CE014F95FD000914F56 /* AppIcons */ = {
isa = PBXGroup;
children = (
2E20C37715003CA800A826A7 /* AppIcon.icns */,
);
path = AppIcons;
sourceTree = "<group>";
};
2E577CE114F95FD000914F56 /* Localization */ = {
isa = PBXGroup;
children = (
2E30A1E515024A8100119004 /* Localizable.strings */,
);
path = Localization;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
2E577C7E14F952E300914F56 /* iNapi */ = {
isa = PBXNativeTarget;
buildConfigurationList = 2E577CB114F952E400914F56 /* Build configuration list for PBXNativeTarget "iNapi" */;
buildPhases = (
2E577C7B14F952E300914F56 /* Sources */,
2E577C7C14F952E300914F56 /* Frameworks */,
2E577C7D14F952E300914F56 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = iNapi;
productName = iNapi;
productReference = 2E577C7F14F952E300914F56 /* iNapi.app */;
productType = "com.apple.product-type.application";
};
2E577C9F14F952E400914F56 /* iNapiTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 2E577CB414F952E400914F56 /* Build configuration list for PBXNativeTarget "iNapiTests" */;
buildPhases = (
2E577C9B14F952E400914F56 /* Sources */,
2E577C9C14F952E400914F56 /* Frameworks */,
2E577C9D14F952E400914F56 /* Resources */,
2E577C9E14F952E400914F56 /* ShellScript */,
);
buildRules = (
);
dependencies = (
2E577CA514F952E400914F56 /* PBXTargetDependency */,
);
name = iNapiTests;
productName = iNapiTests;
productReference = 2E577CA014F952E400914F56 /* iNapiTests.octest */;
productType = "com.apple.product-type.bundle";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
2E577C7614F952E300914F56 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0420;
ORGANIZATIONNAME = Trifork;
};
buildConfigurationList = 2E577C7914F952E300914F56 /* Build configuration list for PBXProject "iNapi" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 2E577C7414F952E300914F56;
productRefGroup = 2E577C8014F952E300914F56 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
2E577C7E14F952E300914F56 /* iNapi */,
2E577C9F14F952E400914F56 /* iNapiTests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
2E577C7D14F952E300914F56 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2E577C8E14F952E300914F56 /* InfoPlist.strings in Resources */,
2E577C9414F952E300914F56 /* Credits.rtf in Resources */,
2E577CDC14F95F6100914F56 /* MainMenu.xib in Resources */,
2E577CE614F9631000914F56 /* INPPreferencesWindow.xib in Resources */,
2E20C37815003CA800A826A7 /* AppIcon.icns in Resources */,
2E30A1E615024A8100119004 /* Localizable.strings in Resources */,
2E4606AE15A4B631009C6878 /* DownloadStatusFailed.png in Resources */,
2E4606AF15A4B631009C6878 /* DownloadStatusNotFound.png in Resources */,
2E4606B015A4B631009C6878 /* DownloadStatusSucceeded.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
2E577C9D14F952E400914F56 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2E577CAB14F952E400914F56 /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
2E577C9E14F952E400914F56 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
2E577C7B14F952E300914F56 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2E577C9014F952E300914F56 /* main.m in Sources */,
2E577CDB14F95F6100914F56 /* INPAppDelegate.m in Sources */,
2E577CE414F9620800914F56 /* INPPreferencesWindowController.m in Sources */,
2E30A1EE1502845400119004 /* NSData+MD5.m in Sources */,
2E30A1F1150284AD00119004 /* INPURLCreator.m in Sources */,
2E30A1F41502872E00119004 /* INPMovieFilter.m in Sources */,
2E4847581593D23B00D1EBF4 /* INSubtitleDownloader.m in Sources */,
2E4606B415A4B6CF009C6878 /* INDownloadResult.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
2E577C9B14F952E400914F56 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2E577CAE14F952E400914F56 /* iNapiTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
2E577CA514F952E400914F56 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 2E577C7E14F952E300914F56 /* iNapi */;
targetProxy = 2E577CA414F952E400914F56 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
2E577C8C14F952E300914F56 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
2E577C8D14F952E300914F56 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
2E577C9214F952E300914F56 /* Credits.rtf */ = {
isa = PBXVariantGroup;
children = (
2E577C9314F952E300914F56 /* en */,
);
name = Credits.rtf;
sourceTree = "<group>";
};
2E577CA914F952E400914F56 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
2E577CAA14F952E400914F56 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
2E577CAF14F952E400914F56 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
2E577CB014F952E400914F56 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
SDKROOT = macosx;
};
name = Release;
};
2E577CB214F952E400914F56 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "iNapi/iNapi-Prefix.pch";
INFOPLIST_FILE = "iNapi/iNapi-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Debug;
};
2E577CB314F952E400914F56 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "iNapi/iNapi-Prefix.pch";
INFOPLIST_FILE = "iNapi/iNapi-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Release;
};
2E577CB514F952E400914F56 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/iNapi.app/Contents/MacOS/iNapi";
FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "iNapi/iNapi-Prefix.pch";
INFOPLIST_FILE = "iNapiTests/iNapiTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = octest;
};
name = Debug;
};
2E577CB614F952E400914F56 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/iNapi.app/Contents/MacOS/iNapi";
FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "iNapi/iNapi-Prefix.pch";
INFOPLIST_FILE = "iNapiTests/iNapiTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = octest;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
2E577C7914F952E300914F56 /* Build configuration list for PBXProject "iNapi" */ = {
isa = XCConfigurationList;
buildConfigurations = (
2E577CAF14F952E400914F56 /* Debug */,
2E577CB014F952E400914F56 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
2E577CB114F952E400914F56 /* Build configuration list for PBXNativeTarget "iNapi" */ = {
isa = XCConfigurationList;
buildConfigurations = (
2E577CB214F952E400914F56 /* Debug */,
2E577CB314F952E400914F56 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
2E577CB414F952E400914F56 /* Build configuration list for PBXNativeTarget "iNapiTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
2E577CB514F952E400914F56 /* Debug */,
2E577CB614F952E400914F56 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 2E577C7614F952E300914F56 /* Project object */;
}

View file

@ -0,0 +1,17 @@
//
// INPAppDelegate.h
// iNapi
//
// Created by Wojtek Nagrodzki on 25/02/2012.
// Copyright (c) 2012 Trifork. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface INPAppDelegate : NSObject <NSApplicationDelegate>
@property (assign) IBOutlet NSWindow *window;
- (IBAction)showPreferences:(id)sender;
@end

View file

@ -0,0 +1,139 @@
//
// INPAppDelegate.m
// iNapi
//
// Created by Wojtek Nagrodzki on 25/02/2012.
// Copyright (c) 2012 Trifork. All rights reserved.
//
#import "INPAppDelegate.h"
#import "INPPreferencesWindowController.h"
#import "INPMovieFilter.h"
#import "INSubtitleDownloader.h"
#import "INDownloadResult.h"
#import "INPURLCreator.h"
@interface INPAppDelegate () <INSubtitleDownloaderDelegate>
@property (weak) IBOutlet NSArrayController *downloadResultsArrayController;
@property (strong, nonatomic) INSubtitleDownloader * subtitleDownloader;
@property (strong, nonatomic) INPURLCreator * urlCreator;
@property (strong, nonatomic) INPMovieFilter * movieFilter;
@property (strong, nonatomic) INPPreferencesWindowController * preferencesWindowController;
@property (strong, nonatomic) NSMutableArray * downloadResults;
@property (assign, nonatomic) float downloadProgress;
@end
@implementation INPAppDelegate
- (IBAction)showPreferences:(id)sender
{
[self.preferencesWindowController.window makeKeyAndOrderFront:self];
}
#pragma mark - Private
- (INSubtitleDownloader *)subtitleDownloader
{
if (_subtitleDownloader == nil) {
_subtitleDownloader = [[INSubtitleDownloader alloc] init];
_subtitleDownloader.delegate = self;
}
return _subtitleDownloader;
}
- (INPURLCreator *)urlCreator
{
if (_urlCreator == nil) {
_urlCreator = [[INPURLCreator alloc] init];
}
return _urlCreator;
}
- (INPMovieFilter *)movieFilter
{
if (_movieFilter == nil) {
_movieFilter = [[INPMovieFilter alloc] init];
}
return _movieFilter;
}
- (INPPreferencesWindowController *)preferencesWindowController
{
if (_preferencesWindowController == nil) {
_preferencesWindowController = [[INPPreferencesWindowController alloc] initWithWindowNibName:@"INPPreferencesWindow"];
}
return _preferencesWindowController;
}
- (NSMutableArray *)downloadResults
{
if (_downloadResults == nil) {
_downloadResults = [NSMutableArray array];
}
return _downloadResults;
}
#pragma mark - Notifications
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
}
#pragma mark - NSApplicationDelegate
- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag
{
if (!flag) {
[self.window makeKeyAndOrderFront:self];
return NO;
}
return YES;
}
- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames
{
[self.downloadResultsArrayController removeObjects:self.downloadResults];
self.downloadProgress = 0;
if ([INPPreferencesWindowController showMainWindow] == YES) {
[self.window makeKeyAndOrderFront:self];
}
self.movieFilter = [[INPMovieFilter alloc] init];
NSArray * array = [self.movieFilter moviePathsAmongFilePaths:filenames];
for (NSString * path in array) {
NSURL * movieURL = [NSURL fileURLWithPath:path];
NSURL * subtitlesURL = [self.urlCreator iNapiURLForMovie:path language:[INPPreferencesWindowController subtitleLanguage]];
[self.subtitleDownloader downloadSubtitlesAtURL:subtitlesURL forMovieAtURL:movieURL completionHandler:^(NSURL *downloadedSubtitlesURL, NSError *error) {
INDownloadResult * result = [[INDownloadResult alloc] initWithDownloadedSubtitlesURL:downloadedSubtitlesURL error:error];
[self.downloadResultsArrayController addObject:result];
self.downloadProgress += 1.0 / array.count;
}];
}
if ([INPPreferencesWindowController quitINapi] == YES) {
[NSApp terminate:self];
}
}
#pragma mark - INSubtitleDownloaderDelegate
- (BOOL)subtitleDownloader:(INSubtitleDownloader *)subtitleDownloader shouldArchivePreviousSubtitlesAtURL:(NSURL *)oldSubtitlesURL forMovieAtURL:(NSURL *)movieURL
{
return [INPPreferencesWindowController archivePreviousSubtitles];
}
@end

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,21 @@
//
// INPPreferencesWindowController.h
// iNapi
//
// Created by Wojtek Nagrodzki on 25/02/2012.
// Copyright (c) 2012 Trifork. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface INPPreferencesWindowController : NSWindowController
+ (NSString *)subtitleLanguage;
+ (BOOL)convertToUTF8;
+ (BOOL)archivePreviousSubtitles;
+ (BOOL)createSRTCopy;
+ (BOOL)showMainWindow;
+ (BOOL)useGrowl;
+ (BOOL)quitINapi;
@end

View file

@ -0,0 +1,220 @@
//
// INPPreferencesWindowController.m
// iNapi
//
// Created by Wojtek Nagrodzki on 25/02/2012.
// Copyright (c) 2012 Trifork. All rights reserved.
//
#import "INPPreferencesWindowController.h"
static NSString * const INPPreferencesWindowControllerConvertToUTF8Key = @"INPPreferencesWindowControllerConvertToUTF8";
static NSString * const INPPreferencesWindowControllerArchivePreviousSubtitlesKey = @"INPPreferencesWindowControllerArchivePreviousSubtitles";
static NSString * const INPPreferencesWindowControllerCreateSRTCopyKey = @"INPPreferencesWindowControllerCreateSRTCopy";
static NSString * const INPPreferencesWindowControllerShowMainWindowKey = @"INPPreferencesWindowControllerShowMainWindow";
static NSString * const INPPreferencesWindowControllerUseGrowlKey = @"INPPreferencesWindowControllerUseGrowl";
static NSString * const INPPreferencesWindowControllerQuitINapiKey = @"INPPreferencesWindowControllerQuitINapi";
static NSString * const INPPreferencesWindowControllerSelectedLanguageIndexKey = @"INPPreferencesWindowControllerSelectedLanguageIndexKey";
@interface INPPreferencesWindowController ()
@property (assign, nonatomic) BOOL convertToUTF8;
@property (assign, nonatomic) BOOL archivePreviousSubtitles;
@property (assign, nonatomic) BOOL createSRTCopy;
@property (assign, nonatomic) BOOL showMainWindow;
@property (assign, nonatomic) BOOL useGrowl;
@property (assign, nonatomic) BOOL quitINapi;
@property (copy, nonatomic) NSArray * languages;
@property (assign, nonatomic) NSInteger selectedLanguageIndex;
- (void)localizeUserInterface;
@property (weak) IBOutlet NSTextField *subtitleLanguageLabel;
@property (weak) IBOutlet NSTextField *subtitlesLabel;
@property (weak) IBOutlet NSButton *convertToUTF8Button;
@property (weak) IBOutlet NSButton *archivePreviousButton;
@property (weak) IBOutlet NSButton *createSRTCopyButton;
@property (weak) IBOutlet NSTextField *duringDownloadLabel;
@property (weak) IBOutlet NSButton *showMainWindowButton;
@property (weak) IBOutlet NSButton *useGrowlButton;
@property (weak) IBOutlet NSTextField *afterDownloadLabel;
@property (weak) IBOutlet NSButton *quitINapiButton;
@end
@implementation INPPreferencesWindowController
@synthesize subtitleLanguageLabel;
@synthesize subtitlesLabel;
@synthesize convertToUTF8Button;
@synthesize archivePreviousButton;
@synthesize createSRTCopyButton;
@synthesize duringDownloadLabel;
@synthesize showMainWindowButton;
@synthesize useGrowlButton;
@synthesize afterDownloadLabel;
@synthesize quitINapiButton;
// Private
@synthesize convertToUTF8;
@synthesize archivePreviousSubtitles;
@synthesize createSRTCopy;
@synthesize showMainWindow;
@synthesize useGrowl;
@synthesize quitINapi;
@synthesize languages;
@synthesize selectedLanguageIndex;
#pragma mark - Class methods
+ (NSString *)subtitleLanguage
{
NSInteger selectedLanguageIndex = [[NSUserDefaults standardUserDefaults] integerForKey:INPPreferencesWindowControllerSelectedLanguageIndexKey];
NSArray * languageCodes = [NSArray arrayWithObjects:@"PL", @"EN", nil];
return [languageCodes objectAtIndex:selectedLanguageIndex];
}
+ (BOOL)convertToUTF8
{
return [[NSUserDefaults standardUserDefaults] boolForKey:INPPreferencesWindowControllerConvertToUTF8Key];
}
+ (BOOL)archivePreviousSubtitles
{
return [[NSUserDefaults standardUserDefaults] boolForKey:INPPreferencesWindowControllerArchivePreviousSubtitlesKey];
}
+ (BOOL)createSRTCopy
{
return [[NSUserDefaults standardUserDefaults] boolForKey:INPPreferencesWindowControllerCreateSRTCopyKey];
}
+ (BOOL)showMainWindow
{
return [[NSUserDefaults standardUserDefaults] boolForKey:INPPreferencesWindowControllerShowMainWindowKey];
}
+ (BOOL)useGrowl
{
return [[NSUserDefaults standardUserDefaults] boolForKey:INPPreferencesWindowControllerUseGrowlKey];
}
+ (BOOL)quitINapi
{
return [[NSUserDefaults standardUserDefaults] boolForKey:INPPreferencesWindowControllerQuitINapiKey];
}
#pragma mark -
- (id)initWithWindow:(NSWindow *)window
{
self = [super initWithWindow:window];
if (self) {
NSString * polish = NSLocalizedString(@"Polish", nil);
NSString * english = NSLocalizedString(@"English", nil);
self.languages = [NSArray arrayWithObjects:polish, english, nil];
}
return self;
}
- (void)windowDidLoad
{
[super windowDidLoad];
[self localizeUserInterface];
}
#pragma mark - Setters/Getters
- (void)setConvertToUTF8:(BOOL)flag
{
[[NSUserDefaults standardUserDefaults] setBool:flag forKey:INPPreferencesWindowControllerConvertToUTF8Key];
}
- (BOOL)convertToUTF8
{
return [[self class] convertToUTF8];
}
- (void)setArchivePreviousSubtitles:(BOOL)flag
{
[[NSUserDefaults standardUserDefaults] setBool:flag forKey:INPPreferencesWindowControllerArchivePreviousSubtitlesKey];
}
- (BOOL)archivePreviousSubtitles
{
return [[self class] archivePreviousSubtitles];
}
- (void)setCreateSRTCopy:(BOOL)flag
{
[[NSUserDefaults standardUserDefaults] setBool:flag forKey:INPPreferencesWindowControllerCreateSRTCopyKey];
}
- (BOOL)createSRTCopy
{
return [[self class] createSRTCopy];
}
- (void)setShowMainWindow:(BOOL)flag
{
[[NSUserDefaults standardUserDefaults] setBool:flag forKey:INPPreferencesWindowControllerShowMainWindowKey];
}
- (BOOL)showMainWindow
{
return [[self class] showMainWindow];
}
- (void)setUseGrowl:(BOOL)flag
{
[[NSUserDefaults standardUserDefaults] setBool:flag forKey:INPPreferencesWindowControllerUseGrowlKey];
}
- (BOOL)useGrowl
{
return [[self class] useGrowl];
}
- (void)setQuitINapi:(BOOL)flag
{
[[NSUserDefaults standardUserDefaults] setBool:flag forKey:INPPreferencesWindowControllerQuitINapiKey];
}
- (BOOL)quitINapi
{
return [[self class] quitINapi];
}
- (void)setSelectedLanguageIndex:(NSInteger)newSelectedLanguageIndex
{
[[NSUserDefaults standardUserDefaults] setInteger:newSelectedLanguageIndex forKey:INPPreferencesWindowControllerSelectedLanguageIndexKey];
}
- (NSInteger)selectedLanguageIndex
{
return [[NSUserDefaults standardUserDefaults] integerForKey:INPPreferencesWindowControllerSelectedLanguageIndexKey];
}
#pragma mark - Private
- (void)localizeUserInterface
{
self.subtitleLanguageLabel.stringValue = NSLocalizedString(@"Subtitle language", nil);
self.subtitlesLabel.stringValue = NSLocalizedString(@"Subtitles", nil);
self.convertToUTF8Button.title = NSLocalizedString(@"Convert to UTF8", nil);
self.archivePreviousButton.title = NSLocalizedString(@"Archive previous", nil);
self.createSRTCopyButton.title = NSLocalizedString(@"Create SRT copy", nil);
self.duringDownloadLabel.stringValue = NSLocalizedString(@"During download", nil);
self.showMainWindowButton.title = NSLocalizedString(@"Show main window", nil);
self.useGrowlButton.title = NSLocalizedString(@"Use Growl", nil);
self.afterDownloadLabel.stringValue = NSLocalizedString(@"After download", nil);
self.quitINapiButton.title = NSLocalizedString(@"Quit iNapi", nil);
}
@end

View file

@ -0,0 +1,15 @@
//
// INPMovieFilter.h
// iNapi
//
// Created by Wojtek Nagrodzki on 03/03/2012.
// Copyright (c) 2012 Trifork. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface INPMovieFilter : NSObject
- (NSArray *)moviePathsAmongFilePaths:(NSArray *)filePaths;
@end

View file

@ -0,0 +1,100 @@
//
// INPMovieFilter.m
// iNapi
//
// Created by Wojtek Nagrodzki on 03/03/2012.
// Copyright (c) 2012 Trifork. All rights reserved.
//
#import "INPMovieFilter.h"
@interface INPMovieFilter ()
@property (strong, nonatomic) NSFileManager * fileManager;
- (BOOL)fileConformsToMovieUTI:(NSString *)filePath;
- (NSArray *)moviePathsAtDirectory:(NSString *)directoryPath;
@end
@implementation INPMovieFilter
@synthesize fileManager;
- (id)init
{
self = [super init];
if (self) {
self.fileManager = [NSFileManager defaultManager];
}
return self;
}
#pragma mark - Interface
- (NSArray *)moviePathsAmongFilePaths:(NSArray *)filePaths
{
NSMutableArray * movies = [NSMutableArray array];
BOOL isDirectory;
for (NSString * path in filePaths) {
[fileManager fileExistsAtPath:path isDirectory:&isDirectory];
if (isDirectory) {
NSArray * moviePathsAtDirectory = [self moviePathsAtDirectory:path];
[movies addObjectsFromArray:moviePathsAtDirectory];
}
else {
if ([self fileConformsToMovieUTI:path])
[movies addObject:path];
}
}
return movies;
}
#pragma mark - Private
- (BOOL)fileConformsToMovieUTI:(NSString *)filePath
{
NSString* targetFilePath_converted = [filePath stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
CFURLRef anUrl = (__bridge CFURLRef)[NSURL URLWithString: targetFilePath_converted];
FSRef ref;
CFURLGetFSRef(anUrl,&ref);
CFTypeRef outValue;
LSCopyItemAttribute (
&ref,
kLSRolesAll,
kLSItemContentType,
&outValue
);
CFStringRef uti = (__bridge CFStringRef)[NSString stringWithString:(__bridge NSString *)outValue];
return UTTypeConformsTo(uti, kUTTypeMovie);
}
- (NSArray *)moviePathsAtDirectory:(NSString *)directoryPath
{
NSMutableArray * movies = [NSMutableArray array];
NSDirectoryEnumerator* enumerator = [fileManager enumeratorAtPath:directoryPath];
BOOL isDirectory;
NSString * iPath = nil;
NSString* completeIPath = nil;
while (iPath = [enumerator nextObject]) {
completeIPath = [[NSString stringWithString:directoryPath] stringByAppendingPathComponent:iPath];
[fileManager fileExistsAtPath:completeIPath isDirectory: &isDirectory];
if (!isDirectory)
if ([self fileConformsToMovieUTI:completeIPath])
[movies addObject:completeIPath];
}
return movies;
}
@end

View file

@ -0,0 +1,15 @@
//
// INPURLCreator.h
// iNapi
//
// Created by Wojtek Nagrodzki on 03/03/2012.
// Copyright (c) 2012 Trifork. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface INPURLCreator : NSObject
- (NSURL *)iNapiURLForMovie:(NSString *)filePath language:(NSString *)language;
@end

View file

@ -0,0 +1,93 @@
//
// INPURLCreator.m
// iNapi
//
// Created by Wojtek Nagrodzki on 03/03/2012.
// Copyright (c) 2012 Trifork. All rights reserved.
//
#import "INPURLCreator.h"
#import "NSData+MD5.h"
@interface INPURLCreator ()
- (NSString *)md5HashOfFirst10MBOfFile:(NSString *)filePath;
- (NSString *)mysteriousHash:(NSString *)md5String;
@end
@implementation INPURLCreator
- (NSURL *)iNapiURLForMovie:(NSString *)filePath language:(NSString *)language
{
NSString * md5Hash = [self md5HashOfFirst10MBOfFile:filePath];
NSString * mysteriousHash = [self mysteriousHash:md5Hash];
NSString* urlString = [NSString stringWithFormat:
@"http://napiprojekt.pl/unit_napisy/dl.php?"
@"l=%@&"
@"f=%@&"
@"t=%@&"
@"v=pynapi&"
@"kolejka=false&"
@"nick=&"
@"pass=&"
@"napios=posix",language, md5Hash, mysteriousHash];
return [NSURL URLWithString:urlString];
}
- (NSString *)md5HashOfFirst10MBOfFile:(NSString *)filePath
{
NSFileHandle * fileHandle = [NSFileHandle fileHandleForReadingAtPath:filePath];
NSData * data = [fileHandle readDataOfLength:1024*1024*10];
return [data md5];
}
- (NSString *)mysteriousHash:(NSString *)md5String
{
if ([md5String length] != 32) {
return nil;
}
int idx[] = {0xe, 0x3, 0x6, 0x8, 0x2};
int mul[] = {2, 2, 5, 4, 3};
int add[] = {0x0, 0xd, 0x10, 0xb, 0x5};
int t;
unsigned tmp, v;
NSMutableString *result = [NSMutableString string];
for (int i = 0; i < 5; i++) {
//hex to int
NSScanner *scanner = [NSScanner scannerWithString:[NSString stringWithFormat:@"%c", [md5String characterAtIndex:idx[i]]]];
[scanner scanHexInt:&tmp];
t = add[i] + tmp;
//hex to int
NSString *subString;
if (t > 30) {
subString = [md5String substringFromIndex:t];
}
else {
subString = [md5String substringWithRange:NSMakeRange(t, 2)];
}
scanner = [NSScanner scannerWithString:subString];
[scanner scanHexInt:&v];
NSString *hexResult = [NSString stringWithFormat:@"%x", v * mul[i]];
NSString *lastLetter = [hexResult substringFromIndex:[hexResult length] - 1];
[result appendString:lastLetter];
}
return [result stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]];
}
@end

View file

@ -0,0 +1,26 @@
//
// INSubtitleDownloader.h
// iNapi
//
// Created by Wojtek Nagrodzki on 22/06/2012.
// Copyright (c) 2012 Trifork. All rights reserved.
//
#import <Foundation/Foundation.h>
@class INSubtitleDownloader;
@protocol INSubtitleDownloaderDelegate <NSObject>
- (BOOL)subtitleDownloader:(INSubtitleDownloader *)subtitleDownloader shouldArchivePreviousSubtitlesAtURL:(NSURL *)oldSubtitlesURL forMovieAtURL:(NSURL *)movieURL;
@end
@interface INSubtitleDownloader : NSObject
@property (weak, nonatomic) id<INSubtitleDownloaderDelegate> delegate;
-(void)downloadSubtitlesAtURL:(NSURL *)subtitlesURL forMovieAtURL:(NSURL *)movieURL completionHandler:(void (^)(NSURL * downloadedSubtitlesURL, NSError * error))completionHandler;
@end

View file

@ -0,0 +1,121 @@
//
// INSubtitleDownloader.m
// iNapi
//
// Created by Wojtek Nagrodzki on 22/06/2012.
// Copyright (c) 2012 Trifork. All rights reserved.
//
#import "INSubtitleDownloader.h"
@interface INSubtitleDownloader ()
@property (assign, nonatomic) dispatch_queue_t downloadQueue;
@property (strong, nonatomic) NSFileManager * fileManager;
@end
@implementation INSubtitleDownloader
@synthesize delegate;
// Private
@synthesize downloadQueue;
@synthesize fileManager;
+ (INSubtitleDownloader *)sharedDownloader
{
__strong static id _sharedObject = nil;
static dispatch_once_t onceToken = 0;
dispatch_once(&onceToken, ^{
_sharedObject = [[self alloc] init];
});
return _sharedObject;
}
- (id)init
{
self = [super init];
if (self) {
self.downloadQueue = dispatch_queue_create("com.izydor86.inapi.downloadSubtitles", DISPATCH_QUEUE_SERIAL);
self.fileManager = [NSFileManager defaultManager];
}
return self;
}
- (void)dealloc
{
dispatch_release(downloadQueue);
self.downloadQueue = NULL;
}
#pragma mark - Interface
-(void)downloadSubtitlesAtURL:(NSURL *)subtitlesURL forMovieAtURL:(NSURL *)movieURL completionHandler:(void (^)(NSURL * downloadedSubtitlesURL, NSError * downloadError))completionHandler
{
dispatch_async(self.downloadQueue, ^{
// download subtitles
NSError * error;
NSString * subtitles = [NSString stringWithContentsOfURL:subtitlesURL
encoding:NSWindowsCP1250StringEncoding
error:&error];
if (error) {
dispatch_async(dispatch_get_main_queue(), ^{
completionHandler(nil, error);
});
return;
}
// check if subtitles were found, if not pass error
if ([subtitles isEqualToString:@"NPc0"]) {
error = [NSError errorWithDomain:@"com.izydor86.iNapi" code:404 userInfo:nil];
dispatch_async(dispatch_get_main_queue(), ^{
completionHandler(nil, error);
});
return;
}
// construct URL where subtitles will to be stored
NSURL * subtitlesSaveURL = [[movieURL URLByDeletingPathExtension] URLByAppendingPathExtension:@"txt"];
// rename existing subtitles if necessary
BOOL archivePreviousSubtitles = [self.delegate subtitleDownloader:self shouldArchivePreviousSubtitlesAtURL:subtitlesSaveURL forMovieAtURL:movieURL];
if (archivePreviousSubtitles && [self.fileManager fileExistsAtPath:subtitlesSaveURL.path] == YES) {
NSURL * archiverSubtitlesSaveURL = [self archivedURLWithURL:subtitlesSaveURL];
if ([self.fileManager moveItemAtURL:subtitlesSaveURL toURL:archiverSubtitlesSaveURL error:&error] == NO) {
dispatch_async(dispatch_get_main_queue(), ^{
completionHandler(nil, error);
});
return;
}
}
// save subtitles
if ([subtitles writeToURL:subtitlesSaveURL atomically:YES encoding:NSWindowsCP1250StringEncoding error:&error] == NO) {
dispatch_async(dispatch_get_main_queue(), ^{
completionHandler(nil, error);
});
return;
}
dispatch_async(dispatch_get_main_queue(), ^{
completionHandler(subtitlesSaveURL, nil);
});
});
}
#pragma mark - Private
- (NSURL *)archivedURLWithURL:(NSURL *)url
{
NSString * lastPathComponent = [url lastPathComponent];
NSString * dateAndExtension = [NSString stringWithFormat:@"%@.txt", [NSDate date]];
lastPathComponent = [lastPathComponent stringByReplacingOccurrencesOfString:@".txt" withString:dateAndExtension];
return [[url URLByDeletingLastPathComponent] URLByAppendingPathComponent:lastPathComponent];
}
@end

View file

@ -0,0 +1,16 @@
//
// NSDataAdditions.h
// iNapi
//
// Created by Wojtek Nagrodzki on 11-02-28.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSData (md5)
- (NSString*) md5;
@end

View file

@ -0,0 +1,32 @@
//
// NSDataAdditions.m
// iNapi
//
// Created by Wojtek Nagrodzki on 11-02-28.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "NSData+MD5.h"
#import <CommonCrypto/CommonDigest.h>
@implementation NSData (md5)
- (NSString*) md5
{
const char *cStr = [self bytes];
unsigned char digest[CC_MD5_DIGEST_LENGTH];
CC_MD5( cStr, (CC_LONG)[self length], digest );
NSString* s = [NSString stringWithFormat: @"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
digest[0], digest[1],
digest[2], digest[3],
digest[4], digest[5],
digest[6], digest[7],
digest[8], digest[9],
digest[10], digest[11],
digest[12], digest[13],
digest[14], digest[15]];
return s;
}
@end

View file

@ -0,0 +1,18 @@
//
// INDownloadResult.h
// iNapi
//
// Created by Wojtek Nagrodzki on 04/07/2012.
// Copyright (c) 2012 Trifork. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface INDownloadResult : NSObject
@property (strong, nonatomic, readonly) NSString * movieFileName;
@property (strong, nonatomic, readonly) NSImage * downloadResultImage;
- (id)initWithDownloadedSubtitlesURL:(NSURL *)downloadedSubtitlesURL error:(NSError *)error;
@end

View file

@ -0,0 +1,55 @@
//
// INDownloadResult.m
// iNapi
//
// Created by Wojtek Nagrodzki on 04/07/2012.
// Copyright (c) 2012 Trifork. All rights reserved.
//
#import "INDownloadResult.h"
@interface INDownloadResult ()
@property (strong, nonatomic) NSURL * downloadedSubtitlesURL;
@property (strong, nonatomic) NSImage * downloadResultImage;
@end
@implementation INDownloadResult
@synthesize movieFileName;
@synthesize downloadResultImage;
// Private
@synthesize downloadedSubtitlesURL;
- (id)initWithDownloadedSubtitlesURL:(NSURL *)aDownloadedSubtitlesURL error:(NSError *)error
{
self = [super init];
if (self) {
self.downloadedSubtitlesURL = aDownloadedSubtitlesURL;
if (error == nil) {
self.downloadResultImage = [NSImage imageNamed:@"DownloadStatusSucceeded"];
return self;
}
if ([error.domain isEqualToString:@"com.izydor86.iNapi"] && error.code == 404) {
self.downloadResultImage = [NSImage imageNamed:@"DownloadStatusNotFound"];
return self;
}
self.downloadResultImage = [NSImage imageNamed:@"DownloadStatusFailed"];
}
return self;
}
#pragma mark - Interface
- (NSString *)movieFileName
{
return self.downloadedSubtitlesURL.path.lastPathComponent;
}
@end

Binary file not shown.

View file

@ -0,0 +1,23 @@
/*
Localizable.strings
iNapi
Created by Wojtek Nagrodzki on 03/03/2012.
Copyright (c) 2012 Trifork. All rights reserved.
*/
/* INPPreferencesWindowController */
"Subtitle language" = "Subtitle language";
"Subtitles" = "Subtitles";
"Convert to UTF8" = "Convert to UTF8";
"Archive previous" = "Archive previous";
"Create SRT copy" = "Create SRT copy";
"During download" = "During download";
"Show main window" = "Show main window";
"Use Growl" = "Use Growl";
"After download" = "After download";
"Quit iNapi" = "Quit iNapi";
"Polish" = "Polish";
"English" = "English";

View file

@ -0,0 +1,29 @@
{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;}
{\colortbl;\red255\green255\blue255;}
\paperw9840\paperh8400
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
\f0\b\fs24 \cf0 Engineering:
\b0 \
Some people\
\
\b Human Interface Design:
\b0 \
Some other people\
\
\b Testing:
\b0 \
Hopefully not nobody\
\
\b Documentation:
\b0 \
Whoever\
\
\b With special thanks to:
\b0 \
Mom\
}

View file

@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */

148
iNapi/iNapi-Info.plist Normal file
View file

@ -0,0 +1,148 @@
<?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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>Folder</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSItemContentTypes</key>
<array>
<string>public.folder</string>
</array>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Movie</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSItemContentTypes</key>
<array>
<string>public.movie</string>
</array>
<key>LSTypeIsPackage</key>
<false/>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>AppIcon.icns</string>
<key>CFBundleIdentifier</key>
<string>com.izydor86.iNapi.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.video</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2012 Trifork. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>UTImportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.movie</string>
</array>
<key>UTTypeDescription</key>
<string>NuppelVideo movie</string>
<key>UTTypeIdentifier</key>
<string>org.perian.nuppelvideo</string>
<key>UTTypeReferenceURL</key>
<string>http://www.mythtv.org/wiki/NuppelVideo</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>nuv</string>
</array>
</dict>
</dict>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.movie</string>
</array>
<key>UTTypeDescription</key>
<string>Flash video</string>
<key>UTTypeIdentifier</key>
<string>org.perian.flash-video</string>
<key>UTTypeReferenceURL</key>
<string>http://www.adobe.com/devnet/flv/</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>flv</string>
</array>
<key>public.uti</key>
<array>
<string>com.adobe.flash.video</string>
<string>com.apple.flash-video</string>
</array>
</dict>
</dict>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.movie</string>
</array>
<key>UTTypeDescription</key>
<string>Matroska video</string>
<key>UTTypeIdentifier</key>
<string>org.perian.matroska</string>
<key>UTTypeReferenceURL</key>
<string>http://www.matroska.org/</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>mkv</string>
<string>mka</string>
</array>
</dict>
</dict>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.movie</string>
</array>
<key>UTTypeDescription</key>
<string>Ogg video</string>
<key>UTTypeIdentifier</key>
<string>org.perian.ogv</string>
<key>UTTypeReferenceURL</key>
<string>http://xiph.org/ogg/</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>ogv</string>
</array>
</dict>
</dict>
</array>
</dict>
</plist>

7
iNapi/iNapi-Prefix.pch Normal file
View file

@ -0,0 +1,7 @@
//
// Prefix header for all source files of the 'iNapi' target in the 'iNapi' project
//
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif

14
iNapi/main.m Normal file
View file

@ -0,0 +1,14 @@
//
// main.m
// iNapi
//
// Created by Wojtek Nagrodzki on 25/02/2012.
// Copyright (c) 2012 Trifork. All rights reserved.
//
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[])
{
return NSApplicationMain(argc, (const char **)argv);
}

View file

@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */

View file

@ -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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.izydor86.iNapi.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

13
iNapiTests/iNapiTests.h Normal file
View file

@ -0,0 +1,13 @@
//
// iNapiTests.h
// iNapiTests
//
// Created by Wojtek Nagrodzki on 25/02/2012.
// Copyright (c) 2012 Trifork. All rights reserved.
//
#import <SenTestingKit/SenTestingKit.h>
@interface iNapiTests : SenTestCase
@end

32
iNapiTests/iNapiTests.m Normal file
View file

@ -0,0 +1,32 @@
//
// iNapiTests.m
// iNapiTests
//
// Created by Wojtek Nagrodzki on 25/02/2012.
// Copyright (c) 2012 Trifork. All rights reserved.
//
#import "iNapiTests.h"
@implementation iNapiTests
- (void)setUp
{
[super setUp];
// Set-up code here.
}
- (void)tearDown
{
// Tear-down code here.
[super tearDown];
}
- (void)testExample
{
STFail(@"Unit tests are not implemented yet in iNapiTests");
}
@end