rembo10 / headphones

Automatic music downloader for SABnzbd
GNU General Public License v3.0
3.36k stars 602 forks source link

Headphones doesn't support QBittorent API v2.0+ #3237

Open johnnyxmas opened 4 years ago

johnnyxmas commented 4 years ago

WebAPI v2.0 was rolled out with QBitorrent 4.1 and was significant enough to break all ability for Headphones to interact with it:

API Documentation: https://github.com/qbittorrent/qBittorrent/wiki/Web-API-Documentation

raymondjstone commented 4 years ago
2020-01-15 06:55:42 ERROR Uncaught exception: Traceback (most recent call last): File "D:\Media\headphones-master\headphones\logger.py", line 214, in new_run old_run(*args, *kwargs) File "C:\Python27amd64\lib\threading.py", line 754, in run self.__target(self.args, **self.kwargs) File "D:\Media\headphones-master\headphones\searcher.py", line 227, in searchforalbum do_sorted_search(album, new, losslessOnly) File "D:\Media\headphones-master\headphones\searcher.py", line 339, in do_sorted_search send_to_downloader(data, bestqual, album) File "D:\Media\headphones-master\headphones\searcher.py", line 1022, in send_to_downloader folder_name = qbittorrent.getName(torrentid) File "D:\Media\headphones-master\headphones\qbittorrent.py", line 210, in getName for torrent in torrentlist:TypeError: 'NoneType' object is not iterable
2020-01-15 06:55:32 INFO Sending torrent to QBiTorrent
johnnyxmas commented 4 years ago

Debug output showing issue is due to QBittorrent WebUi API 404 (because API was changed after v4.0.4):

2020-02-29 15:54:04 ERROR Uncaught exception: Traceback (most recent call last):File "c:\Program Files\headphones\headphones\logger.py", line 214, in new_runold_run(*args, *kwargs)File "C:\Python27\lib\threading.py", line 754, in runself.__target(self.args, **self.kwargs)File "c:\Program Files\headphones\headphones\searcher.py", line 227, in searchforalbumdo_sorted_search(album, new, losslessOnly)File "c:\Program Files\headphones\headphones\searcher.py", line 339, in do_sorted_searchsend_to_downloader(data, bestqual, album)File "c:\Program Files\headphones\headphones\searcher.py", line 1022, in send_to_downloaderfolder_name = qbittorrent.getName(torrentid)File "c:\Program Files\headphones\headphones\qbittorrent.py", line 210, in getNamefor torrent in torrentlist:TypeError: 'NoneType' object is not iterable
2020-02-29 15:54:04 DEBUG QBitTorrent webUI raised the following error: HTTP Error 404: Not Found
2020-02-29 15:54:04 DEBUG Failed URL: http://127.0.0.1:8081/query/torrents
2020-02-29 15:54:04 DEBUG None
2020-02-29 15:54:04 DEBUG {}
2020-02-29 15:54:04 DEBUG QBittorrent WebAPI Command: query/torrents
2020-02-29 15:53:54 DEBUG Error getting SID. qBittorrent responded with error: Not Found
2020-02-29 15:53:54 DEBUG getName(9bc7b40fbe9dbe7fc740f57e62985cf7f59f8e97)
2020-02-29 15:53:54 DEBUG QBitTorrent webUI raised the following error: HTTP Error 404: Not Found
2020-02-29 15:53:54 DEBUG Failed URL: http://127.0.0.1:8081/command/download
2020-02-29 15:53:54 DEBUG --6E1c7BB3kfyCmVygWeHys95F3s5PNNContent-Disposition: form-data; name="category"headphones--6E1c7BB3kfyCmVygWeHys95F3s5PNNContent-Disposition: form-data; name="savepath"E:\Torrents\headphones--6E1c7BB3kfyCmVygWeHys95F3s5PNNContent-Disposition: form-data; name="urls"magnet:?xt=urn:btih:9bc7b40fbe9dbe7fc740f57e62985cf7f59f8e97&dn=Gorillaz+-+Discography+%2B+Song+Machine+Ep.+2+-+2020+-+320kbps&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969--6E1c7BB3kfyCmVygWeHys95F3s5PNN--
2020-02-29 15:53:54 DEBUG {"Content-Length": "675","Content-Type": "multipart/form-data; boundary=6E1c7BB3kfyCmVygWeHys95F3s5PNN"}
2020-02-29 15:53:54 DEBUG --6E1c7BB3kfyCmVygWeHys95F3s5PNNContent-Disposition: form-data; name="category"headphones--6E1c7BB3kfyCmVygWeHys95F3s5PNNContent-Disposition: form-data; name="savepath"E:\Torrents\headphones--6E1c7BB3kfyCmVygWeHys95F3s5PNNContent-Disposition: form-data; name="urls"magnet:?xt=urn:btih:9bc7b40fbe9dbe7fc740f57e62985cf7f59f8e97&dn=Gorillaz+-+Discography+%2B+Song+Machine+Ep.+2+-+2020+-+320kbps&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969
2020-02-29 15:53:54 DEBUG encode_multipart()
2020-02-29 15:53:54 DEBUG QBittorrent WebAPI Command: command/download
2020-02-29 15:53:54 DEBUG Error getting SID. qBittorrent responded with error: Not Found
2020-02-29 15:53:54 DEBUG addTorrent(magnet:?xt=urn:btih:9bc7b40fbe9dbe7fc740f57e62985cf7f59f8e97&dn=Gorillaz+-+Discography+%2B+Song+Machine+Ep.+2+-+2020+-+320kbps&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969)
2020-02-29 15:53:54 INFO Sending torrent to QBiTorrent
Squantchies commented 4 years ago

