Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Rescan Jellyfin library from cli

I use Jellyfin (see the tags link below), and when I add new media, sometimes I want to see it right away. In order to do that, you need to tell the library to re-scan, or you can have a library configured to watch for filesystem changes. (I assume it uses inotify or something.) I use the "watch" option, but it doesn't seem to work [fast enough?] for me. I use nfs so that might have something to do with it.

So, you can log in to the web/mobile app with an account that can tell the library to scan now for new/changed files, but that takes quite a few clicks. So I spent way more time to write a oneliner that does all that for me, and it even has bash tab autocompletion! Check out the whole project at my cgit/jellystack, but here are some highlights:

Dot-source the autocomplete-rescan.bash script:

test -f /path/to/project/autocomplete-rescan.bash && . /path/to/project/autocomplete-rescan.bash

And after setting the ~/.jellyfin.password (with contents of password) and ~/.config/jellystack (shell script that exports username, password, and server) dependency files, you can use:

rescan-library <TAB>

Comments