diff --git a/iina+.xcodeproj/project.pbxproj b/iina+.xcodeproj/project.pbxproj index 025c24db..657dbc73 100644 --- a/iina+.xcodeproj/project.pbxproj +++ b/iina+.xcodeproj/project.pbxproj @@ -51,6 +51,7 @@ 01AEC8BE20EE108B001406E8 /* Processes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01AEC8BD20EE108B001406E8 /* Processes.swift */; }; 01AEC8C220EFBCCF001406E8 /* MPVOption.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01AEC8C120EFBCCF001406E8 /* MPVOption.swift */; }; 01AEC8C920F1081C001406E8 /* Identifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01AEC8C820F1081C001406E8 /* Identifiers.swift */; }; + 01C232E92134FABC0021C28F /* ykdl in Copy Executables */ = {isa = PBXBuildFile; fileRef = 01C232E72134FAB20021C28F /* ykdl */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 01E6A09C211AD62800C6EF98 /* VideoDurationFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01E6A09B211AD62800C6EF98 /* VideoDurationFormatter.swift */; }; 01F46CA12102EF4600FE9DAD /* GereralViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F46CA02102EF4600FE9DAD /* GereralViewController.swift */; }; 01F5151A2109F002007C7153 /* LiveStatusTableCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F515192109F002007C7153 /* LiveStatusTableCellView.swift */; }; @@ -75,6 +76,17 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 01C232E52134EBDD0021C28F /* Copy Executables */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 6; + files = ( + 01C232E92134FABC0021C28F /* ykdl in Copy Executables */, + ); + name = "Copy Executables"; + runOnlyForDeploymentPostprocessing = 0; + }; 01F6C4EA213396560009672A /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -140,6 +152,7 @@ 01AEC8BD20EE108B001406E8 /* Processes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Processes.swift; sourceTree = ""; }; 01AEC8C120EFBCCF001406E8 /* MPVOption.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MPVOption.swift; sourceTree = ""; }; 01AEC8C820F1081C001406E8 /* Identifiers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Identifiers.swift; sourceTree = ""; }; + 01C232E72134FAB20021C28F /* ykdl */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = ykdl; sourceTree = ""; }; 01E6A09B211AD62800C6EF98 /* VideoDurationFormatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoDurationFormatter.swift; sourceTree = ""; }; 01F46CA02102EF4600FE9DAD /* GereralViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GereralViewController.swift; sourceTree = ""; }; 01F46CDC2108C55C00FE9DAD /* iina+.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "iina+.entitlements"; sourceTree = ""; }; @@ -265,6 +278,14 @@ path = SelectVideoCollectionView; sourceTree = ""; }; + 016792F1212E57F6003517A7 /* Executables */ = { + isa = PBXGroup; + children = ( + 01C232E72134FAB20021C28F /* ykdl */, + ); + path = Executables; + sourceTree = ""; + }; 01AEC89E20EDFD01001406E8 = { isa = PBXGroup; children = ( @@ -286,6 +307,7 @@ isa = PBXGroup; children = ( 01F46CDC2108C55C00FE9DAD /* iina+.entitlements */, + 016792F1212E57F6003517A7 /* Executables */, 01AEC8BA20EDFD3F001406E8 /* Assets */, 010F0F2E20FF414E00F33553 /* Core Data */, 012601722119BA6D00C9C639 /* Utils */, @@ -333,6 +355,7 @@ 010F0F0F20FCC1D200F33553 /* CopyFiles */, 019BFF5D212485B900E715CC /* ShellScript */, 01F6C4EA213396560009672A /* Embed Frameworks */, + 01C232E52134EBDD0021C28F /* Copy Executables */, ); buildRules = ( ); diff --git a/iina+/Executables/ykdl b/iina+/Executables/ykdl new file mode 100755 index 00000000..bc0679c8 Binary files /dev/null and b/iina+/Executables/ykdl differ diff --git a/iina+/Info.plist b/iina+/Info.plist index 02d4df42..410beb0e 100644 --- a/iina+/Info.plist +++ b/iina+/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.3 + 0.3.1 CFBundleVersion 0 LSApplicationCategoryType diff --git a/iina+/Utils/Processes.swift b/iina+/Utils/Processes.swift index 5bf880d2..b02d34e8 100644 --- a/iina+/Utils/Processes.swift +++ b/iina+/Utils/Processes.swift @@ -14,6 +14,17 @@ class Processes: NSObject { static let shared = Processes() + private var internalYKDL: String? { + get { + var path = Bundle.main.executablePath + path?.deleteLastPathComponent() + if let path = path { + return path + "/ykdl" + } + return nil + } + } + fileprivate override init() { } @@ -48,7 +59,15 @@ class Processes: NSObject { let errorPipe = Pipe() decodeTask?.standardError = errorPipe decodeTask?.standardOutput = pipe - decodeTask?.launchPath = which(Preferences.shared.liveDecoder.rawValue).first ?? "" + + switch Preferences.shared.liveDecoder { + case .internalYKDL: + decodeTask?.launchPath = internalYKDL + case .ykdl, .youget: + decodeTask?.launchPath = which(Preferences.shared.liveDecoder.rawValue).first ?? "" + case .internal😀: + return + } decodeTask?.arguments = ["--json", url] decodeTask?.launch() diff --git a/iina+/Views/Base.lproj/Main.storyboard b/iina+/Views/Base.lproj/Main.storyboard index f343f95d..bb2e830e 100644 --- a/iina+/Views/Base.lproj/Main.storyboard +++ b/iina+/Views/Base.lproj/Main.storyboard @@ -307,7 +307,7 @@ - + @@ -315,7 +315,7 @@ - + @@ -363,11 +363,11 @@ - + - + @@ -375,7 +375,10 @@ - + + + + diff --git a/iina+/Views/Preferences/GereralViewController.swift b/iina+/Views/Preferences/GereralViewController.swift index 185c17a3..f1b5a13b 100644 --- a/iina+/Views/Preferences/GereralViewController.swift +++ b/iina+/Views/Preferences/GereralViewController.swift @@ -78,14 +78,15 @@ enum LivePlayer: String { enum LiveDecoder: String { case internal😀 + case internalYKDL case ykdl case youget = "you-get" init(raw: String) { - if let decoder = LiveDecoder.init(rawValue: raw) { + if let decoder = LiveDecoder(rawValue: raw) { self = decoder } else { - self = .ykdl + self = .internalYKDL } } @@ -94,9 +95,11 @@ enum LiveDecoder: String { case 0: self = .internal😀 case 2: + self = .ykdl + case 3: self = .youget default: - self = .ykdl + self = .internalYKDL } } @@ -104,10 +107,12 @@ enum LiveDecoder: String { switch self { case .internal😀: return 0 - case .ykdl: + case .internalYKDL: return 1 - case .youget: + case .ykdl: return 2 + case .youget: + return 3 } } }