'Refactored by Sourcery'
This commit is contained in:
parent
ad5ffbf70e
commit
f3c751e20d
|
|
@ -22,10 +22,8 @@ class AriaDownloadHelper:
|
||||||
if STOP_DUPLICATE and dl is not None:
|
if STOP_DUPLICATE and dl is not None:
|
||||||
LOGGER.info('Checking File/Folder if already in Drive...')
|
LOGGER.info('Checking File/Folder if already in Drive...')
|
||||||
sname = aria2.get_download(gid).name
|
sname = aria2.get_download(gid).name
|
||||||
if dl.getListener().isTar and dl.getListener().isZip:
|
if dl.getListener().isTar:
|
||||||
sname = sname + ".zip"
|
sname = sname + ".zip" if dl.getListener().isZip else sname + ".tar"
|
||||||
elif dl.getListener().isTar:
|
|
||||||
sname = sname + ".tar"
|
|
||||||
if dl.getListener().extract:
|
if dl.getListener().extract:
|
||||||
smsg = None
|
smsg = None
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -170,10 +170,8 @@ class MegaDownloadHelper:
|
||||||
if STOP_DUPLICATE:
|
if STOP_DUPLICATE:
|
||||||
LOGGER.info('Checking File/Folder if already in Drive')
|
LOGGER.info('Checking File/Folder if already in Drive')
|
||||||
mname = node.getName()
|
mname = node.getName()
|
||||||
if listener.isTar and listener.isZip:
|
if listener.isTar:
|
||||||
mname = mname + ".zip"
|
mname = mname + ".zip" if listener.isZip else mname + ".tar"
|
||||||
elif listener.isTar:
|
|
||||||
mname = mname + ".tar"
|
|
||||||
if listener.extract:
|
if listener.extract:
|
||||||
smsg = None
|
smsg = None
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -625,11 +625,13 @@ class GoogleDriveHelper:
|
||||||
if self.stopDup:
|
if self.stopDup:
|
||||||
query = f"name = '{fileName}' and "
|
query = f"name = '{fileName}' and "
|
||||||
else:
|
else:
|
||||||
query = ""
|
|
||||||
fileName = fileName.split(' ')
|
fileName = fileName.split(' ')
|
||||||
for name in fileName:
|
query = "".join(
|
||||||
if name != '':
|
f"name contains '{name}' and "
|
||||||
query += f"name contains '{name}' and "
|
for name in fileName
|
||||||
|
if name != ''
|
||||||
|
)
|
||||||
|
|
||||||
query += "trashed = false"
|
query += "trashed = false"
|
||||||
if parent_id == "root":
|
if parent_id == "root":
|
||||||
return (
|
return (
|
||||||
|
|
@ -733,7 +735,11 @@ class GoogleDriveHelper:
|
||||||
msg += f"<b><a href={furl}>Drive Link</a></b>"
|
msg += f"<b><a href={furl}>Drive Link</a></b>"
|
||||||
if INDEX_URLS[index] is not None:
|
if INDEX_URLS[index] is not None:
|
||||||
if RECURSIVE_SEARCH:
|
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:
|
else:
|
||||||
url_path = requests.utils.quote(f'{file.get("name")}')
|
url_path = requests.utils.quote(f'{file.get("name")}')
|
||||||
url = f'{INDEX_URLS[index]}/{url_path}'
|
url = f'{INDEX_URLS[index]}/{url_path}'
|
||||||
|
|
|
||||||
|
|
@ -299,8 +299,14 @@ def _mirror(bot, update, isTar=False, extract=False, isZip=False, isQbit=False):
|
||||||
not bot_utils.is_url(link)
|
not bot_utils.is_url(link)
|
||||||
and not bot_utils.is_magnet(link)
|
and not bot_utils.is_magnet(link)
|
||||||
or len(link) == 0
|
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_name = str(time.time()).replace(".", "") + ".torrent"
|
||||||
file.get_file().download(custom_path=f"{file_name}")
|
file.get_file().download(custom_path=f"{file_name}")
|
||||||
link = f"{file_name}"
|
link = f"{file_name}"
|
||||||
|
|
@ -312,16 +318,6 @@ def _mirror(bot, update, isTar=False, extract=False, isZip=False, isQbit=False):
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
link = file.get_file().file_path
|
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:
|
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)
|
resp = requests.get(link)
|
||||||
if resp.status_code == 200:
|
if resp.status_code == 200:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue