mirror of
https://github.com/anasty17/mirror-leech-telegram-bot.git
synced 2025-01-08 12:07:33 +08:00
Add -doc and -med args for leech type to use them as task option
- Force thumbnail layout on yt-dlp videos Signed-off-by: anasty17 <e.anastayyar@gmail.com>
This commit is contained in:
parent
d807af67ed
commit
7716e3cfc1
@ -36,7 +36,7 @@ programming in Python.
|
||||
- Split size (global, user, and task option)
|
||||
- Thumbnail (user and task option)
|
||||
- Leech filename prefix (user option)
|
||||
- Set upload as a document or as media (global and user option)
|
||||
- Set upload as a document or as media (global, user and task option)
|
||||
- Upload all files to a specific chat (superGroup/channel/private/topic) (global, user, and task option)
|
||||
- Equal split size settings (global and user option)
|
||||
- Ability to leech split file parts in a media group (global and user option)
|
||||
|
@ -111,12 +111,13 @@ class TaskConfig:
|
||||
self.convert_audio = False
|
||||
self.convert_video = False
|
||||
self.screen_shots = False
|
||||
self.as_doc = False
|
||||
self.is_cancelled = False
|
||||
self.force_run = False
|
||||
self.force_download = False
|
||||
self.force_upload = False
|
||||
self.is_torrent = False
|
||||
self.as_med = False
|
||||
self.as_doc = False
|
||||
self.chat_thread_id = None
|
||||
self.suproc = None
|
||||
self.thumb = None
|
||||
@ -357,11 +358,12 @@ class TaskConfig:
|
||||
)
|
||||
self.split_size = min(self.split_size, self.max_split_size)
|
||||
|
||||
self.as_doc = (
|
||||
self.user_dict.get("as_doc", False)
|
||||
or config_dict["AS_DOCUMENT"]
|
||||
and "as_doc" not in self.user_dict
|
||||
)
|
||||
if not self.as_doc:
|
||||
self.as_doc = not self.as_med if self.as_med else (
|
||||
self.user_dict.get("as_doc", False)
|
||||
or config_dict["AS_DOCUMENT"]
|
||||
and "as_doc" not in self.user_dict
|
||||
)
|
||||
|
||||
self.thumbnail_layout = (
|
||||
self.thumbnail_layout
|
||||
|
@ -102,6 +102,8 @@ def arg_parser(items, arg_base):
|
||||
"-fu",
|
||||
"-sync",
|
||||
"-ml",
|
||||
"-doc",
|
||||
"-med"
|
||||
}
|
||||
t = len(items)
|
||||
i = 0
|
||||
@ -115,7 +117,7 @@ def arg_parser(items, arg_base):
|
||||
if (
|
||||
i + 1 == t
|
||||
and part in bool_arg_set
|
||||
or part in ["-s", "-j", "-f", "-fd", "-fu", "-sync", "-ml"]
|
||||
or part in ["-s", "-j", "-f", "-fd", "-fu", "-sync", "-ml", "-doc", "-med"]
|
||||
):
|
||||
arg_base[part] = True
|
||||
else:
|
||||
|
@ -210,6 +210,10 @@ mixed_leech = """Mixed leech: -ml
|
||||
thumbnail_layout = """Thumbnail Layout: -tl
|
||||
/cmd link -tl 3x3 (widthxheight) 3 photos in row and 3 photos in column"""
|
||||
|
||||
leech_as = """<b>Leech as</b>: -doc -med
|
||||
/cmd link -doc (Leech as document)
|
||||
/cmd link -med (Leech as media)"""
|
||||
|
||||
YT_HELP_DICT = {
|
||||
"main": yt,
|
||||
"New-Name": f"{new_name}\nNote: Don't add file extension",
|
||||
@ -229,6 +233,8 @@ YT_HELP_DICT = {
|
||||
"Force-Start": force_start,
|
||||
"Name-Substitute": name_sub,
|
||||
"Mixed-Leech": mixed_leech,
|
||||
"Thumbnail-Layout": thumbnail_layout,
|
||||
"Leech-Type": leech_as,
|
||||
}
|
||||
|
||||
MIRROR_HELP_DICT = {
|
||||
@ -257,6 +263,7 @@ MIRROR_HELP_DICT = {
|
||||
"Name-Substitute": name_sub,
|
||||
"Mixed-Leech": mixed_leech,
|
||||
"Thumbnail-Layout": thumbnail_layout,
|
||||
"Leech-Type": leech_as,
|
||||
}
|
||||
|
||||
CLONE_HELP_DICT = {
|
||||
|
@ -274,7 +274,7 @@ class YoutubeDLHelper:
|
||||
if qual.startswith("ba/b"):
|
||||
self._listener.name = f"{base_name}{self._ext}"
|
||||
|
||||
if self._listener.is_leech:
|
||||
if self._listener.is_leech and not self._listener.thumbnail_layout:
|
||||
self.opts["postprocessors"].append(
|
||||
{
|
||||
"format": "jpg",
|
||||
@ -296,7 +296,9 @@ class YoutubeDLHelper:
|
||||
]:
|
||||
self.opts["postprocessors"].append(
|
||||
{
|
||||
"already_have_thumbnail": self._listener.is_leech,
|
||||
"already_have_thumbnail": bool(
|
||||
self._listener.is_leech and not self._listener.thumbnail_layout
|
||||
),
|
||||
"key": "EmbedThumbnail",
|
||||
}
|
||||
)
|
||||
|
@ -81,6 +81,8 @@ class Mirror(TaskListener):
|
||||
input_list = text[0].split(" ")
|
||||
|
||||
args = {
|
||||
"-doc": False,
|
||||
"-med": False,
|
||||
"-d": False,
|
||||
"-j": False,
|
||||
"-s": False,
|
||||
@ -133,6 +135,8 @@ class Mirror(TaskListener):
|
||||
self.name_sub = args["-ns"]
|
||||
self.mixed_leech = args["-ml"]
|
||||
self.thumbnail_layout = args["-tl"]
|
||||
self.as_doc = args["-doc"]
|
||||
self.as_med = args["-med"]
|
||||
|
||||
headers = args["-h"]
|
||||
is_bulk = args["-b"]
|
||||
@ -277,7 +281,7 @@ class Mirror(TaskListener):
|
||||
self.remove_from_same_dir()
|
||||
return
|
||||
|
||||
if self.link:
|
||||
if len(self.link) > 0:
|
||||
LOGGER.info(self.link)
|
||||
|
||||
try:
|
||||
|
@ -287,6 +287,8 @@ class YtDlp(TaskListener):
|
||||
qual = ""
|
||||
|
||||
args = {
|
||||
"-doc": False,
|
||||
"-med": False,
|
||||
"-s": False,
|
||||
"-b": False,
|
||||
"-z": False,
|
||||
@ -308,6 +310,7 @@ class YtDlp(TaskListener):
|
||||
"-ca": "",
|
||||
"-cv": "",
|
||||
"-ns": "",
|
||||
"-tl": "",
|
||||
}
|
||||
|
||||
arg_parser(input_list[1:], args)
|
||||
@ -334,6 +337,9 @@ class YtDlp(TaskListener):
|
||||
self.convert_video = args["-cv"]
|
||||
self.name_sub = args["-ns"]
|
||||
self.mixed_leech = args["-ml"]
|
||||
self.thumbnail_layout = args["-tl"]
|
||||
self.as_doc = args["-doc"]
|
||||
self.as_med = args["-med"]
|
||||
|
||||
is_bulk = args["-b"]
|
||||
folder_name = args["-m"]
|
||||
|
Loading…
Reference in New Issue
Block a user