diff --git a/README.md b/README.md
index 37d82e79b6..78f62e214d 100644
--- a/README.md
+++ b/README.md
@@ -198,6 +198,7 @@ Fill up rest of the fields. Meaning of each field is discussed below:
- `LEECH_SPLIT_SIZE`: Size of split in bytes. Default is `2GB`. Default is `4GB` if your account is premium. `Str`
- `AS_DOCUMENT`: Default type of Telegram file upload. Default is `False` mean as media. `Bool`
- `EQUAL_SPLITS`: Split files larger than **LEECH_SPLIT_SIZE** into equal parts size (Not working with zip cmd). Default is `False`. `Bool`
+- `FILENAME_WITH_PATHS`: Send files along with their directory names. Useful for archives. Default is `False`. `Bool`
- `CUSTOM_FILENAME`: Add custom word to leeched file name. `Str`
- `USER_SESSION_STRING`: To download/upload from your telegram account. If you own premium account. To generate session string use this command `python3 generate_string_session.py` after mounting repo folder for sure. `Str`. **NOTE**: You can't use bot with private message. Use it with supergroup or channel.
@@ -563,4 +564,4 @@ Where host is the name of extractor (eg. instagram, Twitch). Multiple accounts o
-----
-Base Repo Credit: [Anasty](https://github.com/anasty17/mirror-leech-telegram-bot)
\ No newline at end of file
+Base Repo Credit: [Anasty](https://github.com/anasty17/mirror-leech-telegram-bot)
diff --git a/bot/__init__.py b/bot/__init__.py
index e1fb0732cc..3ace911533 100644
--- a/bot/__init__.py
+++ b/bot/__init__.py
@@ -352,6 +352,11 @@ def aria2c_init():
AS_DOCUMENT = AS_DOCUMENT.lower() == 'true'
except:
AS_DOCUMENT = False
+try:
+ FILENAME_WITH_PATHS = getConfig('FILENAME_WITH_PATHS')
+ FILENAME_WITH_PATHS = FILENAME_WITH_PATHS.lower() == 'true'
+except:
+ FILENAME_WITH_PATHS = False
try:
EQUAL_SPLITS = getConfig('EQUAL_SPLITS')
EQUAL_SPLITS = EQUAL_SPLITS.lower() == 'true'
diff --git a/bot/helper/mirror_utils/download_utils/yt_dlp_download_helper.py b/bot/helper/mirror_utils/download_utils/yt_dlp_download_helper.py
index 45ac12ec93..b2a42ad8fb 100644
--- a/bot/helper/mirror_utils/download_utils/yt_dlp_download_helper.py
+++ b/bot/helper/mirror_utils/download_utils/yt_dlp_download_helper.py
@@ -179,7 +179,7 @@ def add_download(self, link, path, name, qual, playlist, args):
if self.__is_cancelled:
return
if self.is_playlist:
- self.opts['outtmpl'] = f"{path}/{self.name}/%(title)s.%(ext)s"
+ self.opts['outtmpl'] = f"{path}/{self.name}/%(playlist_index)s.%(n_entries)s %(title)s.%(ext)s"
elif args is None:
self.opts['outtmpl'] = f"{path}/{self.name}"
else:
diff --git a/bot/helper/mirror_utils/upload_utils/pyrogramEngine.py b/bot/helper/mirror_utils/upload_utils/pyrogramEngine.py
index 263a7e78eb..af1e7d35bd 100644
--- a/bot/helper/mirror_utils/upload_utils/pyrogramEngine.py
+++ b/bot/helper/mirror_utils/upload_utils/pyrogramEngine.py
@@ -5,7 +5,7 @@
from PIL import Image
from threading import RLock
-from bot import AS_DOCUMENT, AS_DOC_USERS, AS_MEDIA_USERS, CUSTOM_FILENAME, EXTENSION_FILTER, app, app_session, BOT_PM, LEECH_LOG
+from bot import AS_DOCUMENT, AS_DOC_USERS, AS_MEDIA_USERS, CUSTOM_FILENAME, EXTENSION_FILTER, app, app_session, BOT_PM, LEECH_LOG, FILENAME_WITH_PATHS, DOWNLOAD_DIR
from bot.helper.ext_utils.fs_utils import take_ss, get_media_info, get_media_streams, clean_unwanted
from bot.helper.ext_utils.bot_utils import get_readable_file_size
@@ -85,14 +85,25 @@ def __upload_file(self, up_path, file_, dirpath):
LEECH_DUMP = int(setstr)
leechchat = LEECH_DUMP
else: leechchat = self.__listener.message.chat.id
+ # print full path file location +
+ if FILENAME_WITH_PATHS:
+ keption = DOWNLOAD_DIR
+ if not keption.endswith('/'): keption = keption + '/'
+ if not keption.startswith('/'): keption = '/' + keption
+ keption = up_path.replace(keption, '', 1)
+ zoy = keption.split('/')[0]
+ keption = keption.replace(zoy, '', 1)
+ if keption.startswith('/'): keption = keption.replace('/', '', 1)
+ else: keption = None
+ # print full path file location -
if CUSTOM_FILENAME is not None:
- cap_mono = f"{CUSTOM_FILENAME} {file_}"
+ cap_mono = f"{CUSTOM_FILENAME} {keption or file_}
"
file_ = f"{CUSTOM_FILENAME} {file_}"
new_path = ospath.join(dirpath, file_)
osrename(up_path, new_path)
up_path = new_path
else:
- cap_mono = f"{file_}"
+ cap_mono = f"{keption or file_}
"
notMedia = False
thumb = self.__thumb
self.__is_corrupted = False
@@ -127,7 +138,7 @@ def __upload_file(self, up_path, file_, dirpath):
supports_streaming=True,
disable_notification=True,
progress=self.__upload_progress)
- if not self.isPrivate and BOT_PM:
+ if BOT_PM:
try:
app.copy_message(chat_id=self.__user_id, from_chat_id=self.__sent_msg.chat.id, message_id=self.__sent_msg.id)
except Exception as err:
@@ -142,7 +153,7 @@ def __upload_file(self, up_path, file_, dirpath):
thumb=thumb,
disable_notification=True,
progress=self.__upload_progress)
- if not self.isPrivate and BOT_PM:
+ if BOT_PM:
try:
app.copy_message(chat_id=self.__user_id, from_chat_id=self.__sent_msg.chat.id, message_id=self.__sent_msg.id)
except Exception as err:
@@ -152,7 +163,7 @@ def __upload_file(self, up_path, file_, dirpath):
caption=cap_mono,
disable_notification=True,
progress=self.__upload_progress)
- if not self.isPrivate and BOT_PM:
+ if BOT_PM:
try:
app.copy_message(chat_id=self.__user_id, from_chat_id=self.__sent_msg.chat.id, message_id=self.__sent_msg.id)
except Exception as err:
@@ -171,7 +182,7 @@ def __upload_file(self, up_path, file_, dirpath):
caption=cap_mono,
disable_notification=True,
progress=self.__upload_progress)
- if not self.isPrivate and BOT_PM:
+ if BOT_PM:
try:
app.copy_message(chat_id=self.__user_id, from_chat_id=self.__sent_msg.chat.id, message_id=self.__sent_msg.id)
except Exception as err: