update
This commit is contained in:
parent
99c5ad5501
commit
df862ed143
@ -6,3 +6,4 @@ class Config(object):
|
|||||||
plexBaseUrl = 'https://plex.rouggy.ovh'
|
plexBaseUrl = 'https://plex.rouggy.ovh'
|
||||||
plexToken = 'VeQQwtf-sNtWWLwzCEih'
|
plexToken = 'VeQQwtf-sNtWWLwzCEih'
|
||||||
PlexAutoCollectionConfigFilePath = '/opt/Plex-Auto-Collections/config/config.yml'
|
PlexAutoCollectionConfigFilePath = '/opt/Plex-Auto-Collections/config/config.yml'
|
||||||
|
PlexAutoCollectionConfigFileImagesPath = '/opt/Plex-Auto-Collections/config/images'
|
||||||
|
@ -2,6 +2,7 @@ class MovieCollection:
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.collectionTitle = ""
|
self.collectionTitle = ""
|
||||||
self.collectionId = ""
|
self.collectionId = ""
|
||||||
|
self.collectionImgPath = ""
|
||||||
|
|
||||||
def get_existing_collections(self):
|
def get_existing_collections(self):
|
||||||
pass
|
pass
|
@ -4,7 +4,7 @@ from plexapi.server import PlexServer
|
|||||||
from fuzzywuzzy import fuzz
|
from fuzzywuzzy import fuzz
|
||||||
from models.movie_collection import MovieCollection
|
from models.movie_collection import MovieCollection
|
||||||
from datetime import datetime as dt
|
from datetime import datetime as dt
|
||||||
import yaml
|
import yaml, os, urllib.request
|
||||||
|
|
||||||
# Instantiate Tmdb object
|
# Instantiate Tmdb object
|
||||||
tmdb = TMDb()
|
tmdb = TMDb()
|
||||||
@ -77,9 +77,10 @@ for movie in MovieCollectionFinal:
|
|||||||
nameLength = len(movie)
|
nameLength = len(movie)
|
||||||
coll.collectionTitle = movie.name[:nameLength - 13]
|
coll.collectionTitle = movie.name[:nameLength - 13]
|
||||||
coll.collectionId = movie.id
|
coll.collectionId = movie.id
|
||||||
|
coll.collectionImgPath = movie.poster_path
|
||||||
MovieCollectionList.append(coll)
|
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:
|
with open(Config.PlexAutoCollectionConfigFilePath, 'r') as f:
|
||||||
try:
|
try:
|
||||||
@ -99,5 +100,11 @@ for collection in MovieCollectionList:
|
|||||||
currentYaml['collections'].update(new_coll)
|
currentYaml['collections'].update(new_coll)
|
||||||
|
|
||||||
if currentYaml:
|
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:
|
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