vexdev / amarr

aMule Torrent connector for Servarr
MIT License
28 stars 1 forks source link

Update amarr "fake torrent client" downloads folder reference for Radarr/Sonarr #48

Closed Marcosaurios closed 10 months ago

Marcosaurios commented 10 months ago

Hi! Nice project idea!

I installed a home *arr setup a few months ago and it was yesterday that I found this project, which fits perfectly my needs: point sonarr/radarr downloads to use emule downloads. I made all the setup correct without any issues, for being in a Beta stage works insanely good.

Problem

However I found something that I believe can be improved. If I'm not wrong, when amarr fakes the "qBittorrent" download connection (in order to be read properly by Sonarr), the downloads folder for this torrent connection is mapped to a folder which radarr doesn't have access to. When it finishes downloading the file, Sonarr settings pops up with this error message: image

I made a quick search inside the container but found nothing, although in the repo I can find this hardcoded reference. https://github.com/vexdev/amarr/blob/1de6bafb09f4753e6f3294238c3d77125d6ca514/app/src/main/kotlin/amarr/torrent/model/Preferences.kt#L129

For the sake of simplicity, it's recommended the downloaders services must have access only to downloads folders, being Sonarr/Radarr the services responsible of hard-linking copies from the downloaders' folder to the "main" or "root" media folder. That way the library will have only clean files but not seeding files references.

Otherwise the solution which I haven't tested yet, could be creating a Remote Path Mapping for this missing downloads folder. doesn't work, because in the context of the amarr container, the usb-luca folder doesn't even exist

Reproduction steps

  1. Run the docker image
  2. Query the amarr API with wget -qO- http://localhost:8282/api/v2/app/preferences
  3. The response will include a save_path field that doesn't exist inside the container, leaving the "fake torrent client" without completed folder:
{...
    "rss_smart_episode_filters": "s(\\d+)e(\\d+)\n(\\d+)x(\\d+)\n(\\d{4}[.\\-]\\d{1,2}[.\\-]\\d{1,2})\n(\\d{1,2}[.\\-]\\d{1,2}[.\\-]\\d{4})",
    "save_path": "/media/usb-luca/Downloads",
    "save_path_changed_tmm_enabled": false,
...}    

Proposal

I didn't manage to make it work with a docker volume neither because I guess the image built doesn't have any reference to your's USB called usb-luca under /media, so basically the Completed downloads folder in the context of "amarr" is unexistent for the "fake" torrent client emulation that sonar/radarr reads from. That's why it's impossible for Sonarr/Radarr to later move the file, because they cannot find the unmounted folder.

The idea is to follow this principle

Edit: new finding

riffsphereha commented 10 months ago

While I agree this hardcoded part should not be in there, this is exactly what the "AMULE_FINISHED_PATH" variable is for.

Make sure to map your /data/amule/complete/ as /incoming in amule and /data/amule/complete/ in amarr, set the AMULE_FINISHED_PATH variable to /data/amule/complete/ and the starr apps should get the correct path.

Marcosaurios commented 10 months ago

While I agree this hardcoded part should not be in there, this is exactly what the "AMULE_FINISHED_PATH" variable is for.

Make sure to map your /data/amule/complete/ as /incoming in amule and /data/amule/complete/ in amarr, set the AMULE_FINISHED_PATH variable to /data/amule/complete/ and the starr apps should get the correct path.

You're totally right, my bad, something was not clear for me, but with the setup you mention I achieved radarr to read automatically the amule downloads. Thank you so much for the help, I was missing the AMULE_FINISHED_PATH environment var, which was key to integrate radarr+amarr+amule.

Let me share my configuration for future references:

# ...
 radarr:
  image: lscr.io/linuxserver/radarr:latest
  volumes:
   - ./radarr/config:/config
   - ${MERGED_DATA}:/data # IMPORTANT! Here we are mapping our root folder / to /data inside radarr
amule:
  image: ngosang/amule
  environment:
   - MOD_AUTO_SHARE_DIRECTORIES=/incoming;
  volumes:
   - ${MERGED_DATA}/downloads/emule:/incoming # Create the emule downloads folder
 amarr:
  image: vexdev/amarr:latest
  environment:
   - AMULE_FINISHED_PATH=/data/downloads/emule # route relative to the one being read by radarr in the first comment