update
This commit is contained in:
parent
99c5ad5501
commit
df862ed143
@ -6,3 +6,4 @@ class Config(object):
|
||||
plexBaseUrl = 'https://plex.rouggy.ovh'
|
||||
plexToken = 'VeQQwtf-sNtWWLwzCEih'
|
||||
PlexAutoCollectionConfigFilePath = '/opt/Plex-Auto-Collections/config/config.yml'
|
||||
PlexAutoCollectionConfigFileImagesPath = '/opt/Plex-Auto-Collections/config/images'
|
||||
|
@ -2,6 +2,7 @@ class MovieCollection:
|
||||
def __init__(self):
|
||||
self.collectionTitle = ""
|
||||
self.collectionId = ""
|
||||
self.collectionImgPath = ""
|
||||
|
||||
def get_existing_collections(self):
|
||||
pass
|
@ -4,7 +4,7 @@ from plexapi.server import PlexServer
|
||||
from fuzzywuzzy import fuzz
|
||||
from models.movie_collection import MovieCollection
|
||||
from datetime import datetime as dt
|
||||
import yaml
|
||||
import yaml, os, urllib.request
|
||||
|
||||
# Instantiate Tmdb object
|
||||
tmdb = TMDb()
|
||||
@ -77,9 +77,10 @@ for movie in MovieCollectionFinal:
|
||||
nameLength = len(movie)
|
||||
coll.collectionTitle = movie.name[:nameLength - 13]
|
||||
coll.collectionId = movie.id
|
||||
coll.collectionImgPath = movie.poster_path
|
||||
MovieCollectionList.append(coll)
|
||||
|
||||
print(f":: {dt.now().strftime('%d-%m-%Y %H:%M:%S')} :: CollectionUpdater :: Checking Yaml File...")
|
||||
print(f":: {dt.now().strftime('%d-%m-%Y %H:%M:%S')} :: CollectionUpdater :: Checking and Updating Yaml File...")
|
||||
|
||||
with open(Config.PlexAutoCollectionConfigFilePath, 'r') as f:
|
||||
try:
|
||||
@ -99,5 +100,11 @@ for collection in MovieCollectionList:
|
||||
currentYaml['collections'].update(new_coll)
|
||||
|
||||
if currentYaml:
|
||||
print(f":: {dt.now().strftime('%d-%m-%Y %H:%M:%S')} :: CollectionUpdater :: Adding new collection: {collection.collectionTitle} to Yaml file...")
|
||||
with open(Config.PlexAutoCollectionConfigFilePath, 'w') as f:
|
||||
yaml.safe_dump(currentYaml, f)
|
||||
yaml.safe_dump(currentYaml, f)
|
||||
|
||||
if not os.path.exists(Config.PlexAutoCollectionConfigFileImagesPath + f"/{collection.collectionTitle}"):
|
||||
print(f":: {dt.now().strftime('%d-%m-%Y %H:%M:%S')} :: CollectionUpdater :: Download poster for new collection {collection.collectionTitle}...")
|
||||
os.mkdir(Config.PlexAutoCollectionConfigFileImagesPath + f"/{collection.collectionTitle}")
|
||||
urllib.request.urlretrieve(Config.PlexAutoCollectionConfigFileImagesPath + f"{collection.collectionImgPath}", Config.PlexAutoCollectionConfigFileImagesPath + f"/{collection.collectionTitle}/poster.jpeg")
|
Loading…
x
Reference in New Issue
Block a user