Skip to content

Commit

Permalink
Merge pull request #14 from kctekn/master
Browse files Browse the repository at this point in the history
必要更新
  • Loading branch information
K12f authored Jan 16, 2025
2 parents befe0d4 + 2e14323 commit 20af65b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/BlueCatKoKo.Ui/Models/VideoModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,6 @@ public class VideoModel

// 视频时长
public string? Duration { get; set; }

public string? ShareId { get; set; }
}
12 changes: 9 additions & 3 deletions src/BlueCatKoKo.Ui/ViewModels/Pages/HomeViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ private async Task Parse()
{
var downloadUrl = await _douYinShortVideoService.ExtractUrlAsync(DownloadUrlText);
Data = await _douYinShortVideoService.ExtractVideoDataAsync(downloadUrl);
Data.ShareId = downloadUrl.Replace("https://v.douyin.com/", "").Replace("/", "");
}
else if (DownloadUrlText.Contains(ShortVideoPlatformEnum.KuaiShou.ToString().ToLower()))
{
Expand Down Expand Up @@ -145,7 +146,8 @@ private async Task Parse()

[RelayCommand]
private void PlayOrPauseVideo()
{
{
MediaPlayer.AspectRatio = null;
if (!MediaPlayer.IsPlaying)
{
MediaPlayer.Play();
Expand Down Expand Up @@ -177,11 +179,15 @@ private async Task DownloadAll()
}

var filepath = _appConfig.Value.DownloadPath;
var filename = "#" + Data.AuthorName + "#" + Data.UniqueId + "# " + Data.Desc;
filename = filename.Substring(0, Math.Min(250, ("#" + Data.AuthorName + "#" + Data.UniqueId + "# " + Data.Desc).Length))+".mp4";
var filename = "#" + Data.AuthorName + "#" + Data.UniqueId + "#" + Data.ShareId + "# " + Data.Desc;
filename = filename.Substring(0, Math.Min(200, (filename).Length))+".mp4";

var replaceFilename = filename.ReplaceInvalidCharacters();

if(File.Exists(filepath+replaceFilename) ){
throw new ValidationException("文件已存在");
}

switch (Data.Platform)
{
case ShortVideoPlatformEnum.DouYin:
Expand Down

0 comments on commit 20af65b

Please sign in to comment.