Skip to content

Commit

Permalink
leech without thumb
Browse files Browse the repository at this point in the history
- only by using arg -t none

close #1768

Signed-off-by: anasty17 <[email protected]>
  • Loading branch information
anasty17 committed Dec 23, 2024
1 parent 24ccebe commit 2d90840
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ Fill up rest of the fields. Meaning of each field is discussed below.
Default api limit for each site). `Int`
- `SEARCH_PLUGINS`: List of qBittorrent search plugins (github raw links). I have added some plugins, you can remove/add
plugins as you want. Main
Source: [qBittorrent Search Plugins (Official/Unofficial)](https://github.com/qbittorrent/search-plugins/wiki/Unofficial-search-plugins). `List`
Source: [qBittorrent Search Plugins (Official/Unofficial)](https://github.com/qbittorrent/search-plugins). `List`

------

Expand Down
2 changes: 1 addition & 1 deletion bot/helper/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ async def before_start(self):
)
)

if is_telegram_link(self.thumb):
if self.thumb != "none" and is_telegram_link(self.thumb):
msg = (await get_tg_link_message(self.thumb))[0]
self.thumb = (
await create_thumb(msg) if msg.photo or msg.document else ""
Expand Down
2 changes: 1 addition & 1 deletion bot/helper/ext_utils/help_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

thumb = """<b>Thumbnail for current task</b>: -t
/cmd link -t tg-message-link(doc or photo)"""
/cmd link -t tg-message-link (doc or photo) or none (file without thumb)"""

split_size = """<b>Split size for current task</b>: -sp
Expand Down
12 changes: 9 additions & 3 deletions bot/helper/mirror_leech_utils/telegram_uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async def _user_settings(self):
if "lprefix" not in self._listener.user_dict
else ""
)
if not await aiopath.exists(self._thumb):
if self._thumb != "none" and not await aiopath.exists(self._thumb):
self._thumb = None

async def _msg_to_reply(self):
Expand Down Expand Up @@ -362,7 +362,7 @@ async def upload(self, o_files, ft_delete):
retry=retry_if_exception_type(Exception),
)
async def _upload_file(self, cap_mono, file, o_path, force_document=False):
if self._thumb is not None and not await aiopath.exists(self._thumb):
if self._thumb is not None and not await aiopath.exists(self._thumb) and self._thumb != "none":
self._thumb = None
thumb = self._thumb
self._is_corrupted = False
Expand All @@ -388,6 +388,8 @@ async def _upload_file(self, cap_mono, file, o_path, force_document=False):

if self._listener.is_cancelled:
return
if thumb == "none":
thumb = None
self._sent_msg = await self._sent_msg.reply_document(
document=self._up_path,
quote=True,
Expand All @@ -408,14 +410,16 @@ async def _upload_file(self, cap_mono, file, o_path, force_document=False):
)
if thumb is None:
thumb = await get_video_thumbnail(self._up_path, duration)
if thumb is not None:
if thumb is not None and thumb != "none":
with Image.open(thumb) as img:
width, height = img.size
else:
width = 480
height = 320
if self._listener.is_cancelled:
return
if thumb == "none":
thumb = None
self._sent_msg = await self._sent_msg.reply_video(
video=self._up_path,
quote=True,
Expand All @@ -433,6 +437,8 @@ async def _upload_file(self, cap_mono, file, o_path, force_document=False):
duration, artist, title = await get_media_info(self._up_path)
if self._listener.is_cancelled:
return
if thumb == "none":
thumb = None
self._sent_msg = await self._sent_msg.reply_audio(
audio=self._up_path,
quote=True,
Expand Down
1 change: 1 addition & 0 deletions web/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

0 comments on commit 2d90840

Please sign in to comment.