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.
Copy, Move or Hardlink
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.
| Choice | What happens to the file | Seeding | Disk 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.
Hardlink: what you need to know
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.
| Choice | Result |
|---|---|
| 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 entry | The 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 seeding | Nothing 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:
- if it has the same size as the download, AniFlow treats the episode as already imported and records it;
- if it is different, nothing is overwritten. The import stops with "This episode is already in your library" and an Attention item appears. It is retried each pass, and offers two buttons:
- Delete the new file removes only the downloaded copy in the download folder and leaves your library untouched.
- Keep the new file asks you to confirm, deletes the library's copy, and lets the new file go through the normal import.
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:
- The file keeps the name of its release. AniFlow invents no name.
- Each anime gets its own subfolder in the hand-over folder.
- Only a few files are handed over per pass (three), because Shoko asks AniDB about each file it receives, and AniDB blocks accounts that ask too fast. A big season trickles in over several passes.
- The copy, hardlink or move choice applies here too. With Move, the torrent can no longer serve anything once the file has left the download folder, so the "Then, with the torrent" action is applied as soon as the file reaches the hand-over folder. With Copy or Hardlink it is applied when the episode appears in the library.
- The episode shows In import folder / Waiting for Shoko until Shoko files it. Run Shoko import on In Progress nudges Shoko, as pressing Run Import in Shoko does.
- If an anime's library is linked to one of Shoko's own folders, the file is written straight into that folder under AniFlow's own naming, and Shoko is asked to look. See Shoko Server.
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:
- Move relocates the download out of the download folder. That is the point of the setting; the library receives the file.
- Remove the torrent entry deletes the entry from your client, never the files.
- Keep the new file and Delete the older file / Delete the newer file on Attention records delete exactly the file named on the button, after you press it.
- Delete the new file deletes only the download folder's copy.
- When you change an anime's release (Change the release), a setting called The files you already have decides what happens to the files you own for that anime (see below).
- When you change the release while an episode is still downloading, that unfinished torrent is removed from the client together with its partial files, so the rejected release does not keep arriving.
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.
| Choice | What 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 them | The 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 file | The 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.