Skip to content

Commit

Permalink
[Hotfix] Fix bug where the link have 302 request are treated as torrents
Browse files Browse the repository at this point in the history
Download.is_torrent introduced in aria2p v0.9.0
pawamoy/aria2p#53

Signed-off-by: lzzy12 <[email protected]>
  • Loading branch information
lzzy12 committed Apr 8, 2020
1 parent 6ceb2ea commit b8730f7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions bot/helper/mirror_utils/download_utils/aria2_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ def __onDownloadStarted(self, api, gid):
def __onDownloadComplete(self, api: API, gid):
with self._resource_lock:
if self.gid == gid:
if api.get_download(gid).followed_by_ids:
self.gid = api.get_download(gid).followed_by_ids[0]
download = api.get_download(gid)
if download.followed_by_ids:
self.gid = download.followed_by_ids[0]
with download_dict_lock:
download_dict[self._listener.uid] = AriaDownloadStatus(self.gid, self._listener)
download_dict[self._listener.uid].is_torrent =True
if download.is_torrent:
download_dict[self._listener.uid].is_torrent = True
update_all_messages()
LOGGER.info(f'Changed gid from {gid} to {self.gid}')
else:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ python-telegram-bot==12.2.0
google-api-python-client>=1.7.11,<1.7.20
google-auth-httplib2>=0.0.3,<0.1.0
google-auth-oauthlib>=0.4.1,<0.10.0
aria2p>=0.3.0,<0.10.0
aria2p>=0.9.0,<0.15.0
python-dotenv>=0.10
tenacity>=6.0.0
python-magic

0 comments on commit b8730f7

Please sign in to comment.