JohnDoee / autotorrent

Matches torrents with files and gets them seeded
MIT License
268 stars 33 forks source link

Failed to send torrent to client #33

Open adamwinn opened 5 years ago

adamwinn commented 5 years ago

I can't get any torrents to add to my client (rtorrent). Grabbing the torrent file that autotorrent created (__tmp_torrent61aa17eb-490c-4d22-8c6b-fec0a5470b66.torrent) and adding it in rutorrent's GUI worked fine.

Verbose output below:

adamwinn@DiskStation:~/scripts/autotorrent$ autotorrent -a ubuntu-19.04-desktop-amd64.iso.torrent --verbose
/usr/local/lib/python2.7/site-packages/cffi/model.py:526: UserWarning: 'point_conversion_form_t' has no values explicitly defined; next version will refuse to guess which integer type it is meant to be (unsigned/signed, int/long)
  % self._get_c_name())
DEBUG:autotorrent.clients.rtorrent:Creating Normal XMLRPC Proxy with url 'http://172.17.0.1:51414/RPC2'
Found 1 torrent(s)
INFO:autotorrent.clients.rtorrent:Getting a list of torrent hashes
INFO:autotorrent:Handling file /volume1/homes/adamwinn/scripts/autotorrent/ubuntu-19.04-desktop-amd64.iso.torrent
DEBUG:autotorrent:Handling torrent name 'ubuntu-19.04-desktop-amd64.iso'
INFO:autotorrent:Found name u'ubuntu-19.04-desktop-amd64.iso' for torrent
DEBUG:autotorrent.db:Keyify: 2097152000|ubuntu-19.04-desktop-amd64.iso
INFO:autotorrent:Preparing torrent using link mode
DEBUG:autotorrent:Making soft link from '/var/services/homes/adamwinn/scripts/autotorrent/files/ubuntu-19.04-desktop-amd64.iso' to u'./ubuntu-19.04-desktop-amd64.iso/ubuntu-19.04-desktop-amd64.iso'
INFO:autotorrent.clients.rtorrent:Trying to add a new torrent to rtorrent: 'ubuntu-19.04-desktop-amd64.iso'
INFO:autotorrent.clients.rtorrent:Trying to do fast resume data
DEBUG:autotorrent.clients.rtorrent:Handling file {u'path': [u'ubuntu-19.04-desktop-amd64.iso'], u'length': 2097152000, u'completed': True, u'actual_path': '/var/services/homes/adamwinn/scripts/autotorrent/files/ubuntu-19.04-desktop-amd64.iso'}
INFO:autotorrent.clients.rtorrent:This torrent is complete, setting bitfield to chunk count
INFO:autotorrent.clients.rtorrent:Sending to rtorrent: ['/volume1/homes/adamwinn/scripts/autotorrent/ubuntu-19.04-desktop-amd64.iso/__tmp_torrent4b43b543-c209-48ad-9e0e-b06054ec656c.torrent', 'd.directory_base.set="/volume1/homes/adamwinn/scripts/autotorrent/ubuntu-19.04-desktop-amd64.iso"', 'd.custom1.set=autotorrent']
INFO:autotorrent.clients.rtorrent:Getting a list of torrent hashes
INFO:autotorrent.clients.rtorrent:Getting a list of torrent hashes
INFO:autotorrent.clients.rtorrent:Getting a list of torrent hashes
INFO:autotorrent.clients.rtorrent:Getting a list of torrent hashes
INFO:autotorrent.clients.rtorrent:Getting a list of torrent hashes
WARNING:autotorrent.clients.rtorrent:Torrent was not added to rtorrent within reasonable timelimit
 [Failed]    'ubuntu-19.04-desktop-amd64.iso' Failed to send torrent to client
mrbiggmd commented 5 years ago

Did you ever get this working? I'm having the same issue.

JohnDoee commented 5 years ago

It can actually be several things that prevents rtorrent from adding it successfully, as far as I remember the response rtorrent gives autotorrent when adding a new torrent isn't worth much.

I assume it's not actually showing up later so the adding actually failed.

One thing can be if rtorrent and autotorrent isn't on the same machine / environment, e.g. rtorrent is running in docker.

libussa commented 4 years ago

