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

qBittorrent API v2 #6505

Closed
andreadistefano opened this issue Apr 13, 2019 · 12 comments
Closed

qBittorrent API v2 #6505

andreadistefano opened this issue Apr 13, 2019 · 12 comments

Comments

@andreadistefano
Copy link

Is your feature request related to a problem? Please describe.
Using the latest qBittorrent builds from the unstable repo, Medusa cannot download torrents. I think the old APIs are now deprecated.

Describe the solution you'd like
Upgrade the qBittorrent client to use API v2. I did it on my local qbittorrent.py file (just changed the _add_torrent_uri and _add_torrent_file methods), but I'm not confident enough to submit a PR.

@triage-new-issues triage-new-issues bot added the triage Untriaged issue label Apr 13, 2019
@p0psicles
Copy link
Contributor

Youll have to add a method that will get the api version first. Then then based on that you can switch between apis.

@medariox
Copy link
Contributor

Just submit your code. I'm sure it's going to be fine. We will help if needed.

@triage-new-issues triage-new-issues bot removed the triage Untriaged issue label Apr 14, 2019
@andreadistefano
Copy link
Author

I uploaded my code here https://gist.github.com/andystevens91/3067a6241a3e6c29ba140dad74e1af50
It's not fancy, there is no API version check, and I manually insert the 'tv' category because that's what I use on my server.

@sharkykh
Copy link
Contributor

In case this helps, my attempt at this from a year ago:
develop...sharkykh:feature/qbittorrent-api-v2

While the authentication side of the code isn't finished,
I did put in some of the changes needed for API v2.

P.S.
I think that the new code should still support API v1 (only if API v2 isn't available).

@andreadistefano
Copy link
Author

Your code is mostly working, though I got
TypeError: a bytes-like object is required, not 'str'
on line 47
version = map(int, version.content.split('.'))

i fixed it in this way, which is surely the worst way to do that, but works for me:

try:
    version = map(int, version.content.split('.'))  
        if len(version) < 2:  
            version.append(0)  
            return tuple(version)  
except TypeError:  
    return (2, 0, 0)  

@p0psicles
Copy link
Contributor

Can you post the stack trace of that? Also I assume you use python3?

@sharkykh
Copy link
Contributor

Try just changing that line to: version = map(int, version.text.split('.'))

@andreadistefano
Copy link
Author

Try just changing that line to: version = map(int, version.text.split('.'))

That works!

@medariox
Copy link
Contributor

medariox commented May 2, 2019

It would be great to have a PR with these changes for the next version.

@hferreira23
Copy link

Hi all,

Any progress on this? qbittorrent 4.2.0 doesn't work with medusa right now

2019-08-07 07:43:53 WARNING SNATCHQUEUE-SNATCH-323420 :: [74c3f12] qbittorrent: Unable to send Torrent 2019-08-07 07:43:53 INFO SNATCHQUEUE-SNATCH-323420 :: [74c3f12] qbittorrent: Not Found

I tried both @sharkykh and @andystevens91 qbittorrent.py besides the default one present in medusa master branch. All return this error.

qbittorrent API version is 2.2

@p0psicles
Copy link
Contributor

I'll try to finish it this week

@sharkykh
Copy link
Contributor

sharkykh commented Aug 8, 2019

Just FYI, qBittorrent version 4.2.0 is still in alpha, current (stable) version is 4.1.7 and it still fully supports the v1 API.

@sharkykh sharkykh closed this as completed Dec 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants