-
-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- This adds support for archiving and extracting data from Google Drive - Add password support in compress module - Add command description in clone, compress and list module - Switch base image to Ubuntu 22.04 - Fix bugs - Tidy up
- Loading branch information
Showing
28 changed files
with
1,468 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import random | ||
import string | ||
|
||
from bot import LOGGER, COMPRESS_LIMIT, download_dict, download_dict_lock | ||
from bot.helper.drive_utils.gdriveTools import GoogleDriveHelper | ||
from bot.helper.status_utils.download_status import DownloadStatus | ||
from bot.helper.telegram_helper.message_utils import sendMessage, deleteMessage, sendStatusMessage | ||
from bot.helper.ext_utils.bot_utils import get_readable_file_size | ||
|
||
def add_gd_download(link, listener, is_appdrive, appdict, is_gdtot): | ||
msg = sendMessage(f"<b>Checking:</b> <code>{link}</code>", listener.bot, listener.message) | ||
LOGGER.info(f"Checking: {link}") | ||
gd = GoogleDriveHelper() | ||
res, size, name, files = gd.helper(link) | ||
deleteMessage(listener.bot, msg) | ||
if res != "": | ||
return sendMessage(res, listener.bot, listener.message) | ||
if COMPRESS_LIMIT is not None: | ||
if size > COMPRESS_LIMIT * 1024**3: | ||
msg2 = f"<b>Name:</b> <code>{name}</code>" | ||
msg2 += f"\n<b>Size:</b> {get_readable_file_size(size)}" | ||
msg2 += f"\n<b>Limit:</b> {COMPRESS_LIMIT} GB" | ||
msg2 += "\n\n<b>⚠️ Task failed</b>" | ||
return sendMessage(msg2, listener.bot, listener.message) | ||
LOGGER.info(f"Downloading: {name}") | ||
drive = GoogleDriveHelper(name, listener) | ||
gid = ''.join(random.SystemRandom().choices(string.ascii_letters + string.digits, k=12)) | ||
download_status = DownloadStatus(drive, size, listener, gid) | ||
with download_dict_lock: | ||
download_dict[listener.uid] = download_status | ||
sendStatusMessage(listener.message, listener.bot) | ||
drive.download(link) | ||
if is_appdrive: | ||
if appdict.get('link_type') == 'login': | ||
LOGGER.info(f"Deleting: {link}") | ||
drive.deleteFile(link) | ||
elif is_gdtot: | ||
LOGGER.info(f"Deleting: {link}") | ||
drive.deleteFile(link) |
Oops, something went wrong.