Skip to content

Commit

Permalink
发布v1.5.0-alpha2
Browse files Browse the repository at this point in the history
  • Loading branch information
leiurayer committed Mar 6, 2022
1 parent 9b320cf commit cf41095
Show file tree
Hide file tree
Showing 24 changed files with 301 additions and 56 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# 更新日志

* `2022/03/07` v1.5.0-alpha2
1. [优化] 重构程序架构,解决一些已知问题。
2. [优化] 界面UI的显示与操作。
3. [新增] 文件命名格式:avid、bvid、cid、UP主信息、视频发布时间。
4. [修复] 视频音质列表导致的闪退问题。
5. [修复] 图片下载导致的闪退问题。

* `2022/03/05` v1.5.0-alpha1
1. [优化] 重构程序架构,解决一些已知问题。
2. [新增] 最高支持8K视频。
Expand Down
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,19 @@

[全部更新日志](CHANGELOG.md)

* `2022/03/05` v1.5.0-alpha1
* `2022/03/07` v1.5.0-alpha2
1. [优化] 重构程序架构,解决一些已知问题。
2. [新增] 最高支持8K视频。
3. [新增] 支持杜比全景声和杜比视界。
4. [新增] 支持字幕下载。
5. [新增] 支持部分短链接(如 https://b23.tv/BV17x411w7KC )。
6. [新增] 下载内容可选,可根据需要选择下载视频、音频、弹幕、字幕、封面。
7. [新增] 下载文件命名模块,可自主设置文件名。
2. [优化] 界面UI的显示与操作。
3. [新增] 文件命名格式:avid、bvid、cid、UP主信息、视频发布时间。
4. [修复] 视频音质列表导致的闪退问题。
5. [修复] 图片下载导致的闪退问题。

## 下载

- [哔哩下载姬最新版](https://github.com/FlySelfLog/downkyi/releases/download/v1.5.0-alpha1/DownKyi-1.5.0-alpha1.zip)
- [哔哩下载姬最新版](https://github.com/FlySelfLog/downkyi/releases/download/v1.5.0-alpha2/DownKyi-1.5.0-alpha2.zip)

- [下载页面](https://github.com/FlySelfLog/downkyi/releases)


## 赞助

如果这个项目对您有很大帮助,并且您希望支持该项目的开发和维护,请随时扫描一下二维码进行捐赠。非常感谢您的捐款,谢谢!
Expand Down
10 changes: 8 additions & 2 deletions src/DownKyi.Core/BiliApi/BiliUtils/Constant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ public static class Constant
/// <returns></returns>
public static List<Quality> GetResolutions()
{
return resolutions;
// 使用深复制,
// 保证外部修改list后,
// 不会影响其他调用处
return new List<Quality>(resolutions);
}

/// <summary>
Expand All @@ -42,7 +45,10 @@ public static List<Quality> GetResolutions()
/// <returns></returns>
public static List<Quality> GetAudioQualities()
{
return qualities;
// 使用深复制,
// 保证外部修改list后,
// 不会影响其他调用处
return new List<Quality>(qualities);
}

}
Expand Down
4 changes: 2 additions & 2 deletions src/DownKyi.Core/BiliApi/BiliUtils/ParseEntrance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ namespace DownKyi.Core.BiliApi.BiliUtils
/// 解析输入的字符串<para/>
/// 支持的格式有:<para/>
/// av号:av170001, AV170001, https://www.bilibili.com/video/av170001 <para/>
/// BV号:BV17x411w7KC, https://www.bilibili.com/video/BV17x411w7KC <para/>
/// BV号:BV17x411w7KC, https://www.bilibili.com/video/BV17x411w7KC, https://b23.tv/BV17x411w7KC <para/>
/// 番剧(电影、电视剧)ss号:ss32982, SS32982, https://www.bilibili.com/bangumi/play/ss32982 <para/>
/// 番剧(电影、电视剧)ep号:ep317925, EP317925, https://www.bilibili.com/bangumi/play/ep317925 <para/>
/// 番剧(电影、电视剧)md号:md28228367, MD28228367, https://www.bilibili.com/bangumi/media/md28228367 <para/>
/// 课程ss号:https://www.bilibili.com/cheese/play/ss205 <para/>
/// 课程ep号:https://www.bilibili.com/cheese/play/ep3489 <para/>
/// 收藏夹:ml1329019876, ML1329019876, https://www.bilibili.com/medialist/detail/ml1329019876 <para/>
/// 收藏夹:ml1329019876, ML1329019876, https://www.bilibili.com/medialist/detail/ml1329019876, https://www.bilibili.com/medialist/play/ml1329019876/ <para/>
/// 用户空间:uid928123, UID928123, uid:928123, UID:928123, https://space.bilibili.com/928123
/// </summary>
public static class ParseEntrance
Expand Down
63 changes: 63 additions & 0 deletions src/DownKyi.Core/FileName/FileName.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ public class FileName
private string videoQuality = "VIDEO_QUALITY";
private string videoCodec = "VIDEO_CODEC";

private string videoPublishTime = "VIDEO_PUBLISH_TIME";

private long avid = -1;
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;
Expand Down Expand Up @@ -73,6 +82,42 @@ public FileName SetVideoCodec(string videoCodec)
return this;
}

public FileName SetVideoPublishTime(string videoPublishTime)
{
this.videoPublishTime = videoPublishTime;
return this;
}

public FileName SetAvid(long avid)
{
this.avid = avid;
return this;
}

public FileName SetBvid(string bvid)
{
this.bvid = bvid;
return this;
}

public FileName SetCid(long cid)
{
this.cid = cid;
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;
Expand Down Expand Up @@ -112,6 +157,24 @@ public string RelativePath()
case FileNamePart.VIDEO_CODEC:
path += videoCodec;
break;
case FileNamePart.VIDEO_PUBLISH_TIME:
path += videoPublishTime;
break;
case FileNamePart.AVID:
path += avid;
break;
case FileNamePart.BVID:
path += bvid;
break;
case FileNamePart.CID:
path += cid;
break;
case FileNamePart.UP_MID:
path += upMid;
break;
case FileNamePart.UP_NAME:
path += upName;
break;
}

if (((int)part) >= 100)
Expand Down
9 changes: 9 additions & 0 deletions src/DownKyi.Core/FileName/FileNamePart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ public enum FileNamePart
VIDEO_QUALITY,
VIDEO_CODEC,

VIDEO_PUBLISH_TIME,

AVID,
BVID,
CID,

UP_MID,
UP_NAME,

// 斜杠
SLASH = 100,

Expand Down
10 changes: 6 additions & 4 deletions src/DownKyi.Core/Storage/StorageCover.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,14 @@ private string DownloadImage(string url)
{
string destFile = $"{StorageManager.GetCover()}/{md5}";

// 如果不存在
if (!File.Exists(destFile))
try
{
// 移动到指定位置
File.Move(localFile, destFile);
File.Delete(destFile);
}
catch { }

// 移动到指定位置
File.Move(localFile, destFile);

return md5;
}
Expand Down
15 changes: 13 additions & 2 deletions src/DownKyi.Core/Storage/StorageHeader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class StorageHeader
public BitmapImage GetHeaderThumbnail(long mid, string name, string url, int width, int height)
{
string header = GetHeader(mid, name, url);
if(header == null) { return null; }
if (header == null) { return null; }

return GetHeaderThumbnail(header, width, height);
}
Expand All @@ -42,6 +42,8 @@ public BitmapImage GetHeaderThumbnail(long mid, string name, string url, int wid
/// <returns></returns>
public BitmapImage GetHeaderThumbnail(string header, int width, int height)
{
if (header == null) { return null; }

var bitmap = new Bitmap(header);
var thumbnail = bitmap.GetThumbnailImage(width, height, null, IntPtr.Zero);

Expand Down Expand Up @@ -141,7 +143,16 @@ private string DownloadImage(string url)

if (File.Exists(localFile))
{
File.Move(localFile, $"{StorageManager.GetHeader()}/{md5}");
string destFile = $"{StorageManager.GetHeader()}/{md5}";

try
{
File.Delete(destFile);
}
catch { }

// 移动到指定位置
File.Move(localFile, destFile);

return md5;
}
Expand Down
3 changes: 3 additions & 0 deletions src/DownKyi/Languages/Default.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,10 @@
<system:String x:Key="DisplayAudioQuality">音质</system:String>
<system:String x:Key="DisplayVideoQuality">画质</system:String>
<system:String x:Key="DisplayVideoCodec">视频编码</system:String>
<system:String x:Key="DisplayVideoPublishTime">视频发布时间</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>
Expand Down
6 changes: 3 additions & 3 deletions src/DownKyi/Models/AppInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
public class AppInfo
{
public string Name { get; } = "哔哩下载姬";
public int VersionCode { get; } = 500;
public int VersionCode { get; } = 501;

#if DEBUG
public string VersionName { get; } = "1.5.0-alpha1 Debug";
public string VersionName { get; } = "1.5.0-alpha2 Debug";
#else
public string VersionName { get; } = "1.5.0-alpha1";
public string VersionName { get; } = "1.5.0-alpha2";
#endif

}
Expand Down
26 changes: 26 additions & 0 deletions src/DownKyi/Services/BangumiInfoService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,32 @@ public List<VideoPage> GetVideoPages()
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,
};
}

// 视频发布时间
DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区
DateTime dateTime = startTime.AddSeconds(episode.PubTime);
page.PublishTime = dateTime.ToString("yyyy-MM-dd");

pages.Add(page);
}

Expand Down
26 changes: 26 additions & 0 deletions src/DownKyi/Services/CheeseInfoService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,32 @@ public List<VideoPage> GetVideoPages()
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,
};
}

