Add to plex library from CLI

Is it possible to add libraries to PLEX from the command line with bash in Linux?

 

I am writing a service that will symlink all new media directories I add with PLEX friendly filenames and then add them to PLEX automatically without user intervention. I add and remove media periodically and it is troublesome to have to log into my server to fix the file names then go to the PLEX web interface to add the new media. The first half of this service works fine (symlinking proper file names for all media that hasn't already been fixed), but I cannot figure out how or if it is possible to add libraries manually from bash/CLI so they appear in the PLEX interface.

 

Is there documentation for this somewhere or has anyone done this before?

to create a new library I dunno.

to update a library you add media to yes, not sure when this was last updated

https://support.plex.tv/hc/en-us/articles/201242707-Plex-Media-Scanner-via-Command-Line

https://forums.plex.tv/topic/160013-pms-09120-doesnt-let-me-create-libraries-with-alternate-agent-or-scanner/?p=923746

You can get it to work manually by issuing the add library command via HTTP POST, for example:

http://localhost:32400/library/sections?scanner=SageTV+Scanner&language=en&agent=com.plexapp.agents.bmtagenttvshows&location=somepath&type=show&name=SageTV

Note this needs to be HTTP post so simply paste this in the browser window won't work. You can use curl or browser extension to issue the POST.

You will need no auth possibly to be allowed to run it

 

Also: https://support.plex.tv/hc/en-us/articles/201242707-Plex-Media-Scanner-via-Command-Line

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.