mirror of
https://github.com/oskvr37/tiddl.git
synced 2026-06-13 04:05:08 +03:00
✨ Added video download flag and config (#134)
This commit is contained in:
@@ -87,6 +87,13 @@ from typing import List, Union
|
||||
is_flag=True,
|
||||
help="Embed track lyrics in file metadata.",
|
||||
)
|
||||
@click.option(
|
||||
"--video",
|
||||
"-v",
|
||||
"DOWNLOAD_VIDEO",
|
||||
is_flag=True,
|
||||
help="Enable downloading videos",
|
||||
)
|
||||
@passContext
|
||||
def DownloadCommand(
|
||||
ctx: Context,
|
||||
@@ -96,10 +103,11 @@ def DownloadCommand(
|
||||
THREADS_COUNT: int,
|
||||
DO_NOT_SKIP: bool,
|
||||
SINGLES_FILTER: SinglesFilter,
|
||||
EMBED_LYRICS: bool
|
||||
EMBED_LYRICS: bool,
|
||||
DOWNLOAD_VIDEO: bool
|
||||
):
|
||||
"""Download resources"""
|
||||
|
||||
DOWNLOAD_VIDEO = DOWNLOAD_VIDEO or ctx.obj.config.download.download_video
|
||||
SINGLES_FILTER = SINGLES_FILTER or ctx.obj.config.download.singles_filter
|
||||
EMBED_LYRICS = EMBED_LYRICS or ctx.obj.config.download.embed_lyrics
|
||||
|
||||
@@ -265,7 +273,7 @@ def DownloadCommand(
|
||||
logging.warning(f"Track '{item.title}' skipped")
|
||||
return
|
||||
elif isinstance(item, Video):
|
||||
if path.with_suffix(".mp4").exists():
|
||||
if path.with_suffix(".mp4").exists() or not DOWNLOAD_VIDEO:
|
||||
logging.warning(f"Video '{item.title}' skipped")
|
||||
return
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ class DownloadConfig(BaseModel):
|
||||
threads: int = 4
|
||||
singles_filter: SinglesFilter = "none"
|
||||
embed_lyrics: bool = False
|
||||
download_video: bool = False
|
||||
|
||||
|
||||
class AuthConfig(BaseModel):
|
||||
|
||||
Reference in New Issue
Block a user