Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Download.bittorrent is never None #53

Closed
lzzy12 opened this issue Apr 7, 2020 · 3 comments
Closed

[BUG] Download.bittorrent is never None #53

lzzy12 opened this issue Apr 7, 2020 · 3 comments
Assignees

Comments

@lzzy12
Copy link

lzzy12 commented Apr 7, 2020

When I try to download something with HTTP (not torrent), I expect the Download.bittorrent to be None however this is never the case.
Here is Download._struct for https://speed.hetzner.de/100MB.bin

{'completedLength': '0', 'connections': '1', 'dir': '/home/shivam/downloads//816/', 'downloadSpeed': '0', 'files': [{'completedLength': '0', 'index': '1', 'length': '0', 'path': '', 'selected': 'true', 'uris': [{'status': 'used', 'uri': 'https://speed.hetzner.de/100MB.bin'}, {'status': 'waiting', 'uri': 'https://speed.hetzner.de/100MB.bin'}, {'status': 'waiting', 'uri': 'https://speed.hetzner.de/100MB.bin'}, {'status': 'waiting', 'uri': 'https://speed.hetzner.de/100MB.bin'}, {'status': 'waiting', 'uri': 'https://speed.hetzner.de/100MB.bin'}, {'status': 'waiting', 'uri': 'https://speed.hetzner.de/100MB.bin'}, {'status': 'waiting', 'uri': 'https://speed.hetzner.de/100MB.bin'}, {'status': 'waiting', 'uri': 'https://speed.hetzner.de/100MB.bin'}, {'status': 'waiting', 'uri': 'https://speed.hetzner.de/100MB.bin'}, {'status': 'waiting', 'uri': 'https://speed.hetzner.de/100MB.bin'}]}], 'gid': 'be0fa29b8fbc0c96', 'numPieces': '0', 'pieceLength': '1048576', 'status': 'active', 'totalLength': '0', 'uploadLength': '0', 'uploadSpeed': '0'}

While here is the Download._struct when a torrent is added:

{'bittorrent': {'announceList': [['http://nyaa.tracker.wf:7777/announce'], ['udp://open.stealth.si:80/announce'], ['udp://tracker.opentrackr.org:1337/announce'], ['udp://tracker.coppersurfer.tk:6969/announce'], ['udp://exodus.desync.com:6969/announce']]}, 'completedLength': '0', 'connections': '0', 'dir': '/home/shivam/downloads//817/', 'downloadSpeed': '0', 'files': [{'completedLength': '0', 'index': '1', 'length': '0', 'path': '[METADATA][Anime Time] Princess Connect! ReDive - 1 [720p].mp4', 'selected': 'true', 'uris': []}], 'gid': 'df71125cecd63d13', 'infoHash': '985e7f658509dca05b6b1560a4213950b11b7373', 'numPieces': '0', 'numSeeders': '0', 'pieceLength': '16384', 'seeder': 'false', 'status': 'active', 'totalLength': '0', 'uploadLength': '0', 'uploadSpeed': '0'}
@pawamoy
Copy link
Owner

pawamoy commented Apr 7, 2020

Thank you for the report @lzzy12!

I will add a is_torrent method that checks if the bittorrent key is in self._struct.

Additionally we could make the bittorrent property return None instead of an "empty" BitTorrent instance, what do you think?

@lzzy12
Copy link
Author

lzzy12 commented Apr 7, 2020

Additionally we could make the bittorrent property return None instead of an "empty" BitTorrent instance, what do you think?

Yeah that would make more sense

@pawamoy pawamoy self-assigned this Apr 7, 2020
pawamoy added a commit that referenced this issue Apr 8, 2020
…sent

BREAKING CHANGE: this could be a breaking change if your code does not
check if `download.bittorrent` is an instance of `BitTorrent`
before accessing its attributes.

Reference: issue #53.
pawamoy added a commit that referenced this issue Apr 8, 2020
@pawamoy
Copy link
Owner

pawamoy commented Apr 8, 2020