I am having the same problem, would love to see an update to correct this issue if possible.

dixonbg commented 4 years ago

There is a python library for qbittorrent v4.1 https://github.com/rmartin16/qbittorrent-api

Squantchies commented 4 years ago

There is a python library for qbittorrent v4.1 https://github.com/rmartin16/qbittorrent-api

Hey thanks for this and sorry for the late reply. I'm not too familiar with Python. I'm running Windows 10 and I believe I installed everything properly as it returned this message:

Successfully installed certifi-2019.11.28 chardet-3.0.4 idna-2.9 qbittorrent-api-0.5.1 requests-2.23.0 urllib3-1.25.8

However the next step says to type "import qbittorrentapi". But command prompt just returns the message:

'import' is not recognized as an internal or external command, operable program or batch file.

What am I doing wrong?

Edit: I'm running Python 3.8.2 and my qbittorrent web UI is working.

johnnyxmas commented 4 years ago

@Squantchies if I had to guess, you’re likely attempting to do that from the Windows command line instead of from within your Python interpreter. Either way, this isn’t the venue for that type of support; this thread is for evidence on locating the source of the problem so new code can be written to correct it. If you’d like to do that, please fork the project, develop the functional code and then submit a Pull Request.

For troubleshooting your personal code, you may want to try somewhere like Stack Overflow.

AdeHub commented 4 years ago

There's a change in Develop for this, could do with some testing

johnnyxmas commented 4 years ago

Confirmed working with qBittorrent 4.2.3 and clone of current Headphones develop branch. Headphones successfully discovered a valid torrent and sent it to qBittorrent, which recognized the command and downloaded the file.

DoubtfulTurnip commented 4 years ago

I'm just wondering if there is a rough timeline for this to be moved into master? I am running the linuxserver docker container for headphones and changing branches doesn't appear to be an option right now.

johnnyxmas commented 4 years ago

Given that there hasn't been a release out of master since 2018, you may just want to switch to Develop perpetually. Just clone that branch and drop your existing config .ini into it. Worked fine for me.

DoubtfulTurnip commented 4 years ago

Sounds good to me. Only issue I have is that I am using the LinuxServer Docker container and there is no tag for the develop branch. I don't think they are going to provide support for one either. I may have to look at creating my own docker container from scratch for the develop branch of headphones but this may be a bit out of my depth.