diff --git a/bot/helper/mirror_utils/download_utils/aria2_download.py b/bot/helper/mirror_utils/download_utils/aria2_download.py index 2392e6f..30d5c83 100644 --- a/bot/helper/mirror_utils/download_utils/aria2_download.py +++ b/bot/helper/mirror_utils/download_utils/aria2_download.py @@ -22,10 +22,8 @@ class AriaDownloadHelper: if STOP_DUPLICATE and dl is not None: LOGGER.info('Checking File/Folder if already in Drive...') sname = aria2.get_download(gid).name - if dl.getListener().isTar and dl.getListener().isZip: - sname = sname + ".zip" - elif dl.getListener().isTar: - sname = sname + ".tar" + if dl.getListener().isTar: + sname = sname + ".zip" if dl.getListener().isZip else sname + ".tar" if dl.getListener().extract: smsg = None else: diff --git a/bot/helper/mirror_utils/download_utils/mega_downloader.py b/bot/helper/mirror_utils/download_utils/mega_downloader.py index 503c2b8..d9e7699 100644 --- a/bot/helper/mirror_utils/download_utils/mega_downloader.py +++ b/bot/helper/mirror_utils/download_utils/mega_downloader.py @@ -170,10 +170,8 @@ class MegaDownloadHelper: if STOP_DUPLICATE: LOGGER.info('Checking File/Folder if already in Drive') mname = node.getName() - if listener.isTar and listener.isZip: - mname = mname + ".zip" - elif listener.isTar: - mname = mname + ".tar" + if listener.isTar: + mname = mname + ".zip" if listener.isZip else mname + ".tar" if listener.extract: smsg = None else: diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py index 8ce5299..3ff359b 100644 --- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py +++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py @@ -625,11 +625,13 @@ class GoogleDriveHelper: if self.stopDup: query = f"name = '{fileName}' and " else: - query = "" fileName = fileName.split(' ') - for name in fileName: - if name != '': - query += f"name contains '{name}' and " + query = "".join( + f"name contains '{name}' and " + for name in fileName + if name != '' + ) + query += "trashed = false" if parent_id == "root": return ( @@ -733,7 +735,11 @@ class GoogleDriveHelper: msg += f"Drive Link" if INDEX_URLS[index] is not None: if RECURSIVE_SEARCH: - url_path = "/".join([requests.utils.quote(n, safe='') for n in self.get_recursive_list(file, parent_id)]) + url_path = "/".join( + requests.utils.quote(n, safe='') + for n in self.get_recursive_list(file, parent_id) + ) + else: url_path = requests.utils.quote(f'{file.get("name")}') url = f'{INDEX_URLS[index]}/{url_path}' diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py index 816e1b3..7377dda 100644 --- a/bot/modules/mirror.py +++ b/bot/modules/mirror.py @@ -299,8 +299,14 @@ def _mirror(bot, update, isTar=False, extract=False, isZip=False, isQbit=False): not bot_utils.is_url(link) and not bot_utils.is_magnet(link) or len(link) == 0 - ) and file is not None: - if isQbit: + ): + if file is None: + reply_text = reply_to.text + reply_text = re.split('\n ', reply_text)[0] + if bot_utils.is_url(reply_text) or bot_utils.is_magnet(reply_text): + link = reply_text + + elif isQbit: file_name = str(time.time()).replace(".", "") + ".torrent" file.get_file().download(custom_path=f"{file_name}") link = f"{file_name}" @@ -312,16 +318,6 @@ def _mirror(bot, update, isTar=False, extract=False, isZip=False, isQbit=False): return else: link = file.get_file().file_path - elif ( - not bot_utils.is_url(link) - and not bot_utils.is_magnet(link) - or len(link) == 0 - ) and file is None: - reply_text = reply_to.text - reply_text = re.split('\n ', reply_text)[0] - if bot_utils.is_url(reply_text) or bot_utils.is_magnet(reply_text): - link = reply_text - if bot_utils.is_url(link) and not bot_utils.is_magnet(link) and not os.path.exists(link) and isQbit: resp = requests.get(link) if resp.status_code == 200: