From cacf9b0ff0677b31598e900635ccd415d28722f8 Mon Sep 17 00:00:00 2001 From: nilaoda Date: Sat, 30 Nov 2024 22:28:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=AC=AC=E4=B8=89=E6=96=B9?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E7=9A=84=E4=B8=8B=E8=BD=BD=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=20(#525)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/N_m3u8DL-RE.Common/Resource/ResString.cs | 3 +++ src/N_m3u8DL-RE.Common/Resource/StaticText.cs | 18 ++++++++++++++++++ src/N_m3u8DL-RE/Program.cs | 6 +++--- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/N_m3u8DL-RE.Common/Resource/ResString.cs b/src/N_m3u8DL-RE.Common/Resource/ResString.cs index 5d51837..d98e17a 100644 --- a/src/N_m3u8DL-RE.Common/Resource/ResString.cs +++ b/src/N_m3u8DL-RE.Common/Resource/ResString.cs @@ -105,6 +105,9 @@ public static class ResString public static string fetch => GetText("fetch"); public static string ffmpegMerge => GetText("ffmpegMerge"); public static string ffmpegNotFound => GetText("ffmpegNotFound"); + public static string mkvmergeNotFound => GetText("mkvmergeNotFound"); + public static string mp4decryptNotFound => GetText("mp4decryptNotFound"); + public static string shakaPackagerNotFound => GetText("shakaPackagerNotFound"); public static string fixingTTML => GetText("fixingTTML"); public static string fixingTTMLmp4 => GetText("fixingTTMLmp4"); public static string fixingVTT => GetText("fixingVTT"); diff --git a/src/N_m3u8DL-RE.Common/Resource/StaticText.cs b/src/N_m3u8DL-RE.Common/Resource/StaticText.cs index bc69d05..f184d25 100644 --- a/src/N_m3u8DL-RE.Common/Resource/StaticText.cs +++ b/src/N_m3u8DL-RE.Common/Resource/StaticText.cs @@ -784,6 +784,24 @@ internal class StaticText zhTW: "找不到ffmpeg,請自行下載:https://ffmpeg.org/download.html", enUS: "ffmpeg not found, please download at: https://ffmpeg.org/download.html" ), + ["mkvmergeNotFound"] = new TextContainer + ( + zhCN: "找不到mkvmerge,请自行下载:https://mkvtoolnix.download/downloads.html", + zhTW: "找不到mkvmerge,請自行下載:https://mkvtoolnix.download/downloads.html", + enUS: "mkvmerge not found, please download at: https://mkvtoolnix.download/downloads.html" + ), + ["shakaPackagerNotFound"] = new TextContainer + ( + zhCN: "找不到shaka-packager,请自行下载:https://github.com/shaka-project/shaka-packager/releases", + zhTW: "找不到shaka-packager,請自行下載:https://github.com/shaka-project/shaka-packager/releases", + enUS: "shaka-packager not found, please download at: https://github.com/shaka-project/shaka-packager/releases" + ), + ["mp4decryptNotFound"] = new TextContainer + ( + zhCN: "找不到mp4decrypt,请自行下载:https://www.bento4.com/downloads/", + zhTW: "找不到mp4decrypt,請自行下載:https://www.bento4.com/downloads/", + enUS: "mp4decrypt not found, please download at: https://www.bento4.com/downloads/" + ), ["fixingTTML"] = new TextContainer ( zhCN: "正在提取TTML(raw)字幕...", diff --git a/src/N_m3u8DL-RE/Program.cs b/src/N_m3u8DL-RE/Program.cs index 5b2e046..40e6223 100644 --- a/src/N_m3u8DL-RE/Program.cs +++ b/src/N_m3u8DL-RE/Program.cs @@ -139,7 +139,7 @@ internal class Program option.MkvmergeBinaryPath ??= GlobalUtil.FindExecutable("mkvmerge"); if (string.IsNullOrEmpty(option.MkvmergeBinaryPath) || !File.Exists(option.MkvmergeBinaryPath)) { - throw new FileNotFoundException("mkvmerge not found"); + throw new FileNotFoundException(ResString.mkvmergeNotFound); } Logger.Extra($"mkvmerge => {option.MkvmergeBinaryPath}"); } @@ -155,14 +155,14 @@ internal class Program var file2 = GlobalUtil.FindExecutable("packager-linux-x64"); var file3 = GlobalUtil.FindExecutable("packager-osx-x64"); var file4 = GlobalUtil.FindExecutable("packager-win-x64"); - if (file == null && file2 == null && file3 == null && file4 == null) throw new FileNotFoundException("shaka-packager not found!"); + if (file == null && file2 == null && file3 == null && file4 == null) throw new FileNotFoundException(ResString.shakaPackagerNotFound); option.DecryptionBinaryPath = file ?? file2 ?? file3 ?? file4; Logger.Extra($"shaka-packager => {option.DecryptionBinaryPath}"); } else if (option.DecryptionEngine is DecryptEngine.MP4DECRYPT) { var file = GlobalUtil.FindExecutable("mp4decrypt"); - if (file == null) throw new FileNotFoundException("mp4decrypt not found!"); + if (file == null) throw new FileNotFoundException(ResString.mp4decryptNotFound); option.DecryptionBinaryPath = file; Logger.Extra($"mp4decrypt => {option.DecryptionBinaryPath}"); }