Same here. rtorrent is in docker, I'm connecting from the host through a socket file. This works well for Flood UI Any clues on a possible fix?

adamwinn commented 4 years ago

I'm running rtorrent in docker. Any help for a fix would be appreciated

adamwinn commented 4 years ago

@JohnDoee I ran a test and it succeeded so I'm not sure why it fails to add

DEBUG:autotorrent.clients.rtorrent:Creating Normal XMLRPC Proxy with url 'http://172.18.0.1:51414/RPC2'
Connected to torrent client successfully!
  result: cwd:'/run/s6/services/rutorrent', pid:344
adamwinn commented 4 years ago

Sonarr can add torrents to rtorrent using the exact same configuration

a-nunes commented 4 years ago

any news on how to use autotorrent and rtorrent docker? it keeps giving me the same error, then i've to add it manually on rtorrent in order to cross-seed...

JohnDoee commented 4 years ago

My guess is the problem is that paths are unaligned. Autotorrent thinks you're adding /data/ubuntu.iso while the location inside the docker container is /somefolder/data/ubuntu.iso and /data/ is not writeable in the docker container. That will result in rtorrent not adding the torrent.

I've not come up with a smart way to solve this so it will not be weird for the end-user.

a-nunes commented 4 years ago

My guess is the problem is that paths are unaligned. Autotorrent thinks you're adding /data/ubuntu.iso while the location inside the docker container is /somefolder/data/ubuntu.iso and /data/ is not writeable in the docker container. That will result in rtorrent not adding the torrent.

I've not come up with a smart way to solve this so it will not be weird for the end-user.

Is there a way to add the torrent to a "watch" folder, where I can configure rutorrent to add this file to rtorrent using AutoTools plugin?

EDIT: My idea is like this: Instead of add the torrent to rtorrent directly, it copies the torrent file to rutorrent watch folder, and AutoTools do the job of adding the torrent.

adamwinn commented 4 years ago

@JohnDoee Maybe you could write to debug what paths are being added. And also any output returned from rtorrent

TheFeshy commented 4 years ago

I just wanted to confirm that it is the path mapping problem with docker. For example, I have -v /data/downloads:/downloads in my docker container, mapping the /data/downloads directory to /downloads inside the container. You could change it so they match, but I think that will cause rtorrent to lose track of all your existing torrents. Moving them is a hassle. However, docker doesn't mind adding the same volume twice, at different locations. So now I have -v /data/downloads:/downloads -v /data/downloads:/data/downloads so that it is mapped both to where rtorrent expects it and where autotorrent expects it, and autotorrent is able to add torrents without issue.

adamwinn commented 4 years ago

@TheFeshy I have the following config but it still fails to add. Did I miss something?

Screen Shot 2020-08-23 at 5 42 05 PM

adamwinn commented 3 years ago

Thanks to @TheFeshy and @JohnDoee, I was also able to figure this out. It is indeed a path issue with docker.

Since I use docker on Synology with the gui, I wasn't able to tell the exact paths that were being used. It looked like I was mapping /data but I was really mapping /volume1/data. You can see what the mounts points are in more detail by using docker inspect so something like sudo docker inspect linuxserver-rutorrent

My setup is a bit different since I use docker on my Synology nas with the linuxserver rutorrent docker image. My paths used to be:

"/volume2/stuff:/stuff:rw"
"/volume1/data:/downloads:rw",

Now they are:

"/volume2/stuff:/stuff:rw"
"/volume1/data:/downloads:rw",
"/volume2/stuff:/volume2/stuff:rw",
"/volume1/data:/volume1/data:rw",

The linuxserver rutorrent docker image needs to have a /downloads mount point but autotorrent needs to have the mount points inside and outside of the container to match so I added /volume1/data so they match and now it works.

The paths have to match inside and outside the docker image for rutorrent to succeed. One mount point for the docker image and another mount point for autotorrent

newadventure079 commented 2 years ago

I recommend anyone that has this same issue to switch to a fork that has #54 merged into it, plus a lot of other good fixes, like utf8 fixes. https://github.com/TiarnanRedmond/autotorrent

I used that fork and it works perfectly and the client_path option is great. Props to @TiarnanRedmond