diff --git a/stacks/media/qbittorrent/on-complete.py b/stacks/media/qbittorrent/on-complete.py index b013a3d..a093db0 100644 --- a/stacks/media/qbittorrent/on-complete.py +++ b/stacks/media/qbittorrent/on-complete.py @@ -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//// 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)