文件命名格式新增UP信息

croire 3 years ago
parent 1ba868d613
commit 0257df9fbe

@ -19,6 +19,9 @@ namespace DownKyi.Core.FileName
private string bvid = "BVID";
private long cid = -1;
private long upMid = -1;
private string upName = "UP_NAME";
private FileName(List<FileNamePart> nameParts)
{
this.nameParts = nameParts;
@ -95,6 +98,18 @@ namespace DownKyi.Core.FileName
return this;
}
public FileName SetUpMid(long upMid)
{
this.upMid = upMid;
return this;
}
public FileName SetUpName(string upName)
{
this.upName = upName;
return this;
}
public string RelativePath()
{
string path = string.Empty;
@ -143,6 +158,12 @@ namespace DownKyi.Core.FileName
case FileNamePart.CID:
path += cid;
break;
case FileNamePart.UP_MID:
path += upMid;
break;
case FileNamePart.UP_NAME:
path += upName;
break;
}
if (((int)part) >= 100)

@ -16,6 +16,9 @@
BVID,
CID,
UP_MID,
UP_NAME,
// 斜杠
SLASH = 100,

@ -215,6 +215,8 @@
<system:String x:Key="DisplayVideoQuality">画质</system:String>
<system:String x:Key="DisplayVideoCodec">视频编码</system:String>
<system:String x:Key="DisplaySpace">空格</system:String>
<system:String x:Key="DisplayUpMid">UP主ID</system:String>
<system:String x:Key="DisplayUpName">UP主昵称</system:String>
<system:String x:Key="Reset">恢复默认</system:String>
<system:String x:Key="SettingDanmaku">弹幕</system:String>

@ -99,6 +99,27 @@ namespace DownKyi.Services
Name = name,
Duration = "N/A"
};
// UP主信息
if (bangumiSeason.UpInfo != null)
{
page.Owner = new Core.BiliApi.Models.VideoOwner
{
Name = bangumiSeason.UpInfo.Name,
Face = bangumiSeason.UpInfo.Avatar,
Mid = bangumiSeason.UpInfo.Mid,
};
}
else
{
page.Owner = new Core.BiliApi.Models.VideoOwner
{
Name = "",
Face = "",
Mid = -1,
};
}
pages.Add(page);
}

@ -67,6 +67,27 @@ namespace DownKyi.Services
Name = name,
Duration = "N/A"
};
// UP主信息
if (cheeseView.UpInfo != null)
{
page.Owner = new Core.BiliApi.Models.VideoOwner
{
Name = cheeseView.UpInfo.Name,
Face = cheeseView.UpInfo.Avatar,
Mid = cheeseView.UpInfo.Mid,
};
}
else
{
page.Owner = new Core.BiliApi.Models.VideoOwner
{
Name = "",
Face = "",
Mid = -1,
};
}
pages.Add(page);
}

@ -297,7 +297,9 @@ namespace DownKyi.Services.Download
.SetVideoCodec(page.VideoQuality == null ? "" : page.VideoQuality.SelectedVideoCodec.Contains("AVC") ? "AVC" : page.VideoQuality.SelectedVideoCodec.Contains("HEVC") ? "HEVC" : page.VideoQuality.SelectedVideoCodec.Contains("Dolby") ? "Dolby Vision" : "")
.SetAvid(page.Avid)
.SetBvid(page.Bvid)
.SetCid(page.Cid);
.SetCid(page.Cid)
.SetUpMid(page.Owner.Mid)
.SetUpName(page.Owner.Name);
string filePath = Path.Combine(directory, fileName.RelativePath());
// 视频类别

@ -83,6 +83,19 @@ namespace DownKyi.Services
Name = name,
Duration = "N/A"
};
// UP主信息
videoPage.Owner = videoView.Owner;
if (videoPage.Owner == null)
{
videoPage.Owner = new Core.BiliApi.Models.VideoOwner
{
Name = "",
Face = "",
Mid = -1,
};
}
videoPages.Add(videoPage);
}

@ -1,4 +1,5 @@
using DownKyi.Core.BiliApi.BiliUtils;
using DownKyi.Core.BiliApi.Models;
using DownKyi.Core.BiliApi.VideoStream.Models;
using DownKyi.Core.Utils;
using Prism.Commands;
@ -16,6 +17,7 @@ namespace DownKyi.ViewModels.PageViewModels
public string Bvid { get; set; }
public long Cid { get; set; }
public long EpisodeId { get; set; }
public VideoOwner Owner { get; set; }
public string FirstFrame { get; set; }

@ -478,6 +478,12 @@ namespace DownKyi.ViewModels.Settings
case FileNamePart.CID:
display = "cid";
break;
case FileNamePart.UP_MID:
display = DictionaryResource.GetString("DisplayUpMid");
break;
case FileNamePart.UP_NAME:
display = DictionaryResource.GetString("DisplayUpName");
break;
}
if (((int)item) >= 100)

Loading…
Cancel
Save