Skip to content

Commit

Permalink
优化番剧多P处理及metadata写入
Browse files Browse the repository at this point in the history
  • Loading branch information
nilaoda committed May 13, 2022
1 parent 399879d commit 1dd0835
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
6 changes: 6 additions & 0 deletions BBDown.Core/Entity/VInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public class VInfo
private bool isBangumi;
private bool isCheese;

/// <summary>
/// 番剧是否完结
/// </summary>
private bool isBangumiEnd;

/// <summary>
/// 视频分P信息
/// </summary>
Expand All @@ -46,6 +51,7 @@ public class VInfo
public string PubTime { get => pubTime; set => pubTime = value; }
public bool IsBangumi { get => isBangumi; set => isBangumi = value; }
public bool IsCheese { get => isCheese; set => isCheese = value; }
public bool IsBangumiEnd { get => isBangumiEnd; set => isBangumiEnd = value; }
public string Index { get => index; set => index = value; }
public List<Page> PagesInfo { get => pagesInfo; set => pagesInfo = value; }
}
Expand Down
16 changes: 5 additions & 11 deletions BBDown/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -669,18 +669,12 @@ private static async Task DoWorkAsync(MyOption myOption)
pagesInfo = pagesInfo.Where(p => selectedPages.Contains(p.index.ToString())).ToList();

// 根据p数选择存储路径
if (pagesCount == 1)
{
savePathFormat = string.IsNullOrEmpty(myOption.FilePattern) ? SinglePageDefaultSavePath : myOption.FilePattern;
}
else if (pagesCount > 1)
savePathFormat = string.IsNullOrEmpty(myOption.FilePattern) ? SinglePageDefaultSavePath : myOption.FilePattern;
// 1. 多P; 2. 只有1P,但是是番剧,尚未完结时 按照多P处理
if (pagesCount > 1 || (bangumi && !vInfo.IsBangumiEnd))
{
savePathFormat = string.IsNullOrEmpty(myOption.MultiFilePattern) ? MultiPageDefaultSavePath : myOption.MultiFilePattern;
}
else
{
savePathFormat = SinglePageDefaultSavePath;
}

foreach (Page p in pagesInfo)
{
Expand Down Expand Up @@ -961,7 +955,7 @@ private static async Task DoWorkAsync(MyOption myOption)
int code = MuxAV(useMp4box, videoPath, audioPath, savePath,
desc,
title,
pagesCount > 1 ? savePath.Split('/').Last() : "",
(pagesCount > 1 || (bangumi && !vInfo.IsBangumiEnd)) ? p.title : "",
File.Exists(coverPath) ? coverPath : "",
lang,
subtitleInfo, audioOnly, videoOnly, p.points);
Expand Down Expand Up @@ -1066,7 +1060,7 @@ private static async Task DoWorkAsync(MyOption myOption)
int code = MuxAV(false, videoPath, "", savePath,
desc,
title,
pagesCount > 1 ? savePath.Split('/').Last() : "",
(pagesCount > 1 || (bangumi && !vInfo.IsBangumiEnd)) ? p.title : "",
File.Exists(coverPath) ? coverPath : "",
lang,
subtitleInfo, audioOnly, videoOnly, p.points);
Expand Down

0 comments on commit 1dd0835

Please sign in to comment.