feat(event): add source tracking in download event

This commit is contained in:
InfinityPacer
2024-12-10 18:50:50 +08:00
parent eea8060182
commit 6d9595b643
3 changed files with 27 additions and 5 deletions
+20 -2
View File
@@ -391,6 +391,15 @@ class SubscribeChain(ChainBase, metaclass=Singleton):
continue
# 自动下载
source_keyword = {
'id': subscribe.id,
'name': subscribe.name,
'year': subscribe.year,
'type': subscribe.type,
'season': subscribe.season,
'tmdbid': subscribe.tmdbid
}
source = f"Subscribe|{source_keyword}"
downloads, lefts = self.downloadchain.batch_download(
contexts=matched_contexts,
no_exists=no_exists,
@@ -399,7 +408,7 @@ class SubscribeChain(ChainBase, metaclass=Singleton):
save_path=subscribe.save_path,
media_category=subscribe.media_category,
downloader=subscribe.downloader,
source="Subscribe"
source=source
)
# 判断是否应完成订阅
@@ -784,6 +793,15 @@ class SubscribeChain(ChainBase, metaclass=Singleton):
# 开始批量择优下载
logger.info(f'{mediainfo.title_year} 匹配完成,共匹配到{len(_match_context)}个资源')
source_keyword = {
'id': subscribe.id,
'name': subscribe.name,
'year': subscribe.year,
'type': subscribe.type,
'season': subscribe.season,
'tmdbid': subscribe.tmdbid
}
source = f"Subscribe|{source_keyword}"
downloads, lefts = self.downloadchain.batch_download(contexts=_match_context,
no_exists=no_exists,
userid=subscribe.username,
@@ -791,7 +809,7 @@ class SubscribeChain(ChainBase, metaclass=Singleton):
save_path=subscribe.save_path,
media_category=subscribe.media_category,
downloader=subscribe.downloader,
source="Subscribe")
source=source)
# 判断是否要完成订阅
self.finish_subscribe_or_not(subscribe=subscribe, meta=meta, mediainfo=mediainfo,
downloads=downloads, lefts=lefts)