forked from jkirkcaldy/plex-utills
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPixar_collection.py
28 lines (26 loc) · 914 Bytes
/
Pixar_collection.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/local/bin/python
from collections import defaultdict
from plexapi.server import PlexServer
from configparser import ConfigParser
from datetime import datetime
#Read config.ini file
config_object = ConfigParser()
config_object.read("config/config.ini")
server = config_object["PLEXSERVER"]
baseurl = (server["PLEX_URL"])
token = (server["TOKEN"])
films = (server["FILMSLIBRARY"])
plex = PlexServer(baseurl, token)
movies_section = plex.library.section(films)
added = movies_section.search(sort='titleSort')
now = datetime.now()
current_time = now.strftime("%H:%M:%S")
print(current_time, ": Pixar Collection script starting now")
for movie in added:
try:
if "pixar" in movie.studio:
movie.addCollection('Pixar')
print('%s (%s)' % (movie.title, movie.studio))
# Skip movie if there is no studio info
except TypeError:
continue