From 8935a0e27de9b2660aaa7fefa67a3c003220ad82 Mon Sep 17 00:00:00 2001
From: Hafitz Setya <71178188+breakdowns@users.noreply.github.com>
Date: Mon, 31 May 2021 11:54:59 +0700
Subject: [PATCH] Tidying up
---
README.md | 3 ++-
bot/__main__.py | 5 ++--
.../mirror_utils/upload_utils/gdriveTools.py | 26 +++++++++----------
config_sample.env | 2 +-
4 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/README.md b/README.md
index 875e5fb8e44..9ade44ab848 100644
--- a/README.md
+++ b/README.md
@@ -26,6 +26,7 @@
- Multiple Trackers support
- Check Heroku dynos stats
- Custom image support
+- Counting file/folders
- Racaty.net support
- Shell and Executor
- Stickers module
@@ -117,7 +118,7 @@ Fill up rest of the fields. Meaning of each fields are discussed below:
- **TELEGRAM_API**: This is to authenticate to your Telegram account for downloading Telegram files. You can get this from https://my.telegram.org DO NOT put this in quotes.
- **TELEGRAM_HASH**: This is to authenticate to your Telegram account for downloading Telegram files. You can get this from https://my.telegram.org
- **OWNER_ID**: The Telegram user ID (not username) of the Owner of the bot
-- **DATABASE_URL**: Your Database URL. See [Generate Database](https://github.com/breakdowns/slam-mirrorbot/tree/master#generate-database) to generate database. (**NOTE**: If you deploying on Heroku, no need to generate database manually, because it will automatic generate database when first deploying)
+- **DATABASE_URL**: Your Database URL. See [Generate Database](https://github.com/breakdowns/slam-mirrorbot/tree/master#generate-database) to generate database. (**NOTE**: Leave this empty if You deploying on Heroku with PostgreSQL, for using another database with Heroku just make the name of the var (DATABASE_URL), for vps You must fill database url here)
- **GDRIVE_FOLDER_ID**: This is the folder ID of the Google Drive Folder to which you want to upload all the mirrors.
- **DOWNLOAD_DIR**: The path to the local folder where the downloads should be downloaded to
- **DOWNLOAD_STATUS_UPDATE_INTERVAL**: A short interval of time in seconds after which the Mirror progress message is updated. (I recommend to keep it `5` seconds at least)
diff --git a/bot/__main__.py b/bot/__main__.py
index 76e3f5e1587..ace1d75dd4b 100644
--- a/bot/__main__.py
+++ b/bot/__main__.py
@@ -107,7 +107,7 @@ def bot_help(update, context):
/{BotCommands.CloneCommand}: Copy file/folder to Google Drive
-/{BotCommands.CountCommand}: Count files/folders of G-Drive Links
+/{BotCommands.CountCommand}: Count file/folder of Google Drive Links
/{BotCommands.DeleteCommand} [link]: Delete file from Google Drive (Only Owner & Sudo)
@@ -161,7 +161,7 @@ def bot_help(update, context):
/{BotCommands.CloneCommand}: Copy file/folder to Google Drive
-/{BotCommands.CountCommand}: Count files/folders of G-Drive Links
+/{BotCommands.CountCommand}: Count file/folder of Google Drive Links
/{BotCommands.WatchCommand} [youtube-dl supported link]: Mirror through youtube-dl. Click /{BotCommands.WatchCommand} for more help.
@@ -197,6 +197,7 @@ def bot_help(update, context):
BotCommand(f'{BotCommands.TarMirrorCommand}','Upload tar (zipped) file'),
BotCommand(f'{BotCommands.UnzipMirrorCommand}','Extract files'),
BotCommand(f'{BotCommands.CloneCommand}','Copy file/folder to Drive'),
+BotCommand(f'{BotCommands.CountCommand}','Count file/folder of Drive Links'),
BotCommand(f'{BotCommands.WatchCommand}','Mirror YT-DL support link'),
BotCommand(f'{BotCommands.TarWatchCommand}','Mirror Youtube playlist link as tar'),
BotCommand(f'{BotCommands.CancelMirror}','Cancel a task'),
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index fec886a562d..ab9d78e950d 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -323,9 +323,9 @@ def clone(self, link):
dir_id = self.create_directory(meta.get('name'), parent_id)
result = self.cloneFolder(meta.get('name'), meta.get('name'), meta.get('id'), dir_id)
msg += f'Filename: {meta.get("name")}
\nSize: {get_readable_file_size(self.transferred_size)}
'
- msg += f"\n\nType : Folder"
- msg += f"\nSubFolders : {self.total_folders}"
- msg += f"\nFiles : {self.total_files}"
+ msg += f'\n\nType: Folder'
+ msg += f'\nSubFolders: {self.total_folders}'
+ msg += f'\nFiles: {self.total_files}'
durl = self.__G_DRIVE_DIR_BASE_DOWNLOAD_URL.format(dir_id)
buttons = button_build.ButtonMaker()
if SHORTENER is not None and SHORTENER_API is not None:
@@ -363,7 +363,7 @@ def clone(self, link):
typeee = 'File'
try:
msg += f'\nSize: {get_readable_file_size(int(meta.get("size")))}
'
- msg += f"\n\nType : {typeee}"
+ msg += f'\n\nType: {typeee}'
except TypeError:
pass
if INDEX_URL is not None:
@@ -612,13 +612,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'Filename : {name}
'
- msg += f'\n\nSize : {get_readable_file_size(self.total_bytes)}'
- msg += f"\n\nType : Folder"
- msg += f"\nSubFolders : {self.total_folders}"
- msg += f"\nFiles : {self.total_files}"
+ msg += f'Filename: {name}
'
+ msg += f'\nSize: {get_readable_file_size(self.total_bytes)}'
+ msg += f'\n\nType: Folder'
+ msg += f'\nSubFolders: {self.total_folders}'
+ msg += f'\nFiles: {self.total_files}'
else:
- msg += f'Filename : {name}
'
+ msg += f'Filename: {name}
'
try:
typee = drive_file['mimeType']
except:
@@ -626,9 +626,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'\nSize: {get_readable_file_size(self.total_bytes)}
'
+ msg += f'\n\nType: {typee}'
+ msg += f'\nFiles: {self.total_files}'
except TypeError:
pass
except Exception as err:
diff --git a/config_sample.env b/config_sample.env
index c05c38d8a20..babf78491d6 100644
--- a/config_sample.env
+++ b/config_sample.env
@@ -11,7 +11,7 @@ AUTO_DELETE_MESSAGE_DURATION = 20
IS_TEAM_DRIVE = ""
TELEGRAM_API =
TELEGRAM_HASH = ""
-DATABASE_URL = "" #Leave this empty if You deploying on heroku with PostgreSQL, for using another database with Heroku just make the name of the var (DATABASE_URL), for vps You must fill database url here
+DATABASE_URL = "" #Leave this empty if You deploying on Heroku with PostgreSQL, for using another database with Heroku just make the name of the var (DATABASE_URL), for vps You must fill database url here
# Optional config
AUTHORIZED_CHATS = ""
USE_SERVICE_ACCOUNTS = ""