feat: add fnOS packaging, storage workflows and release pipeline
This commit is contained in:
@@ -3,12 +3,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 DouyinFavoritSyncJob : DouyinBasicSyncJob
|
||||
{
|
||||
public DouyinFavoritSyncJob(DouyinCookieService douyinCookieService, DouyinHttpClientService douyinHttpClientService, DouyinVideoService douyinVideoService, DouyinCommonService douyinCommonService, DouyinFollowService douyinFollowService, DouyinMergeVideoService douyinMergeVideoService, DouyinCollectCateService douyinCollectCateService) : base(douyinCookieService, douyinHttpClientService, douyinVideoService, douyinCommonService, douyinFollowService, douyinMergeVideoService, douyinCollectCateService)
|
||||
public DouyinFavoritSyncJob(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,12 +18,13 @@ namespace dy.net.job
|
||||
|
||||
protected override string GetAuthorAvatarBasePath(DouyinCookie cookie)
|
||||
{
|
||||
return Path.Combine(cookie.FavSavePath, "author");
|
||||
return CombineStoragePath(GetStorageRoot(cookie, VideoType), "author");
|
||||
}
|
||||
|
||||
protected override async Task<List<DouyinCookie>> GetSyncCookies()
|
||||
{
|
||||
return await douyinCookieService.GetOpendCookiesAsync(x => !string.IsNullOrWhiteSpace(x.FavSavePath) && !string.IsNullOrWhiteSpace(x.SecUserId));
|
||||
var cookies = await douyinCookieService.GetOpendCookiesAsync();
|
||||
return cookies.Where(x => !string.IsNullOrWhiteSpace(GetStorageRoot(x, VideoType)) && !string.IsNullOrWhiteSpace(x.SecUserId)).ToList();
|
||||
}
|
||||
|
||||
protected override async Task<DouyinVideoInfoResponse> FetchVideoData(DouyinCookie cookie, string cursor, DouyinFollowed followed, DouyinCollectCate cate)
|
||||
@@ -45,6 +47,8 @@ namespace dy.net.job
|
||||
|
||||
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;
|
||||
string authorFolder;
|
||||
if (string.IsNullOrWhiteSpace(item.Author?.Nickname) && string.IsNullOrWhiteSpace(item.Author?.Uid))
|
||||
{
|
||||
@@ -54,7 +58,9 @@ namespace dy.net.job
|
||||
{
|
||||
authorFolder = $"{DouyinFileNameHelper.SanitizeLinuxFileName(item.Author?.Nickname, item.Author?.Uid, true)}";
|
||||
}
|
||||
var folder = Path.Combine(cookie.FavSavePath, authorFolder, $"{DouyinFileNameHelper.SanitizeLinuxFileName(item.Desc, item.AwemeId, true)}");
|
||||
var root = GetStorageRoot(cookie, VideoType);
|
||||
var videoFolder = DouyinFileNameHelper.SanitizeLinuxFileName(item.Desc, item.AwemeId, true);
|
||||
var folder = CombineStoragePath(root, authorFolder, videoFolder);
|
||||
if (!Directory.Exists(folder))
|
||||
{
|
||||
Directory.CreateDirectory(folder);
|
||||
@@ -63,9 +69,9 @@ namespace dy.net.job
|
||||
{
|
||||
//说明文件夹存在,检查里面有没有文件,如果已经有视频文件了,说明视频标题相同,那么应该重新创建文件夹,+id
|
||||
|
||||
folder = Path.Combine(cookie.SavePath, authorFolder, $"{DouyinFileNameHelper.SanitizeLinuxFileName(item.Desc, item.AwemeId, true)}" + "_" + item.AwemeId);
|
||||
folder = CombineStoragePath(root, authorFolder, videoFolder + "_" + item.AwemeId);
|
||||
}
|
||||
return folder;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user