posborne / putio-sync

Python daemon that automatically downloads files from put.io
MIT License
29 stars 12 forks source link

Can't add putio-sync as "Transmission" Sonarr Download Client #27

Closed wpearse closed 7 years ago

wpearse commented 8 years ago

It looks like putio-sync is designed (?) to masquerade as Transmission. I'm using Sonarr 2.0.0.3953.

I'm using the tip of the master branch, started using the command python devrun.py -w /media/sf_putio/upload /media/sf_putio/download. Using a Sonarr "TorrentBlackhole" it seems to work fine.

But, when adding a new Transmission download client in Sonarr, I use an IP of localhost and a port of 7001. I leave all other options as default.

The error, when saving is "Failed to get the list of torrents: error". From the Sonarr logs (FWIW) I can see this:

NzbDrone.Core.Download.Clients.Transmission.TransmissionException: error
  at NzbDrone.Core.Download.Clients.Transmission.TransmissionProxy.ProcessRequest (System.String action, System.Object arguments, NzbDrone.Core.Download.Clients.Transmission.TransmissionSettings settings) [0x00134] in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Core\Download\Clients\Transmission\TransmissionProxy.cs:256 
  at NzbDrone.Core.Download.Clients.Transmission.TransmissionProxy.GetTorrentStatus (IEnumerable`1 hashStrings, NzbDrone.Core.Download.Clients.Transmission.TransmissionSettings settings) [0x0007c] in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Core\Download\Clients\Transmission\TransmissionProxy.cs:165 
  at NzbDrone.Core.Download.Clients.Transmission.TransmissionProxy.GetTorrentStatus (NzbDrone.Core.Download.Clients.Transmission.TransmissionSettings settings) [0x00000] in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Core\Download\Clients\Transmission\TransmissionProxy.cs:139 
  at NzbDrone.Core.Download.Clients.Transmission.TransmissionProxy.GetTorrents (NzbDrone.Core.Download.Clients.Transmission.TransmissionSettings settings) <0x8ccc2e8 + 0x0001b> in <filename unknown>:0 
  at NzbDrone.Core.Download.Clients.Transmission.Transmission.TestGetTorrents () [0x00000] in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Core\Download\Clients\Transmission\Transmission.cs:252

So, my questions are:

1) Am I missing some configuration option? 2) Has anyone managed to get this working? (Is it meant to work?)

wpearse commented 8 years ago

OK, so digging through the NzbDrone source, you can test your local putiosync in the same way NzbDrone does using the command:

curl -H "Content-Type: application/json" -X POST -d '{"method":"torrent-get", "arguments":{"fields": ["id","hashString","name","downloadDir","status","totalSize","leftUntilDone","isFinished","eta","errorString"]}}' http://127.0.0.1:7001/transmission/rpc

The response we get from putiosync is:

{"error_description": "'Transfer' object has no attribute 'errorMessage'", "result": "error"}
posborne commented 8 years ago

Hi @wpearse. Yes, transmission masquerade was added but hasn't yet been documented (or tested) to a large degree yet. I am using it with Sonarr as well, but I do know that there are some robustness problems with this particular request type.

I'm pretty busy currently, so I would welcome a PR if you want to take a shot at fixing. First step is probably to log the raw exception in Python (probably place logging in https://github.com/posborne/putio-sync/blob/master/putiosync/webif/transmissionrpc.py#L150). The actual code handling the request should be here: https://github.com/posborne/putio-sync/blob/master/putiosync/webif/transmissionrpc.py#L129. That code attempts to map from the put.io transfer info to that provided by Transmission -- it can only provide some items and must be failing somewhere in trying to do that translation.