Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

Commit

Permalink
v4.4 (#31)
Browse files Browse the repository at this point in the history
- Fix typo
- Automatic stopped after 300 second if dead torrent
- Stop clone gdrive link limit
  • Loading branch information
breakdowns authored Mar 22, 2021
1 parent faf2d51 commit e3adb19
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ python3 generate_drive_token.py

## Deployment

Give Star & Fork this repo, than upload **token.pickle** to your forks
Give Star & Fork this repo, then upload **token.pickle** to your forks

<p><a href="https://heroku.com/deploy"> <img src="https://www.herokucdn.com/deploy/button.svg" alt="Deploy to Heroku" /></a></p>

Expand Down
2 changes: 1 addition & 1 deletion aria.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export MAX_CONCURRENT_DOWNLOADS=7

aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port 6800 --check-certificate=false\
--max-connection-per-server=10 --rpc-max-request-size=1024M \
--bt-tracker="[$tracker_list]" --bt-max-peers=0 --seed-time=0.01 --min-split-size=10M \
--bt-tracker="[$tracker_list]" --bt-max-peers=0 --bt-tracker-connect-timeout=300 --bt-stop-timeout=300 --seed-time=0.01 --min-split-size=10M \
--follow-torrent=mem --split=10 \
--daemon=true --allow-overwrite=true --max-overall-download-limit=$MAX_DOWNLOAD_SPEED \
--max-overall-upload-limit=1K --max-concurrent-downloads=$MAX_CONCURRENT_DOWNLOADS \
Expand Down
2 changes: 1 addition & 1 deletion bot/helper/mirror_utils/download_utils/aria2_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def __onDownloadPause(self, api, gid):
def __onDownloadStopped(self, api, gid):
LOGGER.info(f"onDownloadStop: {gid}")
dl = getDownloadByGid(gid)
if dl: dl.getListener().onDownloadError('Download stopped by user!')
if dl: dl.getListener().onDownloadError('Dead torrent!')

@new_thread
def __onDownloadError(self, api, gid):
Expand Down
15 changes: 9 additions & 6 deletions bot/helper/mirror_utils/upload_utils/gdriveTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,7 @@ def copyFile(self, file_id, dest_id):
if err.resp.get('content-type', '').startswith('application/json'):
reason = json.loads(err.content).get('error').get('errors')[0].get('reason')
if reason == 'userRateLimitExceeded' or reason == 'dailyLimitExceeded':
if USE_SERVICE_ACCOUNTS:
self.switchServiceAccount()
LOGGER.info(f"Got: {reason}, Trying Again.")
return self.copyFile(file_id,dest_id)
raise err
else:
raise err

Expand Down Expand Up @@ -371,7 +368,13 @@ def clone(self, link):
err = err.last_attempt.exception()
err = str(err).replace('>', '').replace('<', '')
LOGGER.error(err)
return err
if "User rate limit exceeded" in str(err):
msg = "User rate limit exceeded."
elif "File not found" in str(err):
msg = "File not found."
else:
msg = f"Error.\n{err}"
return msg, ""
return msg, InlineKeyboardMarkup(buttons.build_menu(2))

def cloneFolder(self, name, local_path, folder_id, parent_id):
Expand Down Expand Up @@ -501,7 +504,7 @@ def drive_list(self, fileName):
spaces='drive',
pageSize=200,
fields='files(id, name, mimeType, size)',
orderBy='modifiedTime desc').execute()
orderBy='name asc').execute()
content_count = 0
if response["files"]:
msg += f'<h4>{len(response["files"])} Results : {fileName}</h4><br><br>'
Expand Down

0 comments on commit e3adb19

Please sign in to comment.