[SOLVED] WebUIAPI: how to track a base32 infohash download

Other platforms, generic questions.
Post Reply
plinplocho

[SOLVED] WebUIAPI: how to track a base32 infohash download

Post by plinplocho »

Hi all, I'm implementing a simple gui for qbittorrent, using the new WebUIAPI v2. My problem is, when adding a download via a magnet uri, the /command/download method does not return a handle to the download. As I need to track its state (to perform certain file operation once it's finished) I had to resource to the hash contained in the uri. It works ok, except when it's a base32 hash, in such a case, qbittorrent seems to convert it to sha1 and use that for all the api methods. My goal would be to perform myself the conversion so i can match the hash used by bittorrent. I don´t know how to do that (seems trivial in python, but i´m using delphi) Any ideas? Thanks in advance!
[Edit]
I´ve recently added an entry to the wiki with more details about this, it´s here:
https://github.com/qbittorrent/qBittorrent/wiki/How-to-convert-base32-to-base16-info-hashes
Last edited by plinplocho on Thu May 28, 2015 10:32 pm, edited 1 time in total.
plinplocho

Re: WebUIAPI: how to track a base32 infohash download

Post by plinplocho »

Solved myself. All i had to do is decode the hash (originally base32 encoded) and then re-encode it in base16. Just for the record, in delphi I've used SZCodeBaseX library, something like:
    Hash16:= SZEncodeBase16(SZDecodeBase32(Hash32));

Thanks anyway!
User avatar
Nemo
Administrator
Administrator
Posts: 1744
Joined: Sat Jul 24, 2010 6:24 pm

Re: WebUIAPI: how to track a base32 infohash download

Post by Nemo »

Good :). Thanks for writing down the way you have solved it. Might help others who are having the same issue.

And welcome by the way.
plinplocho

Re: WebUIAPI: how to track a base32 infohash download

Post by plinplocho »

Thanks Nemo, let me add that the new webUI api is great!
ciaobaby

Re: WebUIAPI: how to track a base32 infohash download

Post by ciaobaby »

[quote="Nemo"]
Good :). Thanks for writing down the way you have solved it. Might help others who are having the same issue.

[/quote]

Flesh it out a bit and put it up  as a page on the Wiki (http://wiki.qbittorrent.org)
plinplocho

Re: WebUIAPI: how to track a base32 infohash download

Post by plinplocho »

[quote="ciaobaby"]
[quote="Nemo"]
Good :). Thanks for writing down the way you have solved it. Might help others who are having the same issue.

[/quote]

Flesh it out a bit and put it up  as a page on the Wiki (http://wiki.qbittorrent.org)
[/quote]

Let me know if I can help with that
ciaobaby

Re: WebUIAPI: how to track a base32 infohash download

Post by ciaobaby »

[quote="plinplocho"]
[quote="ciaobaby"]
Flesh it out a bit and put it up  as a page on the Wiki (http://wiki.qbittorrent.org)
[/quote]

Let me know if I can help with that
[/quote]

I was rather suggesting that you could do that, :) 

Personally I haven't  done any Delphi programming for over ten years, though as Pascal was the pretty much the first 'serious' language I learned to code in, I do have a bit of a 'soft spot' for Delphi.  ;)
plinplocho

Re: [SOLVED] WebUIAPI: how to track a base32 infohash download

Post by plinplocho »

ok ciaobaby, i´ll try then. English is not my native tongue so it´s a little bit harder for me so i´ll probably ask you for some advice before posting.
ciaobaby

Re: [SOLVED] WebUIAPI: how to track a base32 infohash download

Post by ciaobaby »

Don't worry too much about getting the language precise, there are a few native English speakers (and a some Americans :) )  who can and will edit any grammar, typos or spellnig errors should it need any 'fixing' to hone the document into final shape
plinplocho

Re: [SOLVED] WebUIAPI: how to track a base32 infohash download

Post by plinplocho »

Well, for everyone interested in this, I added an entry to the wiki, the link is in my first post.
Post Reply