Skip to content
Draft
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
Binary file added .DS_Store
Binary file not shown.
Binary file added Frameworks/.DS_Store
Binary file not shown.
Binary file added YT3Swift/.DS_Store
Binary file not shown.
21 changes: 5 additions & 16 deletions YT3Swift/Downloader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ class Downloader {

taskQueue.async {

let path = Bundle.main.path(forResource: downloaderVersion.rawValue, ofType: "sh")
let path = Bundle.main.path(forResource: downloaderVersion.rawValue, ofType: "")
self.downloadTask = Process()
//self.downloadTask.environment?["python"] = "/usr/bin/python3"

if #available(OSX 10.13, *) {
self.downloadTask.executableURL = URL(fileURLWithPath: path!)
} else {
Expand Down Expand Up @@ -79,9 +79,7 @@ class Downloader {

self.isRunning = false
}

//if !audioOnly {
//print("GETTING STANDARD OUTPUT")

self.captureStandardOutput(self.downloadTask, progressHandler: {(percent) in
progressHandler(percent, nil, nil)
}, errorHandler: {(error) in
Expand All @@ -92,27 +90,18 @@ class Downloader {
progressHandler(100, error, self.currentVideo)
}, infoHandler: {(videoInfo) in
progressHandler(-1, nil, videoInfo)
//print("SENT \"\(videoInfo.name)\"")
})

// if !audioOnly {
//print("GETTING ERROR")
self.readError(self.downloadTask, errorHandler: {(error) in
progressHandler(100, error, self.currentVideo)
})
// }


if #available(OSX 10.13, *) {
try! self.downloadTask.run()
}
//print("THREAD: \(Thread.current.name)")
self.downloadTask.waitUntilExit()

}

/* } else {
print("Can't start download, task is already running")
}*/
}

private func readError(_ task:Process, errorHandler: @escaping (Error) -> Void) {
Expand Down Expand Up @@ -253,5 +242,5 @@ class Downloader {
}

enum YoutubeDLVersion: String {
case latest = "youtube-dl-2021-12-17"
case latest = "yt-dlp_macos"
}
Binary file added YT3Swift/YoutubeDL/.DS_Store
Binary file not shown.
Binary file removed YT3Swift/YoutubeDL/youtube-dl-2021-06-06.sh
Binary file not shown.
Binary file added YT3Swift/YoutubeDL/yt-dlp_macos
Binary file not shown.
10 changes: 0 additions & 10 deletions YoutubeToMac.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.downloads.read-write</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
<key>com.apple.security.temporary-exception.files.absolute-path.read-only</key>
<array>
<string>/private/etc/apache2/</string>
Expand Down
16 changes: 8 additions & 8 deletions YoutubeToMac.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

/* Begin PBXBuildFile section */
23140B0D27948630009418C6 /* youtube-dl-2021-12-17.sh in Resources */ = {isa = PBXBuildFile; fileRef = 23140B0C27948630009418C6 /* youtube-dl-2021-12-17.sh */; };
23357A4326D9B9D20085CF13 /* youtube-dl-2021-06-06.sh in Resources */ = {isa = PBXBuildFile; fileRef = 23357A4226D9B9D20085CF13 /* youtube-dl-2021-06-06.sh */; };
233DF4F424E4B2F60070F015 /* DownloadingPreferencesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 233DF4F324E4B2F60070F015 /* DownloadingPreferencesViewController.swift */; };
23C081272BFBB82D00CEDA73 /* yt-dlp_macos in Resources */ = {isa = PBXBuildFile; fileRef = 23C081262BFBB82D00CEDA73 /* yt-dlp_macos */; };
B7058DB822B6D392001E818D /* Downloader.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7058DB722B6D392001E818D /* Downloader.swift */; };
B7058DBA22B6DB20001E818D /* YTDownloadRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7058DB922B6DB20001E818D /* YTDownloadRequest.swift */; };
B77E6A651E9BCEFC001CFE77 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B77E6A641E9BCEFC001CFE77 /* AppDelegate.swift */; };
Expand Down Expand Up @@ -37,8 +37,8 @@

/* Begin PBXFileReference section */
23140B0C27948630009418C6 /* youtube-dl-2021-12-17.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "youtube-dl-2021-12-17.sh"; sourceTree = "<group>"; };
23357A4226D9B9D20085CF13 /* youtube-dl-2021-06-06.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "youtube-dl-2021-06-06.sh"; sourceTree = "<group>"; };
233DF4F324E4B2F60070F015 /* DownloadingPreferencesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DownloadingPreferencesViewController.swift; sourceTree = "<group>"; };
23C081262BFBB82D00CEDA73 /* yt-dlp_macos */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = "yt-dlp_macos"; sourceTree = "<group>"; };
B7058DB722B6D392001E818D /* Downloader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Downloader.swift; sourceTree = "<group>"; };
B7058DB922B6DB20001E818D /* YTDownloadRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YTDownloadRequest.swift; sourceTree = "<group>"; };
B77E6A611E9BCEFC001CFE77 /* YoutubeToMac.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = YoutubeToMac.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -78,8 +78,8 @@
B773BB5D2263E4AB00F24E37 /* YoutubeDL */ = {
isa = PBXGroup;
children = (
23C081262BFBB82D00CEDA73 /* yt-dlp_macos */,
23140B0C27948630009418C6 /* youtube-dl-2021-12-17.sh */,
23357A4226D9B9D20085CF13 /* youtube-dl-2021-06-06.sh */,
);
path = YoutubeDL;
sourceTree = "<group>";
Expand Down Expand Up @@ -214,10 +214,10 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
23C081272BFBB82D00CEDA73 /* yt-dlp_macos in Resources */,
B77E6A691E9BCEFC001CFE77 /* Assets.xcassets in Resources */,
B77E6A6C1E9BCEFC001CFE77 /* Main.storyboard in Resources */,
23140B0D27948630009418C6 /* youtube-dl-2021-12-17.sh in Resources */,
23357A4326D9B9D20085CF13 /* youtube-dl-2021-06-06.sh in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -375,7 +375,7 @@
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 62;
CURRENT_PROJECT_VERSION = 63;
DEVELOPMENT_TEAM = 9W7546BN3K;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -384,7 +384,7 @@
"$(PROJECT_DIR)/Frameworks",
);
INFOPLIST_FILE = YT3Swift/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks $(inherited) @executable_path/../Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 1.2.4;
OTHER_LDFLAGS = "-Wl,-rpath,@loader_path/../Frameworks";
Expand All @@ -403,7 +403,7 @@
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 62;
CURRENT_PROJECT_VERSION = 63;
DEVELOPMENT_TEAM = 9W7546BN3K;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -412,7 +412,7 @@
"$(PROJECT_DIR)/Frameworks",
);
INFOPLIST_FILE = YT3Swift/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks $(inherited) @executable_path/../Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 1.2.4;
OTHER_LDFLAGS = "-Wl,-rpath,@loader_path/../Frameworks";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "FB5B0EC9-A077-4EFA-A4D0-7813EB6BE6CB"
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "48A582C2-CF86-4F09-8D80-336214E4668F"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "YT3Swift/NewMainWindowController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "28"
endingLineNumber = "28"
landmarkName = "toolbar(_:itemForItemIdentifier:willBeInsertedIntoToolbar:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "373B746A-30A1-4551-A32B-CE454A1E2759"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "YT3Swift/MediaConverter.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "109"
endingLineNumber = "109"
landmarkName = "merge(audioURL:videoURL:withFormat:completion:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?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>Playground (Playground) 1.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>2</integer>
</dict>
<key>Playground (Playground) 2.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>3</integer>
</dict>
<key>Playground (Playground).xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>1</integer>
</dict>
<key>YoutubeToMac.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>