批量下载时过滤UGC、其他季或花絮内容

croire 3 years ago
parent 94237b5ee9
commit 8dfd2e11f9

@ -138,11 +138,9 @@ namespace DownKyi.Services
/// 获取视频章节与剧集 /// 获取视频章节与剧集
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public List<VideoSection> GetVideoSections() public List<VideoSection> GetVideoSections(bool noUgc = false)
{ {
if (bangumiSeason == null) { return null; } if (bangumiSeason == null) { return null; }
if (bangumiSeason.Section == null) { return null; }
if (bangumiSeason.Section.Count == 0) { return null; }
List<VideoSection> videoSections = new List<VideoSection> List<VideoSection> videoSections = new List<VideoSection>
{ {
@ -155,6 +153,15 @@ namespace DownKyi.Services
} }
}; };
// 不需要其他季或花絮内容
if (noUgc)
{
return videoSections;
}
if (bangumiSeason.Section == null) { return null; }
if (bangumiSeason.Section.Count == 0) { return null; }
foreach (BangumiSection section in bangumiSeason.Section) foreach (BangumiSection section in bangumiSeason.Section)
{ {
List<VideoPage> pages = new List<VideoPage>(); List<VideoPage> pages = new List<VideoPage>();

@ -106,7 +106,7 @@ namespace DownKyi.Services
/// 获取视频章节与剧集 /// 获取视频章节与剧集
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public List<VideoSection> GetVideoSections() public List<VideoSection> GetVideoSections(bool noUgc = false)
{ {
return null; return null;
} }

@ -103,7 +103,7 @@ namespace DownKyi.Services.Download
return; return;
} }
videoSections = videoInfoService.GetVideoSections(); videoSections = videoInfoService.GetVideoSections(true);
if (videoSections == null) if (videoSections == null)
{ {
LogManager.Debug(Tag, "videoSections is not exist."); LogManager.Debug(Tag, "videoSections is not exist.");

@ -7,7 +7,7 @@ namespace DownKyi.Services
{ {
VideoInfoView GetVideoView(); VideoInfoView GetVideoView();
List<VideoSection> GetVideoSections(); List<VideoSection> GetVideoSections(bool noUgc);
List<VideoPage> GetVideoPages(); List<VideoPage> GetVideoPages();

@ -114,15 +114,30 @@ namespace DownKyi.Services
/// 获取视频章节与剧集 /// 获取视频章节与剧集
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public List<VideoSection> GetVideoSections() public List<VideoSection> GetVideoSections(bool noUgc = false)
{ {
if (videoView == null) { return null; } if (videoView == null) { return null; }
List<VideoSection> videoSections = new List<VideoSection>();
// 不需要ugc内容
if (noUgc)
{
videoSections.Add(new VideoSection
{
Id = 0,
Title = "default",
IsSelected = true,
VideoPages = GetVideoPages()
});
return videoSections;
}
if (videoView.UgcSeason == null) { return null; } if (videoView.UgcSeason == null) { return null; }
if (videoView.UgcSeason.Sections == null) { return null; } if (videoView.UgcSeason.Sections == null) { return null; }
if (videoView.UgcSeason.Sections.Count == 0) { return null; } if (videoView.UgcSeason.Sections.Count == 0) { return null; }
List<VideoSection> videoSections = new List<VideoSection>();
foreach (UgcSection section in videoView.UgcSeason.Sections) foreach (UgcSection section in videoView.UgcSeason.Sections)
{ {
List<ViewModels.PageViewModels.VideoPage> pages = new List<ViewModels.PageViewModels.VideoPage>(); List<ViewModels.PageViewModels.VideoPage> pages = new List<ViewModels.PageViewModels.VideoPage>();

@ -635,7 +635,7 @@ namespace DownKyi.ViewModels
NoDataVisibility = Visibility.Collapsed; NoDataVisibility = Visibility.Collapsed;
} }
List<VideoSection> videoSections = videoInfoService.GetVideoSections(); List<VideoSection> videoSections = videoInfoService.GetVideoSections(false);
if (videoSections == null) if (videoSections == null)
{ {
LogManager.Debug(Tag, "videoSections is not exist."); LogManager.Debug(Tag, "videoSections is not exist.");

Loading…
Cancel
Save