plex-smb-rescanner

· oatmeal with fingers


I wrote this over the weekend: https://github.com/oatmeaI/plex-smb-rescanner

I recently bought a NAS, and migrated my Plex media from two different USB external drives to the NAS (that migration was a whole other story, but it's done now). The Plex server still runs on my Mac Mini that I use a server for a couple different miscellaneous things - which means that Plex is now accessing the media library over an SMB share, rather than an external drive. No biggie, right?

Plex has a feature which watches the filesystem and automatically adds / removes / updates media from its library as the files are added / removed / changed on disk - but Plex is unable to watch for filesystem changes on an SMB share. Which means that every time I download a new album, I have to go trigger a full rescan of the entire music library. Which takes a while, and is annoying.

After lots of googling and tweaking the hell out of my /etc/nsmb.conf, I decided I was going to have to fix this myself: I found a Python script which watches an SMB mount for SMB change notifications, and I found some Plex documentation on how to trigger scans via the Plex Media Server REST API. Smash the two together, and voila - I get partial library rescans anytime I make changes to the filesystem where my media library is stored.

It seems like almost no one else has their Plex server set up the way I do, so maybe this won't be useful to anyone else...but just in case it is, I did my best to make the script configurable and reusable.

album grid for the past 30 days

last updated: