优化二进制合并开启条件即解密条件
This commit is contained in:
parent
764a87cb6d
commit
3140fcbbb9
|
@ -12,6 +12,7 @@ namespace N_m3u8DL_RE.Common.Resource
|
||||||
public static string autoBinaryMerge { get => GetText("autoBinaryMerge"); }
|
public static string autoBinaryMerge { get => GetText("autoBinaryMerge"); }
|
||||||
public static string autoBinaryMerge2 { get => GetText("autoBinaryMerge2"); }
|
public static string autoBinaryMerge2 { get => GetText("autoBinaryMerge2"); }
|
||||||
public static string autoBinaryMerge3 { get => GetText("autoBinaryMerge3"); }
|
public static string autoBinaryMerge3 { get => GetText("autoBinaryMerge3"); }
|
||||||
|
public static string autoBinaryMerge4 { get => GetText("autoBinaryMerge4"); }
|
||||||
public static string badM3u8 { get => GetText("badM3u8"); }
|
public static string badM3u8 { get => GetText("badM3u8"); }
|
||||||
public static string binaryMerge { get => GetText("binaryMerge"); }
|
public static string binaryMerge { get => GetText("binaryMerge"); }
|
||||||
public static string checkingLast { get => GetText("checkingLast"); }
|
public static string checkingLast { get => GetText("checkingLast"); }
|
||||||
|
|
|
@ -28,6 +28,12 @@ namespace N_m3u8DL_RE.Common.Resource
|
||||||
zhTW: "檢測到無法識別的加密方式,自動開啟二進位制合併",
|
zhTW: "檢測到無法識別的加密方式,自動開啟二進位制合併",
|
||||||
enUS: "An unrecognized encryption method is detected, binary merging is automatically enabled"
|
enUS: "An unrecognized encryption method is detected, binary merging is automatically enabled"
|
||||||
),
|
),
|
||||||
|
["autoBinaryMerge4"] = new TextContainer
|
||||||
|
(
|
||||||
|
zhCN: "检测到CENC加密方式,自动开启二进制合并",
|
||||||
|
zhTW: "檢測到CENC加密方式,自動開啟二進位制合併",
|
||||||
|
enUS: "When CENC encryption is detected, binary merging is automatically enabled"
|
||||||
|
),
|
||||||
["badM3u8"] = new TextContainer
|
["badM3u8"] = new TextContainer
|
||||||
(
|
(
|
||||||
zhCN: "错误的m3u8",
|
zhCN: "错误的m3u8",
|
||||||
|
|
|
@ -95,6 +95,13 @@ namespace N_m3u8DL_RE.DownloadManager
|
||||||
//开始下载
|
//开始下载
|
||||||
Logger.InfoMarkUp(ResString.startDownloading + streamSpec.ToShortString());
|
Logger.InfoMarkUp(ResString.startDownloading + streamSpec.ToShortString());
|
||||||
|
|
||||||
|
//对于CENC,全部自动开启二进制合并
|
||||||
|
if (!DownloaderConfig.BinaryMerge && totalCount >= 1 && streamSpec.Playlist!.MediaParts.First().MediaSegments.First().EncryptInfo.Method == Common.Enum.EncryptMethod.CENC)
|
||||||
|
{
|
||||||
|
DownloaderConfig.BinaryMerge = true;
|
||||||
|
Logger.WarnMarkUp($"[darkorange3_1]{ResString.autoBinaryMerge4}[/]");
|
||||||
|
}
|
||||||
|
|
||||||
//下载init
|
//下载init
|
||||||
if (streamSpec.Playlist?.MediaInit != null)
|
if (streamSpec.Playlist?.MediaInit != null)
|
||||||
{
|
{
|
||||||
|
@ -447,12 +454,8 @@ namespace N_m3u8DL_RE.DownloadManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//调用mp4decrypt解密
|
//重新读取init信息
|
||||||
if (mergeSuccess && File.Exists(output) && !DownloaderConfig.MP4RealTimeDecryption && DownloaderConfig.Keys != null && DownloaderConfig.Keys.Length > 0)
|
if (mergeSuccess && totalCount >= 1 && string.IsNullOrEmpty(currentKID) && streamSpec.Playlist!.MediaParts.First().MediaSegments.First().EncryptInfo.Method == Common.Enum.EncryptMethod.CENC)
|
||||||
{
|
|
||||||
if (totalCount >= 1 && streamSpec.Playlist!.MediaParts.First().MediaSegments.First().EncryptInfo.Method != Common.Enum.EncryptMethod.NONE)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(currentKID))
|
|
||||||
{
|
{
|
||||||
using (var fs = File.OpenRead(output))
|
using (var fs = File.OpenRead(output))
|
||||||
{
|
{
|
||||||
|
@ -470,6 +473,10 @@ namespace N_m3u8DL_RE.DownloadManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//调用mp4decrypt解密
|
||||||
|
if (mergeSuccess && File.Exists(output) && !string.IsNullOrEmpty(currentKID) && !DownloaderConfig.MP4RealTimeDecryption && DownloaderConfig.Keys != null && DownloaderConfig.Keys.Length > 0)
|
||||||
|
{
|
||||||
var enc = output;
|
var enc = output;
|
||||||
var dec = Path.Combine(Path.GetDirectoryName(enc)!, Path.GetFileNameWithoutExtension(enc) + "_dec" + Path.GetExtension(enc));
|
var dec = Path.Combine(Path.GetDirectoryName(enc)!, Path.GetFileNameWithoutExtension(enc) + "_dec" + Path.GetExtension(enc));
|
||||||
Logger.InfoMarkUp($"[grey]Decrypting...[/]");
|
Logger.InfoMarkUp($"[grey]Decrypting...[/]");
|
||||||
|
@ -481,7 +488,6 @@ namespace N_m3u8DL_RE.DownloadManager
|
||||||
output = dec;
|
output = dec;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue