fix(media): on-complete hook reads author/title from end of MAM save path

autobrr's {{ .Category }} renders as "Audiobook/Non-Fiction", so the save
path is <Category>/<SubCategory>/<Author>/<Title>; indexing from the front
would have filed books under the subcategory as author.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ginnoirandClaude Opus 5.5 committed 2026-10-24 20:56:51 -05:00
1 parent 247276af25
commit a50849b766
1 file changed
+4 -2
+4 -2
View File
@@ -10,7 +10,7 @@ over after editing. AutoRun program in qBittorrent.conf:
1. Every torrent: notify cross-seed's webhook (what the old inline curl did).
2. Category "mam" (autobrr MyAnonamouse grabs): file the payload into the book
libraries without touching the seeding copy. autobrr saves MAM grabs to
/storage1/complete/mam/<Category>/<Author>/<Title>/ so the path carries the
/storage1/complete/mam/<Category>/<SubCategory>/<Author>/<Title>/ so the path carries the
metadata the .torrent name lacks.
- Audiobook -> hardlinked into /storage1/Media/Audiobooks/<Author>/<Title>/
(Audiobookshelf). Never use ABS "embed metadata" on these: it rewrites the
@@ -65,7 +65,9 @@ def file_mam(content_path, save_path):
if len(rel) < 3 or rel[0].startswith(".."):
log(f"mam: unexpected save path {save_path!r}, skipping")
return
category, author, title = rel[0], rel[1], rel[2]
# autobrr's Category renders as "Audiobook/Non-Fiction", so the path is
# <Category>/<SubCategory>/<Author>/<Title>; take author/title from the end.
category, author, title = rel[0], rel[-2], rel[-1]
linked = 0
if category.lower() == "audiobook":
dest = os.path.join(AUDIOBOOKS, author, title)