You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As discussed on #1027 - a proper writeup for this rather than a PR, since I'm not a dev myself.
Feature request: optional cleanup of source folder after confirmed successful hardlink/copy
Situation: a download client (e.g. qBittorrent) saves directly into the same root a library scanner (e.g. Audiobookshelf) watches. This is a valid setup, and one the compose examples half-suggest by mounting the client's path directly. Shelfmark's current behaviour here is correct by design - is_managed_workspace_path() in shelfmark/download/postprocess/workspace.py only ever treats TMP_DIR as mutable, and says why:
# workspace.py:50-54defis_managed_workspace_path(path: Path) ->bool:
"""Return whether Shelfmark should treat this path as mutable. The managed workspace is `TMP_DIR`. Anything outside it should be treated as read-only for safety (e.g. torrent seeding directories). """
That's the right default. But the original torrent-delivered folder survives every successful hardlink or copy, and the library scanner then registers it as a second item alongside the real one. Hit this myself with a couple of test audiobooks - harmless with hardlinking (same inode, no extra disk used), but it leaves duplicate library entries every time, and I imagine it'd be worse for anyone using copy mode (HARDLINK_TORRENTS_AUDIOBOOK off), where it'd double disk usage per download too.
Ask: an opt-in, off-by-default setting to clean up the source folder, only after positively confirming the transfer succeeded.
Hardlinked output: confirm the destination shares the source's inode before deleting.
Copied output: confirm matching size (optionally a hash) before deleting.
Exclude anything still actively seeding by default. Gate on the torrent completion action being remove, or a separate seed-time/ratio guard, so this never fights someone who wants to keep seeding.
Separate, smaller thing while I'm here: the current Remove completion action doesn't delete files for torrents at all - delete_files=False is hardcoded for the torrent branch in base_handler.py, against delete_files=True for the equivalent usenet path. Nothing in the settings copy or environment-variables.md signals that distinction, and it's easy to assume otherwise (I did). Might be a cheap docs/UI fix even before the bigger feature above.
Scope note: doesn't apply to the ebook pipeline the same way, since CWA already does import-then-delete on the destination side. This is specifically about library tools with no equivalent watch-then-consume step.
Understand you're focused on bugfixes for now so no rush on this, just wanted to get it written up properly. Thanks for taking the time to look at #1027.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
As discussed on #1027 - a proper writeup for this rather than a PR, since I'm not a dev myself.
Feature request: optional cleanup of source folder after confirmed successful hardlink/copy
Situation: a download client (e.g. qBittorrent) saves directly into the same root a library scanner (e.g. Audiobookshelf) watches. This is a valid setup, and one the compose examples half-suggest by mounting the client's path directly. Shelfmark's current behaviour here is correct by design -
is_managed_workspace_path()inshelfmark/download/postprocess/workspace.pyonly ever treatsTMP_DIRas mutable, and says why:That's the right default. But the original torrent-delivered folder survives every successful hardlink or copy, and the library scanner then registers it as a second item alongside the real one. Hit this myself with a couple of test audiobooks - harmless with hardlinking (same inode, no extra disk used), but it leaves duplicate library entries every time, and I imagine it'd be worse for anyone using copy mode (HARDLINK_TORRENTS_AUDIOBOOK off), where it'd double disk usage per download too.
Ask: an opt-in, off-by-default setting to clean up the source folder, only after positively confirming the transfer succeeded.
remove, or a separate seed-time/ratio guard, so this never fights someone who wants to keep seeding.Separate, smaller thing while I'm here: the current
Removecompletion action doesn't delete files for torrents at all -delete_files=Falseis hardcoded for the torrent branch inbase_handler.py, againstdelete_files=Truefor the equivalent usenet path. Nothing in the settings copy orenvironment-variables.mdsignals that distinction, and it's easy to assume otherwise (I did). Might be a cheap docs/UI fix even before the bigger feature above.Scope note: doesn't apply to the ebook pipeline the same way, since CWA already does import-then-delete on the destination side. This is specifically about library tools with no equivalent watch-then-consume step.
Understand you're focused on bugfixes for now so no rush on this, just wanted to get it written up properly. Thanks for taking the time to look at #1027.
All reactions