AniFlow

Documentation

Importing: copy, move or hardlink

How finished downloads get into your library.

What importing is

When your download client reports a torrent finished, AniFlow places the episode's video file in your library so your media app can see it. This is the "importing" step of How downloads work. You decide how the file gets there, and what happens to the torrent afterwards, in Settings -> Downloads, under the heading What happens after a download finishes.

The importer runs as part of the download-status pass (Downloads: Syncing download status on the Schedule page), which by default runs about every 30 seconds. Before anything is placed, AniFlow checks that both the source and the destination are inside the folders it is configured to use. Anything pointing outside them becomes an Attention item, not an import.

The first dropdown is labelled Getting the file into the library (in Shoko Server mode, Getting the file to Shoko Server). The default is Copy.

ChoiceWhat happens to the fileSeedingDisk use
Copy (keep the download, can keep seeding)The file is copied into the library. The original stays in the download folder.The torrent can keep seeding.The episode is on disk twice. The download folder needs an occasional clean-up by you.
Hardlink (one copy on disk, the download keeps seeding)The library gets a second name for the same data. Nothing is copied.The torrent keeps seeding.The episode takes space once.
Move (the download folder gives the file up)The file is relocated into the library.Seeding ends, because the data the torrent would serve is gone.Exactly one copy, and the space is freed immediately.

Copy is the safe choice and works everywhere. Choose Hardlink if you want both seeding and a single copy; choose Move if you do not seed at all.

A hardlink is two names for one set of data on disk. Deleting either name leaves the other. Editing the library file in place also changes the data the torrent is seeding, so tools that rewrite a file in place (some taggers or remuxers) can break the seeded torrent. Tools that write a new file and replace the old one do not.

It only works when the download folder and the library are on one filesystem and one mount inside AniFlow's container, and the same must be true inside the download client's container. Two separate bind mounts of the same physical disk fail, even though it is the same disk. The usual fix is to mount one parent folder, for example /data with the downloads and the media inside it, into both containers and use paths below that. Some network shares and FAT or exFAT disks cannot make hardlinks at all.

If a link cannot be made, the import stops with the reason shown on the episode, and the next pass tries again after you fix the mounts or the setting. AniFlow never silently falls back to a copy, because a copy is exactly the disk use you chose Hardlink to avoid. The two reasons you may see are that the folders are on different mounts or filesystems, and that the filesystem does not allow hardlinks. Both suggest choosing Copy in Settings -> Downloads as the way out.

Test it first on the Checks page

Open Checks in the sidebar. When Hardlink is selected, the check Hardlink placement makes a throwaway file in your download folder, tries to hardlink it into every library folder (and into the Shoko hand-over folder in Shoko Server mode), and removes both names again at once. It tells you whether it works, or says what to change. AniFlow needs write access to the download folder for this test. With Copy or Move the check is skipped.

After the import: what happens to the torrent

The second dropdown, Then, with the torrent, decides what AniFlow tells the download client once the episode is in the library.

ChoiceResult
Pause the torrent (recommended)The default. Seeding stops, but the torrent stays listed in the client, so you can see that AniFlow noticed the download finish.
Remove the torrent entryThe torrent is removed from the client's list. Its files are never deleted by this. If the client refuses to remove it, AniFlow tries to pause it instead and records what happened.
Leave it seedingNothing is done. This is unavailable with Move, because a moved file cannot seed. If you switch to Move while it is selected, the setting changes to Remove the torrent entry.

For a batch torrent that serves several episodes, this is applied only once the last wanted episode has been placed. If the action fails, the episode is still imported; the problem is shown on the download.

How the library file and folder are named

In standalone mode, the destination is the anime's folder inside its library. The file keeps the name the release gave it; AniFlow does not rename it. So a download called [Group] Show - 05 [1080p].mkv is placed under that name. This is deliberate: the move is predictable and reversible. See Media folders and libraries for libraries.

The anime's folder is created if needed. AniFlow names a new folder from the anime's titles, following the title order you set for folders. If the anime has no library folder yet, the import stops with "This anime has no library folder yet".

When the target already exists

If a file with the destination name is already in the library:

A newer version (V2) of an episode you own is a different situation: AniFlow waits for your decision first. See How downloads work.

Shoko Server: the hand-over import

In Shoko Server mode, AniFlow does not decide where the episode lives. It puts the file in the hand-over folder (mounted at /import by default) and Shoko identifies, renames and files it. Differences from the standalone import:

What "AniFlow never deletes your media" really means

AniFlow's importer never deletes a library file on its own initiative, and it never overwrites a different file. When it finds a conflict it stops and asks you. The deletions that can happen all come from something you chose, and they are listed here so none is a surprise:

The reacquire modes

In Change the release, the choice for the files you already have is remembered between visits (reacquire_mode in aniflow.yaml). Before you confirm, the panel says how many files will be deleted.

ChoiceWhat it does
Keep as .backup (default)Each file is renamed to <name>.backup and left where it is. The new extension means AniFlow, Shoko and media apps no longer treat it as an episode. AniFlow records which files these are, so you can find and delete them later; it never deletes them itself.
Delete themThe existing files are deleted and the episodes are reset, then the normal search starts for the new release. If the new release turns out to be unavailable, you are left with a gap.
Keep as original fileThe file stays exactly where it is and is never deleted by AniFlow. When the new release arrives the episode has two files, and a Two files item asks which to delete. A media server may list the episode twice until you choose, and the panel warns about this.

The example settings file mentions only backup and replace for reacquire_mode. The code also accepts keep and an older when_replaced mode, but the panel no longer offers the latter, and a saved value it does not know is written back as backup.