Implemented in v0.9.0. download.bittorrent will now return None if the "bittorrent" key is not in the _struct dictionary. This release also adds the download.is_torrent property.

@pawamoy pawamoy closed this as completed Apr 8, 2020
lzzy12 added a commit to lzzy12/python-aria-mirror-bot that referenced this issue Apr 8, 2020
Download.is_torrent introduced in aria2p v0.9.0
pawamoy/aria2p#53

Signed-off-by: lzzy12 <[email protected]>
lzzy12 added a commit to lzzy12/python-aria-mirror-bot that referenced this issue Apr 8, 2020
Download.is_torrent introduced in aria2p v0.9.0
pawamoy/aria2p#53

Signed-off-by: lzzy12 <[email protected]>
arlessweschler added a commit to arlessweschler/magneto-python-aria that referenced this issue Apr 28, 2021
* Fix logging error

* [Hotfix] Fix bug where the link have 302 request are treated as torrents

Download.is_torrent introduced in aria2p v0.9.0
pawamoy/aria2p#53

Signed-off-by: lzzy12 <[email protected]>

* Fixed Typo in ReadMe (#75)

* README: Drop using buggy snap package for installing docker

* Use local fork of youtube-dl for hotstar fix

* Fixed Docker build error

* Optimize Clone implementation

* Implement Centralized Aria Websocket Listener

Signed-off-by: lzzy12 <[email protected]>

* Revert "Implement mega.nz support"

This reverts commit 45f75fb.

* Fixed Dockerfile

* Fix /list if fileName string contains multiple quotes (#141)

* Fixed Typo (#128)

* Merge upstream youtube-dl

Signed-off-by: lzzy12 <[email protected]>

* added ability of extracting .7z files (#144)

* Some changes and fixup

* added ability of extracting iso, wim and many other filetypes (see READMe)

* Added overall DL, UL speed in /status. Thanks to [Dark Soul](https://t.me/iamvishalg)

* Fix: status message on no active downloads was showing cpu stats

* Added option to disable mega.nz links (config_sample.env)

* Enable faulthandler

* Mega: Fix folder downloads with mega account

* message_utils: handle edge case

* Added support of jiosaavn, tiktok, instagram reels

Support of tiktok without watermark videos

* Updated ubuntu version to get latest packages

This fixes #158

* Added url Shorteners support (Optional)

* Update README.md

* Some peps were facing issue in generating string session.

* Added separate requirements list for setup scripts

* Fixed Extraction (#166)

* Changed Youtube-dl's repo (Note :- Tiktok broken)

* Update requirements.txt (#177)

Due to youtube dl repo takedown git+git://github.com/lzzy12/youtube-dl@d7c2b43#youtube_dl is not working while replacing it with youtube_dl seems to work as pip install youtube_dl is still up.

* Added quality option in /watch command

* Try to fix 0B size shown by YTDL

Size while downloading has not been fixed yet. So it can show double size while downloading and will not show Total size. I have fixed total size while uploading and after upload. I have also fixed wrong file size after uplaod of extracted items. Sometime size is greater than compressed file after extracting compressed files. Now it will show correct file size

* Fix Typo

* Fix Typo

* Bye.... (◕‿◕)

* Now you can write quality with yt-dl supported links (#178)

* Fixed the missing module 'appdirs'

* updates soon....

* Added Support for Custom FileName

* Fix restart if user has not mirrored anything (#204)

* Added: Extract Password Protected Archive Files

* Some fixup in STOP_DUPLICATE_MIRROR

* Fix Telegram file tar and unzipmirror issue.

* Fix TG file unzipmirror issue (Close #174) (#206)

* Many minor bug fixes

* Added AUTHORIZED_CHATS in config (env. variables)

* Auto generate String Session and Telegraph Token

* Fix restart if user has not mirrored anything

* Random name while generating Telegraph Token

* Fix None FileName in mirroring some TG File

* MEGA: Handle TransferTempError (#210)

* Official client retires the transfer until max tries while streaming

* Don't break the transfer chain if a transfer is retrying or queued

* Cancelling the download causes a Segmentation fault

Co-authored-by: Kandarp Tandel <[email protected]>

* Mega.nz: keep listener reference in global list

* Mega.nz: try to fix dead link bot crash issue

* requirements.txt: use pyrogram v0.18.0 to fix flood wait exceptions

pyrogram.client.client - ERROR - [420 FLOOD_WAIT_X]: A wait of 3 seconds is required (caused by "upload.GetFile")

this exceptions was fixed in this commit in version v0.18.0
pyrogram/pyrogram@99aee98

* treewide: prepare for dependency updates

this commit is a squash of the following:

- filters: inherit from MessageFilter
- replace @run_async decorator with Dispatcher.run_async
- start/restart: remove pickle usage
- start/restart: update status message if bot restarts
- store pyrogram session in memory instead of making a new one everytime

Signed-off-by: KenHV <[email protected]>

* requirements: relax all version constraints

Signed-off-by: KenHV <[email protected]>

* treewide: upgrade codebase to 3.9+ syntax

Signed-off-by: KenHV <[email protected]>

* youtube_dl: fix geo bypass for hotstar and sonyliv

the previous syntax was not the proper way to check
for a substring in a string.

Signed-off-by: KenHV <[email protected]>

* init: fix trailing backslash check for DOWNLOAD_DIR

the previous check always results in True.

Signed-off-by: KenHV <[email protected]>

* restart: use execl() to spawn a new process

Signed-off-by: KenHV <[email protected]>

* direct_link_generator: fix zippyshare

Signed-off-by: KenHV <[email protected]>

* Fix Index URL encode problem

* Added support for password protected index links

* Added mega support using megasdkrest

https://github.com/jaskaranSM/megasdkrest
Signed-off-by: lzzy12 <[email protected]>

* Add venv folder to gitignore

Signed-off-by: lzzy12 <[email protected]>

* Call onDownloadProgress every second

Signed-off-by: lzzy12 <[email protected]>

* Add Dockerfile setup for mega

Signed-off-by: lzzy12 <[email protected]>

* Mega: Fix up

Signed-off-by: lzzy12 <[email protected]>

* Mega: Fix dead lock due to double mutex

Signed-off-by: lzzy12 <[email protected]>

* Docker,Mega: Fixed curl not handling redirects

Signed-off-by: lzzy12 <[email protected]>

* Mega,aria2: Fix path string manipulation

Signed-off-by: lzzy12 <[email protected]>

* Mega: Fixed cancellation of downloads

Signed-off-by: lzzy12 <[email protected]>

* Mega: Updated Readme and config_sample with mega changes

Signed-off-by: lzzy12 <[email protected]>

* Mega: Wait for the mega rest server to start listening before calling the API

Signed-off-by: lzzy12 <[email protected]>

* /cancel command msg fix

Co-authored-by: Shivam Jha <[email protected]>
Co-authored-by: Adyatan <[email protected]>
Co-authored-by: jaskaranSM <[email protected]>
Co-authored-by: Shubham dubey <[email protected]>
Co-authored-by: Adnan Ahmad <[email protected]>
Co-authored-by: Dev Singh Rajput <[email protected]>
Co-authored-by: SVR666 <[email protected]>
Co-authored-by: magneto261290 <[email protected]>
Co-authored-by: Sawan Kumar <[email protected]>
Co-authored-by: VegitoUchiha <[email protected]>
Co-authored-by: Jovan Ferryal E. F <[email protected]>
Co-authored-by: Samir <[email protected]>
Co-authored-by: Arsalan <[email protected]>
Co-authored-by: Kandarp Tandel <[email protected]>
Co-authored-by: Billaids <[email protected]>
Co-authored-by: Vishal <[email protected]>
Co-authored-by: KenHV <[email protected]>
Co-authored-by: TheFierceWarrior <[email protected]>
Co-authored-by: FA Tulloh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants