feat: add fnOS packaging, storage workflows and release pipeline

This commit is contained in:
2026-08-11 18:05:49 +08:00
parent c5922f9b08
commit 95932f0199
181 changed files with 24024 additions and 1164 deletions
+13 -7
View File
@@ -4,12 +4,13 @@ using dy.net.model.entity;
using dy.net.model.response;
using dy.net.service;
using dy.net.utils;
using dy.net.storage;
namespace dy.net.job
{
public class DouyinFollowedSyncJob : DouyinBasicSyncJob
{
public DouyinFollowedSyncJob(DouyinCookieService douyinCookieService, DouyinHttpClientService douyinHttpClientService, DouyinVideoService douyinVideoService, DouyinCommonService douyinCommonService, DouyinFollowService douyinFollowService, DouyinMergeVideoService douyinMergeVideoService, DouyinCollectCateService douyinCollectCateService) : base(douyinCookieService, douyinHttpClientService, douyinVideoService, douyinCommonService, douyinFollowService, douyinMergeVideoService, douyinCollectCateService)
public DouyinFollowedSyncJob(DouyinCookieService douyinCookieService, DouyinHttpClientService douyinHttpClientService, DouyinVideoService douyinVideoService, DouyinCommonService douyinCommonService, DouyinFollowService douyinFollowService, DouyinMergeVideoService douyinMergeVideoService, DouyinCollectCateService douyinCollectCateService, MediaStorageRouter mediaStorageRouter, VideoTaskService videoTaskService) : base(douyinCookieService, douyinHttpClientService, douyinVideoService, douyinCommonService, douyinFollowService, douyinMergeVideoService, douyinCollectCateService, mediaStorageRouter, videoTaskService)
{
}
@@ -17,7 +18,8 @@ namespace dy.net.job
protected override async Task<List<DouyinCookie>> GetSyncCookies()
{
return await douyinCookieService.GetOpendCookiesAsync(x => !string.IsNullOrWhiteSpace(x.UpSavePath));
var cookies = await douyinCookieService.GetOpendCookiesAsync();
return cookies.Where(x => !string.IsNullOrWhiteSpace(GetStorageRoot(x, VideoType))).ToList();
}
protected override async Task<DouyinVideoInfoResponse> FetchVideoData(DouyinCookie cookie, string cursor, DouyinFollowed followed, DouyinCollectCate cate)
@@ -31,7 +33,7 @@ namespace dy.net.job
//}
protected override string GetAuthorAvatarBasePath(DouyinCookie cookie)
{
return Path.Combine(cookie.UpSavePath, "author");
return CombineStoragePath(GetStorageRoot(cookie, VideoType), "author");
}
/// <summary>
@@ -45,6 +47,8 @@ namespace dy.net.job
/// <returns></returns>
protected override string CreateSaveFolder(DouyinCookie cookie, Aweme item, AppConfig config, DouyinFollowed followed, DouyinCollectCate cate)
{
if (ActiveStorageType.IsRemote())
return BuildRemotePathPlan(cookie, item, config, followed, cate).DirectoryPath;
#region 使UP主名称作为文件夹名称使
// 1. 优先获取有效的作者名称(遵循原有优先级:followed.UperName > item.Author.Nickname > 默认值)
var rawAuthorName = followed?.UperName ?? item?.Author?.Nickname;
@@ -53,15 +57,15 @@ namespace dy.net.job
: DouyinFileNameHelper.SanitizeLinuxFileName(rawAuthorName, "", true);
// 2. 确定最终文件夹路径(遵循原有优先级:followed.SavePath > authorName > 基础路径)
var targetFolderName = !string.IsNullOrWhiteSpace(followed?.SavePath) ? followed.SavePath : authorName;
var rootFolder = Path.Combine(cookie.UpSavePath, targetFolderName);
var rootFolder = CombineStoragePath(GetStorageRoot(cookie, VideoType), targetFolderName);
if (!Directory.Exists(rootFolder)) Directory.CreateDirectory(rootFolder);
EnsureStorageDirectory(rootFolder);
#endregion
var sampleName = DouyinFileNameHelper.SanitizeLinuxFileName(item.Desc, item.AwemeId, true);
var (existingName, _) = douyinVideoService.GetUperLastViedoFileName(item.Author.Uid, sampleName);
var fileNameFolder = string.IsNullOrWhiteSpace(existingName) ? sampleName : existingName;
return Path.Combine(rootFolder, fileNameFolder);
return CombineStoragePath(rootFolder, fileNameFolder);
}
/// <summary>
/// 关注的视频,生成文件名称
@@ -73,6 +77,8 @@ namespace dy.net.job
/// <returns></returns>
protected override string GetVideoFileName(DouyinCookie cookie, Aweme item, AppConfig config, DouyinCollectCate cate)
{
if (ActiveStorageType.IsRemote())
return base.GetVideoFileName(cookie, item, config, cate);
string Format = "mp4";
string FileHash = "";
@@ -136,4 +142,4 @@ namespace dy.net.job
}
}
}