// 视频发布时间
DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区
DateTime dateTime = startTime.AddSeconds(episode.ReleaseDate);
page.PublishTime = dateTime.ToString("yyyy-MM-dd");

pages.Add(page);
}

Expand Down
8 changes: 7 additions & 1 deletion src/DownKyi/Services/Download/AddToDownloadService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,13 @@ public int AddToDownload(IEventAggregator eventAggregator, string directory)
.SetVideoZone(videoInfoView.VideoZone.Split('>')[0])
.SetAudioQuality(page.AudioQualityFormat)
.SetVideoQuality(page.VideoQuality == null ? "" : page.VideoQuality.QualityFormat)
.SetVideoCodec(page.VideoQuality == null ? "" : page.VideoQuality.SelectedVideoCodec.Contains("AVC") ? "AVC" : page.VideoQuality.SelectedVideoCodec.Contains("HEVC") ? "HEVC" : page.VideoQuality.SelectedVideoCodec.Contains("Dolby") ? "Dolby Vision" : "");
.SetVideoCodec(page.VideoQuality == null ? "" : page.VideoQuality.SelectedVideoCodec.Contains("AVC") ? "AVC" : page.VideoQuality.SelectedVideoCodec.Contains("HEVC") ? "HEVC" : page.VideoQuality.SelectedVideoCodec.Contains("Dolby") ? "Dolby Vision" : "")
.SetVideoPublishTime(page.PublishTime)
.SetAvid(page.Avid)
.SetBvid(page.Bvid)
.SetCid(page.Cid)
.SetUpMid(page.Owner.Mid)
.SetUpName(page.Owner.Name);
string filePath = Path.Combine(directory, fileName.RelativePath());

// 视频类别
Expand Down
2 changes: 1 addition & 1 deletion src/DownKyi/Services/SearchService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class SearchService
/// 解析支持的输入,
/// 支持的格式有:<para/>
/// av号:av170001, AV170001, https://www.bilibili.com/video/av170001 <para/>
/// BV号:BV17x411w7KC, https://www.bilibili.com/video/BV17x411w7KC <para/>
/// BV号:BV17x411w7KC, https://www.bilibili.com/video/BV17x411w7KC, https://b23.tv/BV17x411w7KC <para/>
/// 番剧(电影、电视剧)ss号:ss32982, SS32982, https://www.bilibili.com/bangumi/play/ss32982 <para/>
/// 番剧(电影、电视剧)ep号:ep317925, EP317925, https://www.bilibili.com/bangumi/play/ep317925 <para/>
/// 番剧(电影、电视剧)md号:md28228367, MD28228367, https://www.bilibili.com/bangumi/media/md28228367 <para/>
Expand Down
Loading

0 comments on commit cf41095

Please sign in to comment.