feat: add fnOS packaging, storage workflows and release pipeline
This commit is contained in:
@@ -4,12 +4,13 @@ using dy.net.model.response;
|
||||
using dy.net.service;
|
||||
using dy.net.utils;
|
||||
using System.Threading.Tasks;
|
||||
using dy.net.storage;
|
||||
|
||||
namespace dy.net.job
|
||||
{
|
||||
public class DouyinCollectSyncJob : DouyinBasicSyncJob
|
||||
{
|
||||
public DouyinCollectSyncJob(DouyinCookieService douyinCookieService, DouyinHttpClientService douyinHttpClientService, DouyinVideoService douyinVideoService, DouyinCommonService douyinCommonService, DouyinFollowService douyinFollowService, DouyinMergeVideoService douyinMergeVideoService, DouyinCollectCateService douyinCollectCateService) : base(douyinCookieService, douyinHttpClientService, douyinVideoService, douyinCommonService, douyinFollowService, douyinMergeVideoService, douyinCollectCateService)
|
||||
public DouyinCollectSyncJob(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)
|
||||
{
|
||||
}
|
||||
protected override VideoTypeEnum VideoType => VideoTypeEnum.dy_collects;
|
||||
@@ -27,7 +28,7 @@ namespace dy.net.job
|
||||
|
||||
protected override string GetAuthorAvatarBasePath(DouyinCookie cookie)
|
||||
{
|
||||
return Path.Combine(cookie.SavePath, "author");
|
||||
return CombineStoragePath(GetStorageRoot(cookie, VideoType), "author");
|
||||
}
|
||||
|
||||
protected override async Task<DouyinVideoInfoResponse> FetchVideoData(DouyinCookie cookie, string cursor, DouyinFollowed followed, DouyinCollectCate cate)
|
||||
@@ -40,6 +41,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;
|
||||
// 1. 简化获取博主自定义保存路径(合并空值判断)
|
||||
string saveFolder = !string.IsNullOrWhiteSpace(item?.Author?.Uid)
|
||||
? base.douyinCommonService.GetDouyinUpSavePath(item.Author.Uid)
|
||||
@@ -61,11 +64,12 @@ namespace dy.net.job
|
||||
string videoFolderName = DouyinFileNameHelper.SanitizeLinuxFileName(item?.Desc, item?.AwemeId, true);
|
||||
|
||||
// 4. 简化文件夹路径拼接+存在判断(核心逻辑不变)
|
||||
string folder = Path.Combine(cookie.SavePath, authorFolder, videoFolderName);
|
||||
var root = GetStorageRoot(cookie, VideoType);
|
||||
string folder = CombineStoragePath(root, authorFolder, videoFolderName);
|
||||
if (Directory.Exists(folder))
|
||||
{
|
||||
// 文件夹存在则拼接AwemeId(保留你的原逻辑)
|
||||
folder = Path.Combine(cookie.SavePath, authorFolder, $"{videoFolderName}_{item.AwemeId}");
|
||||
folder = CombineStoragePath(root, authorFolder, $"{videoFolderName}_{item.AwemeId}");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -75,4 +79,4 @@ namespace dy.net.job
|
||||
return folder;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+802
-285
File diff suppressed because it is too large
Load Diff
@@ -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 DouyinCollectCustomSyncJob : DouyinBasicSyncJob
|
||||
{
|
||||
public DouyinCollectCustomSyncJob(DouyinCookieService douyinCookieService, DouyinHttpClientService douyinHttpClientService, DouyinVideoService douyinVideoService, DouyinCommonService douyinCommonService, DouyinFollowService douyinFollowService, DouyinMergeVideoService douyinMergeVideoService, DouyinCollectCateService douyinCollectCateService) : base(douyinCookieService, douyinHttpClientService, douyinVideoService, douyinCommonService, douyinFollowService, douyinMergeVideoService, douyinCollectCateService)
|
||||
public DouyinCollectCustomSyncJob(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)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -16,9 +17,14 @@ 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;
|
||||
if (cate != null)
|
||||
{
|
||||
var folder = Path.Combine(cookie.SavePath, DouyinFileNameHelper.SanitizeLinuxFileName(cate.SaveFolder, "", true), DouyinFileNameHelper.SanitizeLinuxFileName(item.Desc, item.AwemeId, true));
|
||||
var root = GetStorageRoot(cookie, VideoType);
|
||||
var category = DouyinFileNameHelper.SanitizeLinuxFileName(cate.SaveFolder, "", true);
|
||||
var itemFolder = DouyinFileNameHelper.SanitizeLinuxFileName(item.Desc, item.AwemeId, true);
|
||||
var folder = CombineStoragePath(root, category, itemFolder);
|
||||
if (!Directory.Exists(folder))
|
||||
{
|
||||
Directory.CreateDirectory(folder);
|
||||
@@ -27,7 +33,7 @@ namespace dy.net.job
|
||||
{
|
||||
//说明文件夹存在,检查里面有没有文件,如果已经有视频文件了,说明视频标题相同,那么应该重新创建文件夹,+id
|
||||
|
||||
folder = Path.Combine(cookie.SavePath, DouyinFileNameHelper.SanitizeLinuxFileName(cate.SaveFolder, "", true), DouyinFileNameHelper.SanitizeLinuxFileName(item.Desc, item.AwemeId, true)+"_"+item.AwemeId);
|
||||
folder = CombineStoragePath(root, category, itemFolder + "_" + item.AwemeId);
|
||||
}
|
||||
return folder;
|
||||
}
|
||||
@@ -38,7 +44,7 @@ namespace dy.net.job
|
||||
}
|
||||
protected override string GetAuthorAvatarBasePath(DouyinCookie cookie)
|
||||
{
|
||||
return Path.Combine(cookie.SavePath, "author");
|
||||
return CombineStoragePath(GetStorageRoot(cookie, VideoType), "author");
|
||||
}
|
||||
|
||||
protected override async Task<DouyinVideoInfoResponse> FetchVideoData(DouyinCookie cookie, string cursor, DouyinFollowed followed, DouyinCollectCate cate)
|
||||
@@ -53,4 +59,4 @@ namespace dy.net.job
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace dy.net.job
|
||||
private readonly DouyinHttpClientService _douyinService;
|
||||
private readonly DouyinFollowService _followService;
|
||||
private readonly DouyinCommonService _douyinCommonService;
|
||||
private readonly DouyinLiveStatusService _douyinLiveStatusService;
|
||||
|
||||
// 常量定义
|
||||
private const string DEFAULT_FOLLOW_COUNT = "20";
|
||||
@@ -31,13 +32,15 @@ namespace dy.net.job
|
||||
DouyinHttpClientService douyinService,
|
||||
DouyinFollowService followService,
|
||||
DouyinCommonService douyinCommonService,
|
||||
DouyinCollectCateService douyinCollectCateService)
|
||||
DouyinCollectCateService douyinCollectCateService,
|
||||
DouyinLiveStatusService douyinLiveStatusService)
|
||||
{
|
||||
_dyCookieService = dyCookieService;
|
||||
_douyinService = douyinService;
|
||||
_followService = followService;
|
||||
_douyinCommonService = douyinCommonService;
|
||||
_douyinCollectCateService = douyinCollectCateService;
|
||||
_douyinLiveStatusService = douyinLiveStatusService;
|
||||
}
|
||||
|
||||
public async Task Execute(IJobExecutionContext context)
|
||||
@@ -239,6 +242,7 @@ namespace dy.net.job
|
||||
if (followList.Any())
|
||||
{
|
||||
var (add, update, succ) = await _followService.Sync(followList, cookie);
|
||||
await _douyinLiveStatusService.ApplyFollowListStatusesAsync(followList, cookie);
|
||||
Log.Debug($"[{cookie.UserName}][{LOG_TAG_FOLLOW}]同步完成 新增:{add} 更新:{update} 成功:{succ} 总关注数:{total},这是同步关注列表,这不是同步视频!!!");
|
||||
}
|
||||
await _douyinCommonService.SetConfigNotFirstRunning();
|
||||
@@ -250,4 +254,4 @@ namespace dy.net.job
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using dy.net.service;
|
||||
using Quartz;
|
||||
|
||||
namespace dy.net.job
|
||||
{
|
||||
[DisallowConcurrentExecution]
|
||||
public sealed class DouyinLiveStatusJob : IJob
|
||||
{
|
||||
private readonly DouyinLiveStatusService _service;
|
||||
|
||||
public DouyinLiveStatusJob(DouyinLiveStatusService service) => _service = service;
|
||||
|
||||
public Task Execute(IJobExecutionContext context) =>
|
||||
_service.RefreshDueAsync(context.CancellationToken);
|
||||
}
|
||||
}
|
||||
+15
-20
@@ -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 DouyinMixSyncJob : DouyinBasicSyncJob
|
||||
{
|
||||
public DouyinMixSyncJob(DouyinCookieService douyinCookieService, DouyinHttpClientService douyinHttpClientService, DouyinVideoService douyinVideoService, DouyinCommonService douyinCommonService, DouyinFollowService douyinFollowService, DouyinMergeVideoService douyinMergeVideoService, DouyinCollectCateService douyinCollectCateService) : base(douyinCookieService, douyinHttpClientService, douyinVideoService, douyinCommonService, douyinFollowService, douyinMergeVideoService, douyinCollectCateService)
|
||||
public DouyinMixSyncJob(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)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -23,24 +24,22 @@ namespace dy.net.job
|
||||
|
||||
protected override Task<List<DouyinCookie>> GetSyncCookies()
|
||||
{
|
||||
return douyinCookieService.GetOpendCookiesAsync(x => !string.IsNullOrWhiteSpace(x.MixPath));
|
||||
return GetCookiesWithPathAsync();
|
||||
}
|
||||
private async Task<List<DouyinCookie>> GetCookiesWithPathAsync()
|
||||
{
|
||||
var cookies = await douyinCookieService.GetOpendCookiesAsync();
|
||||
return cookies.Where(x => !string.IsNullOrWhiteSpace(GetStorageRoot(x, VideoType))).ToList();
|
||||
}
|
||||
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;
|
||||
if (cate != null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(cookie.MixPath))
|
||||
{
|
||||
var folder = Path.Combine(cookie.SavePath, VideoType.GetDesc(), DouyinFileNameHelper.SanitizeLinuxFileName(cate.SaveFolder, cate.Name, true));
|
||||
if (!Directory.Exists(folder)) Directory.CreateDirectory(folder);
|
||||
return folder;
|
||||
}
|
||||
else
|
||||
{
|
||||
var folder = Path.Combine(cookie.MixPath, DouyinFileNameHelper.SanitizeLinuxFileName(cate.SaveFolder, cate.Name, true));
|
||||
if (!Directory.Exists(folder)) Directory.CreateDirectory(folder);
|
||||
return folder;
|
||||
}
|
||||
var folder = CombineStoragePath(GetStorageRoot(cookie, VideoType), DouyinFileNameHelper.SanitizeLinuxFileName(cate.SaveFolder, cate.Name, true));
|
||||
EnsureStorageDirectory(folder);
|
||||
return folder;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -50,11 +49,7 @@ namespace dy.net.job
|
||||
|
||||
protected override string GetAuthorAvatarBasePath(DouyinCookie cookie)
|
||||
{
|
||||
if (string.IsNullOrEmpty(cookie.MixPath))
|
||||
|
||||
return Path.Combine(cookie.SavePath, "author");
|
||||
else
|
||||
return Path.Combine(cookie.MixPath, "author");
|
||||
return CombineStoragePath(GetStorageRoot(cookie, VideoType), "author");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+15
-20
@@ -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 DouyinSeriesSyncJob : DouyinBasicSyncJob
|
||||
{
|
||||
public DouyinSeriesSyncJob(DouyinCookieService douyinCookieService, DouyinHttpClientService douyinHttpClientService, DouyinVideoService douyinVideoService, DouyinCommonService douyinCommonService, DouyinFollowService douyinFollowService, DouyinMergeVideoService douyinMergeVideoService, DouyinCollectCateService douyinCollectCateService) : base(douyinCookieService, douyinHttpClientService, douyinVideoService, douyinCommonService, douyinFollowService, douyinMergeVideoService, douyinCollectCateService)
|
||||
public DouyinSeriesSyncJob(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)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -22,24 +23,22 @@ namespace dy.net.job
|
||||
|
||||
protected override Task<List<DouyinCookie>> GetSyncCookies()
|
||||
{
|
||||
return douyinCookieService.GetOpendCookiesAsync(x => !string.IsNullOrWhiteSpace(x.SeriesPath));
|
||||
return GetCookiesWithPathAsync();
|
||||
}
|
||||
private async Task<List<DouyinCookie>> GetCookiesWithPathAsync()
|
||||
{
|
||||
var cookies = await douyinCookieService.GetOpendCookiesAsync();
|
||||
return cookies.Where(x => !string.IsNullOrWhiteSpace(GetStorageRoot(x, VideoType))).ToList();
|
||||
}
|
||||
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;
|
||||
if (cate != null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(cookie.SeriesPath))
|
||||
{
|
||||
var folder = Path.Combine(cookie.SavePath, VideoType.GetDesc(), DouyinFileNameHelper.SanitizeLinuxFileName(cate.SaveFolder, cate.Name, true));
|
||||
if (!Directory.Exists(folder)) Directory.CreateDirectory(folder);
|
||||
return folder;
|
||||
}
|
||||
else
|
||||
{
|
||||
var folder = Path.Combine(cookie.SeriesPath, DouyinFileNameHelper.SanitizeLinuxFileName(cate.SaveFolder, cate.Name, true));
|
||||
if (!Directory.Exists(folder)) Directory.CreateDirectory(folder);
|
||||
return folder;
|
||||
}
|
||||
var folder = CombineStoragePath(GetStorageRoot(cookie, VideoType), DouyinFileNameHelper.SanitizeLinuxFileName(cate.SaveFolder, cate.Name, true));
|
||||
EnsureStorageDirectory(folder);
|
||||
return folder;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -49,11 +48,7 @@ namespace dy.net.job
|
||||
|
||||
protected override string GetAuthorAvatarBasePath(DouyinCookie cookie)
|
||||
{
|
||||
if (string.IsNullOrEmpty(cookie.SeriesPath))
|
||||
|
||||
return Path.Combine(cookie.SavePath, "author");
|
||||
else
|
||||
return Path.Combine(cookie.SeriesPath, "author");
|
||||
return CombineStoragePath(GetStorageRoot(cookie, VideoType), "author");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user