Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
nilaoda committed May 26, 2023
1 parent af03c84 commit a359a92
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 5 additions & 4 deletions BBDown/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ private static async Task DoWorkAsync(MyOption myOption)
await SubUtil.SaveSubtitleAsync(s.url, s.path);
if (subOnly && File.Exists(s.path) && File.ReadAllText(s.path) != "")
{
var _outSubPath = FormatSavePath(savePathFormat, title, null, null, p, pagesCount);
var _outSubPath = FormatSavePath(savePathFormat, title, null, null, p, pagesCount, tvApi, appApi, intlApi);
if (_outSubPath.Contains('/'))
{
if (!Directory.Exists(_outSubPath.Split('/').First()))
Expand Down Expand Up @@ -663,7 +663,7 @@ private static async Task DoWorkAsync(MyOption myOption)
}

LogDebug("Format Before: " + savePathFormat);
savePath = FormatSavePath(savePathFormat, title, videoTracks.ElementAtOrDefault(vIndex), audioTracks.ElementAtOrDefault(aIndex), p, pagesCount);
savePath = FormatSavePath(savePathFormat, title, videoTracks.ElementAtOrDefault(vIndex), audioTracks.ElementAtOrDefault(aIndex), p, pagesCount, tvApi, appApi, intlApi);
LogDebug("Format After: " + savePath);

if (downloadDanmaku)
Expand Down Expand Up @@ -818,7 +818,7 @@ private static async Task DoWorkAsync(MyOption myOption)
}
}
if (infoMode) continue;
savePath = FormatSavePath(savePathFormat, title, videoTracks.ElementAtOrDefault(vIndex), null, p, pagesCount);
savePath = FormatSavePath(savePathFormat, title, videoTracks.ElementAtOrDefault(vIndex), null, p, pagesCount, tvApi, appApi, intlApi);
if (File.Exists(savePath) && new FileInfo(savePath).Length != 0)
{
Log($"{savePath}已存在, 跳过下载...");
Expand Down Expand Up @@ -954,7 +954,7 @@ private static List<Video> SortTracks(List<Video> videoTracks, Dictionary<string
.ToList();
}

private static string FormatSavePath(string savePathFormat, string title, Video? videoTrack, Audio? audioTrack, Page p, int pagesCount)
private static string FormatSavePath(string savePathFormat, string title, Video? videoTrack, Audio? audioTrack, Page p, int pagesCount, bool tvApi, bool appApi, bool intlApi)
{
var result = savePathFormat.Replace('\\', '/');
var regex = InfoRegex();
Expand All @@ -978,6 +978,7 @@ private static string FormatSavePath(string savePathFormat, string title, Video?
"videoBandwidth" => videoTrack == null ? "" : videoTrack.bandwith.ToString(),
"audioCodecs" => audioTrack == null ? "" : audioTrack.codecs,
"audioBandwidth" => audioTrack == null ? "" : audioTrack.bandwith.ToString(),
"apiType" => tvApi ? "TV" : (appApi ? "APP" : (intlApi ? "INTL" : "WEB")),
_ => key
};
result = result.Replace(m.Value, v);
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ Commands:
`<audioBandwidth>`|音频码率
`<ownerName>`|上传者名称(下载番剧时,该值为"")
`<ownerMid>`|上传者mid(下载番剧时,该值为"")
`<apiType>`|API类型(TV/APP/INTL/WEB)

</details>

Expand Down

0 comments on commit a359a92

Please sign in to comment.