1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-11-21 18:22:42 +01:00
13 Completed Download Handling
Samuel Bartík edited this page 2021-06-22 04:20:01 +02:00

Note: this is the Legacy v2 Wiki. The new V3 Wiki can be found at the Servarr Wiki.

Completed Download Handling is how Sonarr imports media from your download client to your series folders. It replaced an older system called the Drone Factory in mid-2014. Most setups should exclusively use Completed Download Handling.

How Completed Download Handling Works

  1. Sonarr will send a download request to your client, and associate it with a label or category name that you have configured in the download client settings. The default is 'tv'.
  2. Sonarr will monitor your download clients active downloads that use that category name. It monitors this via your download client's API.
  3. When the download is completed, Sonarr will know the final file location as reported by your download client. This file location can be almost anywhere, as long as it is somewhere separate from your media folder. Something like C:\Downloads\Completed\TV works well.
  4. Sonarr will scan that completed file location for video files. It will parse the video file name to match it to a show, season, and episode. If it can do that, it will rename the file according to your specifications, and move it to the TV Series folder.
  5. Leftover files from the download will be sent to your trash or recycling.

If you download using a BitTorrent client, the process is slightly different:

  • Completed files are left in their original location to allow you to seed. When files are imported to your Series folder Sonarr by default will copy the video file, which uses twice the disk space. An advanced option to hardlink can be enabled (Settings > Media Management > Importing) which will attempt to hardlink the media to your Series folder. A hardlink will allow not use any additional disk space. If the hardlink creation fails, Sonarr will fall back to the default behavior and copy the file.
  • If the "Completed Download Handling - Remove" option is enabled in Sonarr's settings, Sonarr will delete the original file and torrent from your client, but only if the client reports that seeding is complete and torrent is stopped.

Download Client on Different Computer

As mentioned earlier, Completed Download Handling gets the file path to the download directly from the Download Client. Such a path is inaccessible from different computers and would prevent Completed Download Handling from importing the download.

In Settings->Download Client->Remote Path Mapping is an option to configure Sonarr to translate the remote path to something locally accessible.

For example:
If I configured a remote Sabznzbd instance with the Host 10.2.3.4 in Sonarr. And that Sabnzbd instance uses /sda3/download/sabnzbd/completed as root folder for completed downloads. And that path is available as \\10.2.3.4\sabnzbd\completed on my Windows machine.
Then you would add a Remote Path Mapping for:

  • Host: 10.2.3.4
  • Remote Path: /sda3/download/sabnzbd
  • Local Path: \\10.2.3.4\sabnzbd

Using Completed Download Handling in a sync setup

A common misunderstanding of Completed Download Handling in comparison with Drone Factory Folder is that it can't be used in a sync setup, common with torrent clients on seedboxes. Thankfully, this isn't true and just requires the correct setup.

The hardest part is that the sync'd files should only show up when it is safe to import them, which is usually when they're done, but at least when all the files are listed if hard links are possible and enabled. For single episode torrents, it doesn't matter... but for season packs it does because Sonarr will stop importing after it processes all the files that were there when it first started, which may not be all of them. In a typical sync setup of just the completed folder, the seedbox torrent client tells Sonarr the download is done, so it starts looking for files. The sync process may have only started or finished a few of the files, not all of them and so a partial import occurs.

This is easy to account for though, just by syncing a level below your completed folder, so you're syncing both incomplete and completed torrents. The sync programs are smart enough to understand a move, so while the torrent is downloading, it is also syncing to your local server. When it finishes and moves to the completed folder, the sync program will reflect that and it just works because the files are probably already downloaded, but even if they're not, they will at least have been created. And so when Sonarr hard links them, they'll just finish downloading after the import.

Setup seed time/ratio goals in Sonarr or your download client and configure the client to pause/stop when they're met, enable Remove under CDH and Sonarr will remove the torrent and files when the goals are met. Unless you're using rTorrent.

If you're using your own sync script instead of something like SyncThing or Resilio Sync, you just need to script the same sort of process. Do the rsync or scp or whatever to an adjacent folder, then move it to the right place when done.

The final key is the remote path map, which is reasonably discussed above.