hekmon / transmissionrpc

Golang bindings for Transmission RPC API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TorrentGetAll fails with Transmission 4

fabiocody opened this issue · comments

The error is 'torrent-get' rpc method failed: can't unmarshall request answer body: json: cannot unmarshal bool into Go struct field torrentGetResults.arguments.torrents of type int64

I call it as torrents, err := transmission.TorrentGetAll(context.TODO())

Everything was working fine until I updated to Transmission 4

That was more or less expected for transmission major version upgrade.

As the README states, this lib follows the RPC v16 version (with retrocompatibility on the v15 version). Transmission v4 seems to have switched to RPC version 17 which this lib does not support (yet ?).

To be honest I have very little free time at the moment and I am not using Transmission anymore. Chances that I implement a new major version of the lib are quite low. Technically this is not a bug because of the explicit RPC version support stated in the README but I will leave this open as a feature request in case I start working on it or someone opens a PR.

I might update the readme to warn people of the incompatibility tho. Thank you for bringing that up.

That was more or less expected for transmission major version upgrade.

As the README states, this lib follows the RPC v16 version (with retrocompatibility on the v15 version). Transmission v4 seems to have switched to RPC version 17 which this lib does not support (yet ?).

To be honest I have very little free time at the moment and I am not using Transmission anymore. Chances that I implement a new major version of the lib are quite low. Technically this is not a bug because of the explicit RPC version support stated in the README but I will leave this open as a feature request in case I start working on it or someone opens a PR.

I might update the readme to warn people of the incompatibility tho. Thank you for bringing that up.

Thanks for updating the read me, I have been working on a tui using this library and was wondering/hoping it would be able to support transmission 4.

Regardless of if you get around to updating it, I appreciate the work you've put into the current version and its been a pleasure to work with this project!

Thank you for your kind words @GianniBYoung !

I hope someone will pick up (PR or fork) the lib. And may be Transmission v4 will be so good that I will use it again in the future ! (therefor I will release a v3). But to be honest, with my newborn child, it won't be anytime soon :)

After doing some quick testing with transmission-4.02 I didn't encounter this error.

My understanding is that they changed one of the fields to use bools instead of ints. More info in this issue.

It looks like the transmission version increase from 16 to 17 shouldn't include any breaking changes (above issue aside) and 4.0 might still be compatible with this project with minor improvements.

Transmission Rpc version docs

@hekmon FWIW this lib has been working fine for me (through autobrr), it appears that this may be the only incompatibility so far. there are missing things from the RPC implementation here but other than that I'm not getting any weird errors in my client.

Working on a patch right now for adding labels to the TorrentAddPayload, but I can try to see if I can work out the incompatibility here as well.

@hekmon FWIW this lib has been working fine for me (through autobrr), it appears that this may be the only incompatibility so far. there are missing things from the RPC implementation here but other than that I'm not getting any weird errors in my client.

Working on a patch right now for adding labels to the TorrentAddPayload, but I can try to see if I can work out the incompatibility here as well.

If you do want to extend the transmission implementation in autobrr (I actually stumbled upon this by chance lol)... that would also be appreciated 😸. I took a stab at it a while ago then lost steam from other issues in my flow. Happy to collab on discord / whatever to get it up to parity.

That is great news @tubbo ! Thanks you for stepping in to keep this lib alive 😊

I won't be able to test your fix for the reason I have stated earlier on this issue but here is what we can do: send a PR with your patch, have some folks (from this issue may be ?) test it and if several validate the changes, I will merge it and release a v3 (I like to change semver major version for RPC version change, it keeps everything simpler for everyone).\

Also it seems that they reverted one of the incompatibility (thx @GianniBYoung ). Does anyone tested it ?

@hekmon FWIW this lib has been working fine for me (through autobrr), it appears that this may be the only incompatibility so far. there are missing things from the RPC implementation here but other than that I'm not getting any weird errors in my client.

Working on a patch right now for adding labels to the TorrentAddPayload, but I can try to see if I can work out the incompatibility here as well.

Same here. I've added the new labels, removed the deprecated ones, and am now working on implementing the group-set and group-get methods for bandwidth groups. You can see my changes at https://github.com/hyperreal64/transmissionrpc.

Would removing the deprecated labels break backwards compatibility with Transmission 3?

Would removing the deprecated labels break backwards compatibility with Transmission 3?

I will let others answer that but that is not an issue on my side: each Transmission RPC version translate to a major semver on this lib.

@fabiocody @fabiocody @tubbo can I kindly ask you guys to check out and test the code proposed by @hyperreal64 in #21 ? As I am unable to test it myself, if you can confirme this PR works I will merge it and tag a new v3 :)

Thank you all for your time and implication while I am unable to do so for now 🙏

I'm about to add a Transmission dashboard integration to Notifiarr using this library. Just throwing it out there in case you need more testers. I have two more here Notifiarr/notifiarr#488

EDIT: I'm trying to figure out how to bring that fork into my project without a replace directive so it can build in GH actions. I'm probably missing something simple. Open to suggestions.

EDIT2: This works; in go.mod, and will presumably work in a GH action build. 🤞

replace github.com/hekmon/transmissionrpc => github.com/hyperreal64/transmissionrpc v0.0.0-20230416162540-2445f445c709

Testing with Transmission 4.0.3 (6b0e49bbb2) on macOS, using TorrentGetAll against master branch of this repo does not produce an error. I also tested the changes @hyperreal64 gave us in #21. No errors, and the output seems to be compatible. I test it by cloning his repo locally and using a local override => ../transmissionrpc. I also pasted in a new struct and entry method to make it easy on myself. The other method my code tests is SessionArgumentsGetAll, which also seems fine and produces no errors. This is my change that does the test for anyone interested.

I only have two torrents in my app. If there are any specific downloads I should test or methods I should try running, I'm down to do more poking. Seems good though.

Closing as TransmissionRPC v3 is out as beta. Please open dedicated issues if you encounter anything with this new release.