From bcf9c68f88ae3cc8fe7a87db0fab3df3a0b6171c Mon Sep 17 00:00:00 2001
From: yamraaj007 <69627019+crazy-racer@users.noreply.github.com>
Date: Sun, 10 Oct 2021 13:15:16 +0530
Subject: [PATCH 01/13] Update bot_utils.py
---
bot/helper/ext_utils/bot_utils.py | 47 ++++++++++++++++---------------
1 file changed, 24 insertions(+), 23 deletions(-)
diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py
index f7d4690c3..8839261d0 100644
--- a/bot/helper/ext_utils/bot_utils.py
+++ b/bot/helper/ext_utils/bot_utils.py
@@ -21,15 +21,15 @@
class MirrorStatus:
- STATUS_UPLOADING = "Uploading...๐ค"
- STATUS_DOWNLOADING = "Downloading...๐ฅ"
- STATUS_CLONING = "Cloning...โป๏ธ"
- STATUS_WAITING = "Queued...๐"
- STATUS_FAILED = "Failed ๐ซ. Cleaning Download..."
- STATUS_PAUSE = "Paused...โญ๏ธ"
- STATUS_ARCHIVING = "Archiving...๐"
- STATUS_EXTRACTING = "Extracting...๐"
- STATUS_SPLITTING = "Splitting...โ๏ธ"
+ STATUS_UPLOADING = "๐จ๐ฝ๐น๐ผ๐ฎ๐ฑ๐ถ๐ป๐...๐ค"
+ STATUS_DOWNLOADING = "๐๐ผ๐๐ป๐น๐ผ๐ฎ๐ฑ๐ถ๐ป๐...๐ฅ"
+ STATUS_CLONING = "๐พ๐ก๐ค๐ฃ๐๐ฃ๐...โป๏ธ"
+ STATUS_WAITING = "๐ค๐๐ฒ๐๐ฒ๐ฑ...๐"
+ STATUS_FAILED = "๐๐ฎ๐ถ๐น๐ฒ๐ฑ ๐ซ! ๐๐น๐ฒ๐ฎ๐ป๐ถ๐ป๐ด ๐ฑ๐ผ๐๐ป๐น๐ผ๐ฎ๐ฑ..."
+ STATUS_PAUSE = "๐๐๐ช๐จ๐๐...โญ๏ธ"
+ STATUS_ARCHIVING = "๐ผ๐ง๐๐๐๐ซ๐๐ฃ๐...๐"
+ STATUS_EXTRACTING = "๐๐ญ๐ฉ๐ง๐๐๐ฉ๐๐ฃ๐...๐"
+ STATUS_SPLITTING = "๐๐ฅ๐ก๐๐ฉ๐ฉ๐๐ฃ๐...โ๏ธ"
SIZE_UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']
@@ -103,14 +103,14 @@ def get_progress_bar_string(status):
p = 0 if total == 0 else round(completed * 100 / total)
p = min(max(p, 0), 100)
cFull = p // 8
- p_str = 'โ ' * cFull
- p_str += 'โก' * (12 - cFull)
+ p_str = 'โฆ' * cFull
+ p_str += 'โง' * (12 - cFull)
p_str = f"[{p_str}]"
return p_str
def get_readable_message():
with download_dict_lock:
- msg = ""
+ msg = "โฅโโโ @๐๐๐ฆ๐ซ๐๐๐ฃ๐๐๐ โโโโฅ"
start = 0
if STATUS_LIMIT is not None:
dick_no = len(download_dict)
@@ -121,8 +121,8 @@ def get_readable_message():
globals()['PAGE_NO'] -= 1
start = COUNT
for index, download in enumerate(list(download_dict.values())[start:], start=1):
- msg += f"Name: {download.name()}
"
- msg += f"\nStatus: {download.status()}"
+ msg += f"๐๐๐ถ๐น๐ฒ๐ก๐ฎ๐บ๐ฒ: {download.name()}
"
+ msg += f"\n๐๐ญ๐๐ญ๐ฎ๐ฌ: {download.status()}"
if download.status() not in [
MirrorStatus.STATUS_ARCHIVING,
MirrorStatus.STATUS_EXTRACTING,
@@ -130,24 +130,25 @@ def get_readable_message():
]:
msg += f"\n{get_progress_bar_string(download)} {download.progress()}"
if download.status() == MirrorStatus.STATUS_CLONING:
- msg += f"\nCloned: {get_readable_file_size(download.processed_bytes())} of {download.size()}"
+ msg += f"\nโป๏ธ ๐๐ฅ๐จ๐ง๐๐ : {get_readable_file_size(download.processed_bytes())} of {download.size()}"
elif download.status() == MirrorStatus.STATUS_UPLOADING:
- msg += f"\nUploaded: {get_readable_file_size(download.processed_bytes())} of {download.size()}"
+ msg += f"\n๐ค ๐๐ฉ๐ฅ๐จ๐๐๐๐ : {get_readable_file_size(download.processed_bytes())} of {download.size()}"
else:
- msg += f"\nDownloaded: {get_readable_file_size(download.processed_bytes())} of {download.size()}"
- msg += f"\nSpeed: {download.speed()}"
+ msg += f"\n๐ฅ ๐๐จ๐ฐ๐ง๐ฅ๐จ๐๐๐๐ : {get_readable_file_size(download.processed_bytes())} of {download.size()}"
+ msg += f"\nโก๐๐ฉ๐๐๐ : {download.speed()}"
msg += f"\nETA: {download.eta()}"
try:
- msg += f"\nSeeders: {download.aria_download().num_seeders}" \
- f" | Peers: {download.aria_download().connections}"
+ msg += f"\nโ๏ธ๐๐๐๐๐๐ซ๐ฌ : {download.aria_download().num_seeders}" \
+ f" | ๐ ๐๐๐๐ซ๐ฌ : {download.aria_download().connections}"
except:
pass
try:
- msg += f"\nSeeders: {download.torrent_info().num_seeds}" \
- f" | Leechers: {download.torrent_info().num_leechs}"
+ msg += f"\nโ๏ธ ๐๐๐๐๐๐ซ๐ฌ : {download.torrent_info().num_seeds}" \
+ f" | ๐ ๐๐๐๐๐ก๐๐ซ๐ฌ : {download.torrent_info().num_leechs}"
except:
pass
- msg += f"\n/{BotCommands.CancelMirror} {download.gid()}
"
+ msg += f'\n๐จโ๐ฆฑ ๐๐ฌ๐๐ซ : {download.message.from_user.first_name} ({download.message.from_user.id}
)'
+ msg += f"\n๐ซ ๐๐จ ๐๐ญ๐จ๐ฉ : /{BotCommands.CancelMirror} {download.gid()}
"
msg += "\n___________________________\n"
if STATUS_LIMIT is not None and index == STATUS_LIMIT:
break
From e3c0569cc97cfaba686fdb193a6c4958c0fc907c Mon Sep 17 00:00:00 2001
From: yamraaj007 <69627019+crazy-racer@users.noreply.github.com>
Date: Sun, 10 Oct 2021 13:28:16 +0530
Subject: [PATCH 02/13] Update __main__.py
---
bot/__main__.py | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/bot/__main__.py b/bot/__main__.py
index 73b6b407c..85ea53848 100644
--- a/bot/__main__.py
+++ b/bot/__main__.py
@@ -31,22 +31,26 @@ def stats(update, context):
cpuUsage = psutil.cpu_percent(interval=0.5)
memory = psutil.virtual_memory().percent
disk = psutil.disk_usage('/').percent
- stats = f'Bot Uptime: {currentTime}
\n' \
- f'Total Disk Space: {total}
\n' \
- f'Used: {used}
' \
- f'Free: {free}
\n\n' \
- f'Upload: {sent}
\n' \
- f'Download: {recv}
\n\n' \
- f'CPU: {cpuUsage}%
' \
- f'RAM: {memory}%
' \
- f'DISK: {disk}%
'
+ stats = f'โญโโโใ โญ๏ธ BOT STATS โญ๏ธ ใ \n' \
+ f'โ\n' \
+ f'โ โฐ Bot Uptime: {currentTime}
\n' \
+ f'โ ๐ Total Disk Space: {total}
\n' \
+ f'โ ๐ Used: {used}
' \
+ f'โ ๐ Free: {free}
\n\n' \
+ f'โ ๐ค Upload: {sent}
\n' \
+ f'โ ๐ฅ Download: {recv}
\n\n' \
+ f'โ ๐ฅ๏ธ CPU: {cpuUsage}%
' \
+ f'โ ๐ RAM: {memory}%
' \
+ f'โ ๐ DISK: {disk}%
' \
+ f'โ\n' \
+ f'โฐโโใ ๐ธ @๐๐๐ฆ๐ซ๐๐๐ฃ๐๐๐ ๐ธ ใ'
sendMessage(stats, context.bot, update)
def start(update, context):
buttons = button_build.ButtonMaker()
- buttons.buildbutton("Repo", "https://www.github.com/anasty17/mirror-leech-telegram-bot")
- buttons.buildbutton("Channel", "https://t.me/mirrorLeechTelegramBot")
+ buttons.buildbutton("Repo", "https://www.github.com/crazy-racer/mirror-leech-telegram-bot")
+ buttons.buildbutton("Channel", "https://t.me/Mirrorclouds")
reply_markup = InlineKeyboardMarkup(buttons.build_menu(2))
if CustomFilters.authorized_user(update) or CustomFilters.authorized_chat(update):
start_string = f'''
@@ -159,7 +163,7 @@ def log(update, context):
help = Telegraph(access_token=telegraph_token).create_page(
title='Mirrorbot Help',
author_name='Mirrorbot',
- author_url='https://github.com/anasty17/mirror-leech-telegram-bot',
+ author_url='https://github.com/crazy-racer/mirror-leech-telegram-bot',
html_content=help_string_telegraph,
)["path"]
From ccacf9e3cf75834335922d31b44c2a8ef2e807eb Mon Sep 17 00:00:00 2001
From: yamraaj007 <69627019+crazy-racer@users.noreply.github.com>
Date: Sun, 10 Oct 2021 14:03:43 +0530
Subject: [PATCH 03/13] Create mirror.py
---
bot/modules/mirror.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index cea2d488a..67632c0e2 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -250,7 +250,11 @@ def onUploadComplete(self, link: str, size, files, folders, typ):
update_all_messages()
return
with download_dict_lock:
- msg = f'Name: {download_dict[self.uid].name()}
\n\nSize: {size}'
+ msg = f'๐ ๐๐ถ๐น๐ฒ๐ก๐ฎ๐บ๐ฒ : {download_dict[self.uid].name()}
\n\nSize: {size}\n' \
+ f' \n' \
+ f'๐ฅ ๐๐๐ข๐ง๐๐๐ ๐๐๐ง๐ง๐ค๐ง ๐๐ค๐ฃ๐\n' \
+ f' \n' \
+ f'๐ฅ ๐๐ง๐ค๐ช๐ฅ : @mirrorclouds\n'
if os.path.isdir(f'{DOWNLOAD_DIR}/{self.uid}/{download_dict[self.uid].name()}'):
msg += '\n\nType: Folder'
msg += f'\nSubFolders: {folders}'
@@ -297,7 +301,7 @@ def onUploadComplete(self, link: str, size, files, folders, typ):
else:
uname = f'{self.message.from_user.first_name}'
if uname is not None:
- msg += f'\n\ncc: {uname}'
+ msg += f'\n\n๐ค ๐จ๐ฝ๐น๐ผ๐ฎ๐ฑ๐ฒ๐ฟ : ๐ {uname}\n\nโซ๏ธ#Uploaded To Team Drive โ \n\n๐ซ ๐ฟ๐ค ๐๐ค๐ฉ ๐๐๐๐ง๐ ๐๐ฃ๐๐๐ญ ๐๐๐ฃ๐ \n\nโ
๐ฃ๐ผ๐๐ฒ๐ฟ๐ฒ๐ฑ ๐๐ : yamraaj007'
try:
fs_utils.clean_download(download_dict[self.uid].path())
except FileNotFoundError:
From 5a1892f0fa39f3a19d33d6aa1834512f524bb553 Mon Sep 17 00:00:00 2001
From: yamraaj007 <69627019+crazy-racer@users.noreply.github.com>
Date: Sun, 10 Oct 2021 14:58:41 +0530
Subject: [PATCH 04/13] Create gdriveTools.py
---
.../mirror_utils/upload_utils/gdriveTools.py | 58 +++++++++----------
1 file changed, 29 insertions(+), 29 deletions(-)
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index a0ae9659e..daff16cdc 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -165,7 +165,7 @@ def upload_file(self, file_path, file_name, mime_type, parent_id):
# File body description
file_metadata = {
'name': file_name,
- 'description': 'Uploaded by Mirror-leech-telegram-bot',
+ 'description': '๐ฒ ๐๐ฅ๐ก๐ค๐๐๐๐ ๐๐ฎ ๐๐๐ข๐ง๐๐๐ ๐๐๐ง๐ง๐ค๐ง๐๐ค๐ฉ',
'mimeType': mime_type,
}
try:
@@ -376,10 +376,10 @@ def clone(self, link):
msg = self.deletefile(durl)
LOGGER.info(f"{msg}")
return "your clone has been stopped and cloned data has been deleted!", "cancelled"
- msg += f'Name: {meta.get("name")}
\nSize: {get_readable_file_size(self.transferred_size)}'
- msg += '\nType: Folder'
- msg += f'\nSubFolders: {self.total_folders}'
- msg += f'\nFiles: {self.total_files}'
+ msg += f'๐๏ธ ๐๐๐ก๐๐ฃ๐๐ข๐: {meta.get("name")}
\n๐ฆ ๐๐๐ฏ๐: {get_readable_file_size(self.transferred_size)}'
+ msg += '\nโ๏ธ ๐๐ฎ๐ฅ๐: Folder'
+ msg += f'\n๐ ๐๐ช๐๐๐ค๐ก๐๐๐ง๐จ: {self.total_folders}'
+ msg += f'\n๐ ๐๐๐ก๐๐จ: {self.total_files}'
buttons = button_build.ButtonMaker()
if SHORTENER is not None and SHORTENER_API is not None:
surl = short_url(durl)
@@ -396,7 +396,7 @@ def clone(self, link):
buttons.buildbutton("โก Index Link", url)
else:
file = self.copyFile(meta.get('id'), parent_id)
- msg += f'Name: {file.get("name")}
'
+ msg += f'๐ ๐๐ถ๐น๐ฒ๐ก๐ฎ๐บ๐ฒ: {file.get("name")}
'
durl = self.__G_DRIVE_BASE_DOWNLOAD_URL.format(file.get("id"))
buttons = button_build.ButtonMaker()
if SHORTENER is not None and SHORTENER_API is not None:
@@ -409,8 +409,8 @@ def clone(self, link):
except:
typ = 'File'
try:
- msg += f'\nSize: {get_readable_file_size(int(meta.get("size")))}'
- msg += f'\nType: {typ}'
+ msg += f'\n๐ฆ ๐๐๐ฏ๐: {get_readable_file_size(int(meta.get("size")))}'
+ msg += f'\n>โ๏ธ ๐๐ฎ๐ฅ๐: {typ}'
except TypeError:
pass
if INDEX_URL is not None:
@@ -488,7 +488,7 @@ def create_directory(self, directory_name, parent_id):
file_id = file.get("id")
if not IS_TEAM_DRIVE:
self.__set_permission(file_id)
- LOGGER.info("Created G-Drive Folder:\nName: {}\nID: {} ".format(file.get("name"), file_id))
+ LOGGER.info("โป๏ธ Created G-Drive Folder:\nName: {}\nID: {} ".format(file.get("name"), file_id))
return file_id
def upload_dir(self, input_directory, parent_id):
@@ -576,9 +576,9 @@ def edit_telegraph(self):
content += f' | Next'
nxt_page += 1
Telegraph(access_token=telegraph_token).edit_page(path = self.path[prev_page],
- title = 'Mirror-leech-bot Search',
- author_name='Mirror-leech-bot',
- author_url='https://github.com/anasty17/mirror-leech-telegram-bot',
+ title = '๐๐๐ข๐ง๐๐๐ ๐ ๐๐ฅ๐ฅ๐ข๐ฅ ๐ญ๐ข๐ก๐',
+ author_name='๐๐๐ข๐ง๐๐๐ ๐ ๐๐ฅ๐ฅ๐ข๐ฅ ๐ฝ๐ค๐ฉ',
+ author_url='https://github.com/crazy-racer/mirror-leech-telegram-bot',
html_content=content)
return
@@ -773,9 +773,9 @@ def drive_list(self, fileName, stopDup=False, noMulti=False):
for content in self.telegraph_content :
self.path.append(Telegraph(access_token=telegraph_token).create_page(
- title = 'Mirror-leech-bot Search',
- author_name='Mirror-leech-bot',
- author_url='https://github.com/anasty17/mirror-leech-telegram-bot',
+ title = '๐๐๐ข๐ง๐๐๐ ๐ ๐๐ฅ๐ฅ๐ข๐ฅ ๐ญ๐ข๐ก๐',
+ author_name='๐๐๐ข๐ง๐๐๐ ๐ ๐๐ฅ๐ฅ๐ข๐ฅ ๐ญ๐ข๐ก๐',
+ author_url='https://github.com/crazy-racer/mirror-leech-telegram-bot',
html_content=content
)['path'])
@@ -793,7 +793,7 @@ def count(self, link):
try:
file_id = self.getIdFromUrl(link)
except (KeyError,IndexError):
- msg = "Google Drive ID could not be found in the provided link"
+ msg = "๐ Google Drive ID could not be found in the provided link"
return msg
msg = ""
LOGGER.info(f"File ID: {file_id}")
@@ -804,13 +804,13 @@ def count(self, link):
LOGGER.info(f"Counting: {name}")
if drive_file['mimeType'] == self.__G_DRIVE_DIR_MIME_TYPE:
self.gDrive_directory(**drive_file)
- msg += f'Name: {name}
'
- msg += f'\n\nSize: {get_readable_file_size(self.total_bytes)}'
- msg += '\n\nType: Folder'
- msg += f'\nSubFolders: {self.total_folders}'
- msg += f'\nFiles: {self.total_files}'
+ msg += f'๐๏ธ ๐๐๐ก๐๐ฃ๐๐ข๐: {name}
'
+ msg += f'\n\n๐ฆ ๐๐๐ฏ๐: {get_readable_file_size(self.total_bytes)}'
+ msg += '\n\nโ๏ธ ๐๐ฎ๐ฅ๐: Folder'
+ msg += f'\n๐ ๐๐ช๐๐๐ค๐ก๐๐๐ง๐จ: {self.total_folders}'
+ msg += f'\n๐ ๐๐๐ก๐๐จ: {self.total_files}'
else:
- msg += f'Name: {name}
'
+ msg += f'๐ ๐๐๐ก๐๐ฃ๐๐ข๐: {name}
'
try:
typee = drive_file['mimeType']
except:
@@ -818,9 +818,9 @@ def count(self, link):
try:
self.total_files += 1
self.gDrive_file(**drive_file)
- msg += f'\n\nSize: {get_readable_file_size(self.total_bytes)}'
- msg += f'\n\nType: {typee}'
- msg += f'\nFiles: {self.total_files}'
+ msg += f'\n\n๐ฆ ๐๐๐ฏ๐: {get_readable_file_size(self.total_bytes)}'
+ msg += f'\n\nโ๏ธ ๐๐ฎ๐ฅ๐: {typee}'
+ msg += f'\n๐ ๐๐๐ก๐๐จ: {self.total_files}'
except TypeError:
pass
except Exception as err:
@@ -859,7 +859,7 @@ def helper(self, link):
try:
file_id = self.getIdFromUrl(link)
except (KeyError,IndexError):
- msg = "Google Drive ID could not be found in the provided link"
+ msg = "๐ Google Drive ID could not be found in the provided link"
return msg, "", "", ""
LOGGER.info(f"File ID: {file_id}")
try:
@@ -1008,10 +1008,10 @@ def _on_download_progress(self):
def cancel_download(self):
self.is_cancelled = True
if self.is_downloading:
- LOGGER.info(f"Cancelling Download: {self.name}")
+ LOGGER.info(f"โ Cancelling Download: {self.name}")
self.__listener.onDownloadError('Download stopped by user!')
elif self.is_cloning:
- LOGGER.info(f"Cancelling Clone: {self.name}")
+ LOGGER.info(f"โ Cancelling Clone: {self.name}")
elif self.is_uploading:
- LOGGER.info(f"Cancelling Upload: {self.name}")
+ LOGGER.info(f"โ Cancelling Upload: {self.name}")
self.__listener.onUploadError('your upload has been stopped and uploaded data has been deleted!')
From 01cf30e60ca9ce90fbc299c3c576c88d745dcdc9 Mon Sep 17 00:00:00 2001
From: yamraaj007 <69627019+crazy-racer@users.noreply.github.com>
Date: Sun, 10 Oct 2021 15:08:37 +0530
Subject: [PATCH 05/13] Update message_utils.py
---
bot/helper/telegram_helper/message_utils.py | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/bot/helper/telegram_helper/message_utils.py b/bot/helper/telegram_helper/message_utils.py
index 4f9c9c65c..c9a0b7d5a 100644
--- a/bot/helper/telegram_helper/message_utils.py
+++ b/bot/helper/telegram_helper/message_utils.py
@@ -75,9 +75,9 @@ def update_all_messages():
free = get_readable_file_size(free)
currentTime = get_readable_time(time.time() - botStartTime)
msg, buttons = get_readable_message()
- msg += f"CPU: {psutil.cpu_percent()}%" \
- f" RAM: {psutil.virtual_memory().percent}%" \
- f" DISK: {psutil.disk_usage('/').percent}%"
+ msg += f"๐ฅ๏ธ ๐พ๐๐: {psutil.cpu_percent()}%" \
+ f" ๐ ๐๐ผ๐: {psutil.virtual_memory().percent}%" \
+ f" ๐ฆ ๐ฟ๐๐๐: {psutil.disk_usage('/').percent}%"
with download_dict_lock:
dlspeed_bytes = 0
uldl_bytes = 0
@@ -95,7 +95,7 @@ def update_all_messages():
uldl_bytes += float(speedy.split('M')[0]) * 1048576
dlspeed = get_readable_file_size(dlspeed_bytes)
ulspeed = get_readable_file_size(uldl_bytes)
- msg += f"\nFREE: {free} | UPTIME: {currentTime}\nDL: {dlspeed}/s ๐ป | UL: {ulspeed}/s ๐บ\n"
+ msg += f"\n๐๐๐๐: {free} | ๐๐๐๐๐๐: {currentTime}\n๐ฟ๐: {dlspeed}/s ๐ป | ๐๐: {ulspeed}/s ๐บ\n"
with status_reply_dict_lock:
for chat_id in list(status_reply_dict.keys()):
if status_reply_dict[chat_id] and msg != status_reply_dict[chat_id].text:
@@ -116,9 +116,9 @@ def sendStatusMessage(msg, bot):
free = get_readable_file_size(free)
currentTime = get_readable_time(time.time() - botStartTime)
progress, buttons = get_readable_message()
- progress += f"CPU: {psutil.cpu_percent()}%" \
- f" RAM: {psutil.virtual_memory().percent}%" \
- f" DISK: {psutil.disk_usage('/').percent}%"
+ progress += f"๐ฅ๏ธ ๐พ๐๐: {psutil.cpu_percent()}%" \
+ f" ๐ ๐๐ผ๐: {psutil.virtual_memory().percent}%" \
+ f" ๐ฆ ๐ฟ๐๐๐: {psutil.disk_usage('/').percent}%"
with download_dict_lock:
dlspeed_bytes = 0
uldl_bytes = 0
@@ -136,7 +136,7 @@ def sendStatusMessage(msg, bot):
uldl_bytes += float(speedy.split('M')[0]) * 1048576
dlspeed = get_readable_file_size(dlspeed_bytes)
ulspeed = get_readable_file_size(uldl_bytes)
- progress += f"\nFREE: {free} | UPTIME: {currentTime}\nDL: {dlspeed}/s ๐ป | UL: {ulspeed}/s ๐บ\n"
+ progress += f"\n๐๐๐๐: {free} | ๐๐๐๐๐๐: {currentTime}\n๐ฟ๐: {dlspeed}/s ๐ป | ๐๐: {ulspeed}/s ๐บ\n"
with status_reply_dict_lock:
if msg.message.chat.id in list(status_reply_dict.keys()):
try:
From 099c576ac953f210767fc358260057c7f655be49 Mon Sep 17 00:00:00 2001
From: yamraaj007 <69627019+crazy-racer@users.noreply.github.com>
Date: Sun, 10 Oct 2021 15:16:03 +0530
Subject: [PATCH 06/13] Update clone.py
---
bot/modules/clone.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/bot/modules/clone.py b/bot/modules/clone.py
index b001d5283..e97db6d57 100644
--- a/bot/modules/clone.py
+++ b/bot/modules/clone.py
@@ -21,7 +21,7 @@ def cloneNode(update, context):
sendMessage(res, context.bot, update)
return
if STOP_DUPLICATE:
- LOGGER.info('Checking File/Folder if already in Drive...')
+ LOGGER.info('๐ Checking File/Folder if already in Drive...')
smsg, button = gd.drive_list(name, True, True)
if smsg:
msg3 = "File/Folder is already available in Drive.\nHere are the search results:"
@@ -34,7 +34,7 @@ def cloneNode(update, context):
sendMessage(msg2, context.bot, update)
return
if files <= 10:
- msg = sendMessage(f"Cloning: {link}
", context.bot, update)
+ msg = sendMessage(f"๐ Cloning: {link}
", context.bot, update)
result, button = gd.clone(link)
deleteMessage(context.bot, msg)
else:
@@ -62,7 +62,7 @@ def cloneNode(update, context):
else:
uname = f'{update.message.from_user.first_name}'
if uname is not None:
- cc = f'\n\ncc: {uname}'
+ cc = f'\n\n๐ค ๐๐น๐ผ๐ป๐ฒ๐ฟ : {uname}\n\n๐ฅ ๐๐๐ข๐ง๐๐๐ ๐ ๐ถ๐ฟ๐ฟ๐ผ๐ฟ ๐ญ๐ผ๐ป๐\n\n๐ฅ ๐๐ฟ๐ผ๐๐ฝ : @Mirrorclouds\n\nโซ๏ธ#Uploaded To Team Drive โ \n\n๐ซ ๐๐ผ ๐ก๐ผ๐ ๐ฆ๐ต๐ฎ๐ฟ๐ฒ ๐๐ป๐ฑ๐ฒ๐
๐๐ถ๐ป๐ธ \n\nโ
๐ฃ๐ผ๐๐ฒ๐ฟ๐ฒ๐ฑ ๐๐ : @Yamraaj007'
men = f'{uname} '
if button in ["cancelled", ""]:
sendMessage(men + result, context.bot, update)
From 8ed0f8396df8d448fe8bf6d798d79bf462e8dd78 Mon Sep 17 00:00:00 2001
From: yamraaj007 <69627019+crazy-racer@users.noreply.github.com>
Date: Sun, 10 Oct 2021 15:18:54 +0530
Subject: [PATCH 07/13] Update count.py
---
bot/modules/count.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/bot/modules/count.py b/bot/modules/count.py
index b8559acae..1314c439d 100644
--- a/bot/modules/count.py
+++ b/bot/modules/count.py
@@ -14,7 +14,7 @@ def countNode(update, context):
args = update.message.text.split(" ", maxsplit=1)
if len(args) > 1:
link = args[1]
- msg = sendMessage(f"Counting: {link}
", context.bot, update)
+ msg = sendMessage(f"๐Counting: {link}
", context.bot, update)
gd = GoogleDriveHelper()
result = gd.count(link)
deleteMessage(context.bot, msg)
@@ -23,7 +23,7 @@ def countNode(update, context):
else:
uname = f'{update.message.from_user.first_name}'
if uname is not None:
- cc = f'\n\ncc: {uname}'
+ cc = f'\n\n๐ค ๐๐ผ๐๐ป๐๐ฒ๐ฟ : {uname}\n\n๐ฅ ๐๐๐ข๐ง๐๐๐ ๐ ๐ถ๐ฟ๐ฟ๐ผ๐ฟ ๐ญ๐ผ๐ป๐\n\n๐ฅ ๐๐ฟ๐ผ๐๐ฝ : @Mirrorclouds\n\nโซ๏ธ#Uploaded To Team Drive โ \n\n๐ซ ๐๐ผ ๐ก๐ผ๐ ๐ฆ๐ต๐ฎ๐ฟ๐ฒ ๐๐ป๐ฑ๐ฒ๐
๐๐ถ๐ป๐ธ \n\nโ
๐ฃ๐ผ๐๐ฒ๐ฟ๐ฒ๐ฑ ๐๐ : @Yamraaj007'
sendMessage(result + cc, context.bot, update)
else:
sendMessage("Provide G-Drive Shareable Link to Count.", context.bot, update)
From 97b04de4cf3fde0bc21ab0beadc0d7d138f6160c Mon Sep 17 00:00:00 2001
From: yamraaj007 <69627019+crazy-racer@users.noreply.github.com>
Date: Sun, 10 Oct 2021 15:31:33 +0530
Subject: [PATCH 08/13] Update speedtest.py
---
bot/modules/speedtest.py | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/bot/modules/speedtest.py b/bot/modules/speedtest.py
index 9dfd65c87..9720a0173 100644
--- a/bot/modules/speedtest.py
+++ b/bot/modules/speedtest.py
@@ -15,17 +15,17 @@ def speedtest(update, context):
test.results.share()
result = test.results.dict()
string_speed = f'''
-Server
-Name: {result['server']['name']}
-Country: {result['server']['country']}, {result['server']['cc']}
-Sponsor: {result['server']['sponsor']}
-ISP: {result['client']['isp']}
-
-SpeedTest Results
-Upload: {speed_convert(result['upload'] / 8)}
-Download: {speed_convert(result['download'] / 8)}
-Ping: {result['ping']} ms
-ISP Rating: {result['client']['isprating']}
+๐ฅ๏ธ Server
+๐ณ Name: {result['server']['name']}
+โณ๏ธ Country: {result['server']['country']}, {result['server']['cc']}
+๐ฐ Sponsor: {result['server']['sponsor']}
+๐ฌ ISP: {result['client']['isp']}
+
+โ๏ธ SpeedTest Results
+๐บ Upload: {speed_convert(result['upload'] / 8)}
+๐ป Download: {speed_convert(result['download'] / 8)}
+๐ถ Ping: {result['ping']} ms
+๐ฌ ISP Rating: {result['client']['isprating']}
'''
editMessage(string_speed, speed)
From 98f0bb60751b9dffc437ffa84b81807803d8e718 Mon Sep 17 00:00:00 2001
From: yamraaj007 <69627019+crazy-racer@users.noreply.github.com>
Date: Tue, 9 Nov 2021 00:15:20 +0530
Subject: [PATCH 09/13] Update requirements.txt
---
requirements.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/requirements.txt b/requirements.txt
index 5dd4b0264..f8ec0c57b 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -30,4 +30,4 @@ tenacity
TgCrypto
torrentool==1.1.0
urllib3
-youtube_dl
+yt_dlp
From b625cc5e1ede14b04276cabc59ad143a108a2ef6 Mon Sep 17 00:00:00 2001
From: yamraaj007 <69627019+crazy-racer@users.noreply.github.com>
Date: Tue, 9 Nov 2021 00:18:00 +0530
Subject: [PATCH 10/13] Update youtube_dl_download_helper.py
---
.../mirror_utils/download_utils/youtube_dl_download_helper.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py b/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
index 2119505a2..35b0f472e 100644
--- a/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
+++ b/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
@@ -1,6 +1,6 @@
from .download_helper import DownloadHelper
import time
-from youtube_dl import YoutubeDL, DownloadError
+from yt_dlp import YoutubeDL, DownloadError
from bot import download_dict_lock, download_dict
from ..status_utils.youtube_dl_download_status import YoutubeDLDownloadStatus
import logging
@@ -17,7 +17,7 @@ def __init__(self, obj):
def debug(self, msg):
LOGGER.debug(msg)
# Hack to fix changing changing extension
- match = re.search(r'.ffmpeg..Merging formats into..(.*?).$', msg)
+ match = re.search(r'.Merger..Merging formats into..(.*?).$', msg)
if match and not self.obj.is_playlist:
newname = match.group(1)
newname = newname.split("/")
From fabee8d30243cb40c15a93863b688d7525ec327a Mon Sep 17 00:00:00 2001
From: yamraaj007 <69627019+crazy-racer@users.noreply.github.com>
Date: Tue, 9 Nov 2021 00:23:19 +0530
Subject: [PATCH 11/13] Update Dockerfile
---
Dockerfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Dockerfile b/Dockerfile
index 11ae1dc92..276c57ab5 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM anasty17/mirror-leech:latest
+FROM priiiiyo/mega-sdk-python:latest
WORKDIR /usr/src/app
RUN chmod 777 /usr/src/app
From 24ca413e2ca813bcda39331e24ee75402b671c9d Mon Sep 17 00:00:00 2001
From: "sourcery-ai[bot]" <58596630+sourcery-ai[bot]@users.noreply.github.com>
Date: Fri, 30 Sep 2022 13:39:47 +0530
Subject: [PATCH 12/13] 'Refactored by Sourcery' (#12)
Co-authored-by: Sourcery AI <>
---
.../youtube_dl_download_helper.py | 12 +++---
.../mirror_utils/upload_utils/gdriveTools.py | 39 ++++++++++---------
bot/modules/mirror.py | 22 +++++------
3 files changed, 36 insertions(+), 37 deletions(-)
diff --git a/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py b/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
index 35b0f472e..ca249890a 100644
--- a/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
+++ b/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
@@ -19,7 +19,7 @@ def debug(self, msg):
# Hack to fix changing changing extension
match = re.search(r'.Merger..Merging formats into..(.*?).$', msg)
if match and not self.obj.is_playlist:
- newname = match.group(1)
+ newname = match[1]
newname = newname.split("/")
newname = newname[-1]
self.obj.name = newname
@@ -159,10 +159,12 @@ def add_download(self, link, path, qual, name):
self.opts['postprocessors'] = [{'key': 'FFmpegExtractAudio','preferredcodec': 'mp3','preferredquality': '320',}]
else:
self.opts['format'] = qual
- if not self.is_playlist:
- self.opts['outtmpl'] = f"{path}/{self.name}"
- else:
- self.opts['outtmpl'] = f"{path}/{self.name}/%(title)s.%(ext)s"
+ self.opts['outtmpl'] = (
+ f"{path}/{self.name}/%(title)s.%(ext)s"
+ if self.is_playlist
+ else f"{path}/{self.name}"
+ )
+
self.__download(link)
def cancel_download(self):
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index daff16cdc..4b7e7f361 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -104,7 +104,7 @@ def getIdFromUrl(link: str):
res = re.search(regex,link)
if res is None:
raise IndexError("G-Drive ID not found.")
- return res.group(5)
+ return res[5]
parsed = urlparse.urlparse(link)
return parse_qs(parsed.query)['id'][0]
@@ -197,9 +197,7 @@ def upload_file(self, file_path, file_name, mime_type, parent_id):
drive_file = self.__service.files().create(supportsTeamDrives=True,
body=file_metadata, media_body=media_body)
response = None
- while response is None:
- if self.is_cancelled:
- break
+ while response is None and not self.is_cancelled:
try:
self.status, response = drive_file.next_chunk()
except HttpError as err:
@@ -236,7 +234,7 @@ def upload(self, file_name: str):
file_dir = f"{DOWNLOAD_DIR}{self.__listener.message.message_id}"
file_path = f"{file_dir}/{file_name}"
size = get_readable_file_size(get_path_size(file_path))
- LOGGER.info("Uploading File: " + file_path)
+ LOGGER.info(f"Uploading File: {file_path}")
self.updater = setInterval(self.update_interval, self._on_upload_progress)
if os.path.isfile(file_path):
try:
@@ -246,7 +244,7 @@ def upload(self, file_name: str):
return
if link is None:
raise Exception('Upload has been manually cancelled')
- LOGGER.info("Uploaded To G-Drive: " + file_path)
+ LOGGER.info(f"Uploaded To G-Drive: {file_path}")
except Exception as e:
if isinstance(e, RetryError):
LOGGER.info(f"Total Attempts: {e.last_attempt.attempt_number}")
@@ -272,7 +270,7 @@ def upload(self, file_name: str):
msg = self.deletefile(link)
LOGGER.info(f"{msg}")
return
- LOGGER.info("Uploaded To G-Drive: " + file_name)
+ LOGGER.info(f"Uploaded To G-Drive: {file_name}")
except Exception as e:
if isinstance(e, RetryError):
LOGGER.info(f"Total Attempts: {e.last_attempt.attempt_number}")
@@ -439,9 +437,9 @@ def clone(self, link):
err = err.last_attempt.exception()
err = str(err).replace('>', '').replace('<', '')
LOGGER.error(err)
- if "User rate limit exceeded" in str(err):
+ if "User rate limit exceeded" in err:
msg = "User rate limit exceeded."
- elif "File not found" in str(err):
+ elif "File not found" in err:
token_service = self.alt_authorize()
if token_service is not None:
self.__service = token_service
@@ -488,7 +486,10 @@ def create_directory(self, directory_name, parent_id):
file_id = file.get("id")
if not IS_TEAM_DRIVE:
self.__set_permission(file_id)
- LOGGER.info("โป๏ธ Created G-Drive Folder:\nName: {}\nID: {} ".format(file.get("name"), file_id))
+ LOGGER.info(
+ f'โป๏ธ Created G-Drive Folder:\nName: {file.get("name")}\nID: {file_id} '
+ )
+
return file_id
def upload_dir(self, input_directory, parent_id):
@@ -724,7 +725,7 @@ def drive_list(self, fileName, stopDup=False, noMulti=False):
msg += f' | Index Link'
elif file.get('mimeType') == 'application/vnd.google-apps.shortcut':
msg += f"โ{file.get('name')}" \
- f" (shortcut)"
+ f" (shortcut)"
# Excluded index link as indexes cant download or open these shortcuts
else:
furl = f"https://drive.google.com/uc?id={file.get('id')}&export=download"
@@ -826,12 +827,12 @@ def count(self, link):
except Exception as err:
err = str(err).replace('>', '').replace('<', '')
LOGGER.error(err)
- if "File not found" in str(err):
+ if "File not found" in err:
token_service = self.alt_authorize()
if token_service is not None:
self.__service = token_service
return self.count(link)
- msg = "File not found."
+ msg = "File not found."
else:
msg = f"Error.\n{err}"
return msg
@@ -880,12 +881,12 @@ def helper(self, link):
except Exception as err:
err = str(err).replace('>', '').replace('<', '')
LOGGER.error(err)
- if "File not found" in str(err):
+ if "File not found" in err:
token_service = self.alt_authorize()
if token_service is not None:
self.__service = token_service
return self.helper(link)
- msg = "File not found."
+ msg = "File not found."
else:
msg = f"Error.\n{err}"
return msg, "", "", ""
@@ -909,9 +910,9 @@ def download(self, link):
err = err.last_attempt.exception()
err = str(err).replace('>', '').replace('<', '')
LOGGER.error(err)
- if "downloadQuotaExceeded" in str(err):
+ if "downloadQuotaExceeded" in err:
err = "Download Quota Exceeded."
- elif "File not found" in str(err):
+ elif "File not found" in err:
token_service = self.alt_authorize()
if token_service is not None:
self.__service = token_service
@@ -928,7 +929,7 @@ def download(self, link):
def download_folder(self, folder_id, path, folder_name):
if not os.path.exists(path + folder_name):
os.makedirs(path + folder_name)
- path += folder_name + '/'
+ path += f'{folder_name}/'
result = []
page_token = None
while True:
@@ -965,7 +966,7 @@ def download_folder(self, folder_id, path, folder_name):
def download_file(self, file_id, path, filename, mime_type):
request = self.__service.files().get_media(fileId=file_id)
filename = filename.replace('/', '')
- fh = io.FileIO('{}{}'.format(path, filename), 'wb')
+ fh = io.FileIO(f'{path}{filename}', 'wb')
downloader = MediaIoBaseDownload(fh, request, chunksize = 65 * 1024 * 1024)
done = False
while not done:
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index 67632c0e2..a3dbb897d 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -84,7 +84,7 @@ def onDownloadComplete(self):
download_dict[self.uid] = TarStatus(name, m_path, size)
if self.isZip:
pswd = self.pswd
- path = m_path + ".zip"
+ path = f"{m_path}.zip"
LOGGER.info(f'Zip: orig_path: {m_path}, zip_path: {path}')
if pswd is not None:
subprocess.run(["7z", "a", "-mx=0", f"-p{pswd}", path, m_path])
@@ -112,8 +112,8 @@ def onDownloadComplete(self):
for dirpath, subdir, files in os.walk(m_path, topdown=False):
for filee in files:
if re.search(r'\.part0*1.rar$', filee) or re.search(r'\.7z.0*1$', filee) \
- or (filee.endswith(".rar") and not re.search(r'\.part\d+.rar$', filee)) \
- or re.search(r'\.zip.0*1$', filee):
+ or (filee.endswith(".rar") and not re.search(r'\.part\d+.rar$', filee)) \
+ or re.search(r'\.zip.0*1$', filee):
m_path = os.path.join(dirpath, filee)
if pswd is not None:
result = subprocess.run(["7z", "x", f"-p{pswd}", m_path, f"-o{dirpath}"])
@@ -124,7 +124,7 @@ def onDownloadComplete(self):
break
for filee in files:
if filee.endswith(".rar") or re.search(r'\.r\d+$', filee) \
- or re.search(r'\.7z.\d+$', filee) or re.search(r'\.zip.\d+$', filee):
+ or re.search(r'\.7z.\d+$', filee) or re.search(r'\.zip.\d+$', filee):
del_path = os.path.join(dirpath, filee)
os.remove(del_path)
path = f'{DOWNLOAD_DIR}{self.uid}/{name}'
@@ -251,10 +251,10 @@ def onUploadComplete(self, link: str, size, files, folders, typ):
return
with download_dict_lock:
msg = f'๐ ๐๐ถ๐น๐ฒ๐ก๐ฎ๐บ๐ฒ : {download_dict[self.uid].name()}
\n\nSize: {size}\n' \
- f' \n' \
- f'๐ฅ ๐๐๐ข๐ง๐๐๐ ๐๐๐ง๐ง๐ค๐ง ๐๐ค๐ฃ๐\n' \
- f' \n' \
- f'๐ฅ ๐๐ง๐ค๐ช๐ฅ : @mirrorclouds\n'
+ f' \n' \
+ f'๐ฅ ๐๐๐ข๐ง๐๐๐ ๐๐๐ง๐ง๐ค๐ง ๐๐ค๐ฃ๐\n' \
+ f' \n' \
+ f'๐ฅ ๐๐ง๐ค๐ช๐ฅ : @mirrorclouds\n'
if os.path.isdir(f'{DOWNLOAD_DIR}/{self.uid}/{download_dict[self.uid].name()}'):
msg += '\n\nType: Folder'
msg += f'\nSubFolders: {folders}'
@@ -374,12 +374,8 @@ def _mirror(bot, update, isTar=False, extract=False, isZip=False, isQbit=False,
link = link.strip()
reply_to = update.message.reply_to_message
if reply_to is not None:
- file = None
media_array = [reply_to.document, reply_to.video, reply_to.audio]
- for i in media_array:
- if i is not None:
- file = i
- break
+ file = next((i for i in media_array if i is not None), None)
if (
not bot_utils.is_url(link)
and not bot_utils.is_magnet(link)
From a5b251545854a350c8565799fe41b6c5cb2d5258 Mon Sep 17 00:00:00 2001
From: Yamraaj Yaduvanshi <69627019+YaMraaJ-debug@users.noreply.github.com>
Date: Fri, 30 Sep 2022 13:43:10 +0530
Subject: [PATCH 13/13] Update Dockerfile
Signed-off-by: Yamraaj Yaduvanshi <69627019+YaMraaJ-debug@users.noreply.github.com>
---
Dockerfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Dockerfile b/Dockerfile
index 276c57ab5..11ae1dc92 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM priiiiyo/mega-sdk-python:latest
+FROM anasty17/mirror-leech:latest
WORKDIR /usr/src/app
RUN chmod 777 /usr/src/app