I wanted to post a script I use to programatically tag collections from a list export from icheckmovies.com
Premium users of ICM can export top lists and this script will parse that CSV file and create a collection and tag any films in your Plex library that appear in that list.For example, I can export the top 500 Essential Cult Movies list (https://www.icheckmovies.com/lists/500+essential+cult+movies/) and running the attached script I can create a collection called "500 Essential Cult Movies" and it will tag all the those movies that I own.It works on linux and OSX.================Usage: create_plex_icm_collection.py [options]Options:-f CSVFILENAME, --file=CSVFILENAME ICM top list CSV export [REQUIRED]-t "TAG TITLE", --tag="TAG TITLE" Name of collection tag [REQUIRED]-x, --execute Commit changes to database, else dry run-r, --report Print list of films to tag and missing films-u, --untag Remove "TAG TITLE" from all listed films, essentially an undo-h, --help Show this help message and exitExample:create_plex_icm_collection.py -f 500+essential+cult+movies.csv -t "500 Essential Cult Movies" -x -rThe above will tag all owned movies from the .csv file with the tag "500 Essential Cult Movies", commit changes to database and print a report
In Mac OS uncomment this section in the file:#OSX homedir = os.path.expanduser("~") conn = sqlite3.connect( '%s/Library/Application Support/Plex Media Server/Plug-in Support/' 'Databases/com.plexapp.plugins.library.db' % (homedir)) #conn = sqlite3.connect( # '/var/lib/plexmediaserver/Library/Application Support/' # 'Plex Media Server/Plug-in Support/Databases/' # 'com.plexapp.plugins.library.db') cursor = conn.cursor() return (conn, cursor)