From c2d7fb99001c5bf344538c98ea79f7c668979d3c Mon Sep 17 00:00:00 2001 From: nilaoda Date: Fri, 26 Aug 2022 22:20:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B7=B7=E6=B5=81=E9=A1=BA?= =?UTF-8?q?=E5=BA=8F=E5=92=8C=E8=AF=AD=E8=A8=80=E8=AF=86=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs | 1 + src/N_m3u8DL-RE/DownloadManager/SimpleDownloadManager.cs | 3 ++- src/N_m3u8DL-RE/Entity/OutputFile.cs | 1 + src/N_m3u8DL-RE/Program.cs | 2 +- src/N_m3u8DL-RE/Util/MergeUtil.cs | 9 +++++---- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs b/src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs index 1925972..079525c 100644 --- a/src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs +++ b/src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs @@ -92,6 +92,7 @@ namespace N_m3u8DL_RE.CommandLine } imports.Add(new OutputFile() { + Index = 999, FilePath = path, LangCode = lang, Description = name diff --git a/src/N_m3u8DL-RE/DownloadManager/SimpleDownloadManager.cs b/src/N_m3u8DL-RE/DownloadManager/SimpleDownloadManager.cs index 957e22c..00e2175 100644 --- a/src/N_m3u8DL-RE/DownloadManager/SimpleDownloadManager.cs +++ b/src/N_m3u8DL-RE/DownloadManager/SimpleDownloadManager.cs @@ -543,7 +543,7 @@ namespace N_m3u8DL_RE.DownloadManager //记录所有文件信息 if (File.Exists(output)) - OutputFiles.Add(new OutputFile() { FilePath = output, LangCode = streamSpec.Language, Description = streamSpec.Name }); + OutputFiles.Add(new OutputFile() { Index = task.Id, FilePath = output, LangCode = streamSpec.Language, Description = streamSpec.Name }); return true; } @@ -603,6 +603,7 @@ namespace N_m3u8DL_RE.DownloadManager //混流 if (success && DownloaderConfig.MyOptions.MuxAfterDone && OutputFiles.Count > 0) { + OutputFiles = OutputFiles.OrderBy(o => o.Index).ToList(); if (DownloaderConfig.MyOptions.MuxImports != null) { OutputFiles.AddRange(DownloaderConfig.MyOptions.MuxImports); diff --git a/src/N_m3u8DL-RE/Entity/OutputFile.cs b/src/N_m3u8DL-RE/Entity/OutputFile.cs index 10569c3..cbf8b1e 100644 --- a/src/N_m3u8DL-RE/Entity/OutputFile.cs +++ b/src/N_m3u8DL-RE/Entity/OutputFile.cs @@ -8,6 +8,7 @@ namespace N_m3u8DL_RE.Entity { internal class OutputFile { + public required int Index { get; set; } public required string FilePath { get; set; } public string? LangCode { get; set; } public string? Description { get; set; } diff --git a/src/N_m3u8DL-RE/Program.cs b/src/N_m3u8DL-RE/Program.cs index 8b054fe..75ce3d7 100644 --- a/src/N_m3u8DL-RE/Program.cs +++ b/src/N_m3u8DL-RE/Program.cs @@ -119,6 +119,7 @@ namespace N_m3u8DL_RE parserConfig.UrlProcessors.Insert(0, new NowehoryzontyUrlProcessor()); var url = string.Empty; + //url = "https://play.itunes.apple.com/WebObjects/MZPlay.woa/hls/subscription/playlist.m3u8?cc=US&svcId=tvs.vds.4105&a=1580273278&isExternal=true&brandId=tvs.sbd.4000&id=337246031&l=en-US&aec=UHD&xtrick=true&webbrowser=true"; //啥都有 //url = "https://media.axprod.net/TestVectors/v7-Clear/Manifest_1080p.mpd"; //多音轨多字幕 //url = "https://cmafref.akamaized.net/cmaf/live-ull/2006350/akambr/out.mpd"; //直播 //url = "http://playertest.longtailvideo.com/adaptive/oceans_aes/oceans_aes.m3u8"; @@ -127,7 +128,6 @@ namespace N_m3u8DL_RE //url = "http://tv-live.ynkmit.com/tv/anning.m3u8?txSecret=7528f35fb4b62bd24d55b891899db68f&txTime=632C8680"; //直播 //url = "https://rest-as.ott.kaltura.com/api_v3/service/assetFile/action/playManifest/partnerId/147/assetId/1304099/assetType/media/assetFileId/16136929/contextType/PLAYBACK/isAltUrl/False/ks/djJ8MTQ3fMusTFH6PCZpcrfKLQwI-pPm9ex6b6r49wioe32WH2udXeM4reyWIkSDpi7HhvhxBHAHAKiHrcnkmIJQpyAt4MuDBG0ywGQ-jOeqQFcTRQ8BGJGw6g-smSBLwSbo4CCx9M9vWNJX3GkOfhoMAY4yRU-ur3okHiVq1mUJ82XBd_iVqLuzodnc9sJEtcHH0zc5CoPiTq2xor-dq3yDURnZm3isfSN3t9uLIJEW09oE-SJ84DM5GUuFUdbnIV8bdcWUsPicUg-Top1G2D3WcWXq4EvPnwvD8jrC_vsiOpLHf5akAwtdGsJ6__cXUmT7a-QlfjdvaZ5T8UhDLnttHmsxYs2E5c0lh4uOvvJou8dD8iYxUexlPI2j4QUkBRxqOEVLSNV3Y82-5TTRqgnK_uGYXHwk7EAmDws7hbLj2-DJ1heXDcye3OJYdunJgAS-9ma5zmQQNiY_HYh6wj2N1HpCTNAtWWga6R9fC0VgBTZbidW-YwMSGzIvMQfIfWKe15X7Oc_hCs-zGfW9XeRJZrutcWKK_D_HlzpQVBF2vIF3XgaI/a.mpd"; //url = "https://dash.akamaized.net/dash264/TestCases/2c/qualcomm/1/MultiResMPEG2.mpd"; - //url = "http://playertest.longtailvideo.com/adaptive/oceans_aes/oceans_aes.m3u8"; url = "https://cmaf.lln.latam.hbomaxcdn.com/videos/GYPGKMQjoDkVLBQEAAAAo/1/1b5ad5/1_single_J8sExA_1080hi.mpd"; //url = "https://livesim.dashif.org/dash/vod/testpic_2s/multi_subs.mpd"; //ttml + mp4 //url = "http://media.axprod.net/TestVectors/v6-Clear/Manifest_1080p.mpd"; //vtt + mp4 diff --git a/src/N_m3u8DL-RE/Util/MergeUtil.cs b/src/N_m3u8DL-RE/Util/MergeUtil.cs index 53ff963..deb8ece 100644 --- a/src/N_m3u8DL-RE/Util/MergeUtil.cs +++ b/src/N_m3u8DL-RE/Util/MergeUtil.cs @@ -158,7 +158,7 @@ namespace N_m3u8DL_RE.Util //MAP for (int i = 0; i < files.Length; i++) { - command.Append($" -map {i} "); + command.Append($" -map {i}:0 "); } if (mp4) @@ -225,10 +225,11 @@ namespace N_m3u8DL_RE.Util private static void ConvertLangCodeAndDisplayName(OutputFile outputFile) { if (string.IsNullOrEmpty(outputFile.LangCode)) return; + outputFile.LangCode = outputFile.LangCode.Split('-')[0]; CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.AllCultures); foreach (var c in cultures) { - if (outputFile.LangCode.Split('-')[0] == c.TwoLetterISOLanguageName) + if (outputFile.LangCode == c.TwoLetterISOLanguageName) { outputFile.LangCode = c.ThreeLetterISOLanguageName; if (string.IsNullOrEmpty(outputFile.Description)) @@ -240,8 +241,8 @@ namespace N_m3u8DL_RE.Util } //有的播放器不识别zho,统一转为chi if (outputFile.LangCode == "zho") outputFile.LangCode = "chi"; - if (outputFile.LangCode == "cmn") outputFile.LangCode = "chi"; - if (outputFile.LangCode == "yue") outputFile.LangCode = "chi"; + else if (outputFile.LangCode == "cmn") outputFile.LangCode = "chi"; + else if (outputFile.LangCode == "yue") outputFile.LangCode = "chi"; } } }