mirror of
https://git.vectorsigma.ru/public/tubearchivist.git
synced 2026-08-04 18:09:33 +00:00
fix add to ignore from existing video, #1023
This commit is contained in:
@@ -21,6 +21,7 @@ from common.src.helper import (
|
|||||||
rand_sleep,
|
rand_sleep,
|
||||||
)
|
)
|
||||||
from common.src.ta_redis import RedisQueue
|
from common.src.ta_redis import RedisQueue
|
||||||
|
from common.src.urlparser import ParsedURLType
|
||||||
from download.src.queue import PendingList
|
from download.src.queue import PendingList
|
||||||
from download.src.yt_dlp_base import YtWrap
|
from download.src.yt_dlp_base import YtWrap
|
||||||
from playlist.src.index import YoutubePlaylist
|
from playlist.src.index import YoutubePlaylist
|
||||||
@@ -347,7 +348,7 @@ class DownloadPostProcess(DownloaderBase):
|
|||||||
self._auto_delete_watched(data)
|
self._auto_delete_watched(data)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _auto_delete_watched(data):
|
def _auto_delete_watched(data) -> None:
|
||||||
"""delete watched videos after x days"""
|
"""delete watched videos after x days"""
|
||||||
to_delete = IndexPaginate("ta_video", data).get_results()
|
to_delete = IndexPaginate("ta_video", data).get_results()
|
||||||
if not to_delete:
|
if not to_delete:
|
||||||
@@ -359,8 +360,20 @@ class DownloadPostProcess(DownloaderBase):
|
|||||||
YoutubeVideo(youtube_id).delete_media_file()
|
YoutubeVideo(youtube_id).delete_media_file()
|
||||||
|
|
||||||
print("add deleted to ignore list")
|
print("add deleted to ignore list")
|
||||||
vids = [{"type": "video", "url": i["youtube_id"]} for i in to_delete]
|
|
||||||
PendingList(youtube_ids=vids).parse_url_list(status="ignore")
|
parsed_ids: list[ParsedURLType] = []
|
||||||
|
|
||||||
|
for video_item in to_delete:
|
||||||
|
vid_type = getattr(VideoTypeEnum, video_item["vid_type"].upper())
|
||||||
|
parsed_ids.append(
|
||||||
|
{
|
||||||
|
"type": "video",
|
||||||
|
"url": video_item["youtube_id"],
|
||||||
|
"vid_type": vid_type,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
PendingList(youtube_ids=parsed_ids).parse_url_list(status="ignore")
|
||||||
|
|
||||||
def refresh_playlist(self) -> None:
|
def refresh_playlist(self) -> None:
|
||||||
"""match videos with playlists"""
|
"""match videos with playlists"""
|
||||||
|
|||||||
Reference in New Issue
Block a user