This commit is contained in:
Gregory Salaun 2021-12-08 22:28:49 +01:00
parent 2417b23ff2
commit c7c739c26a

View File

@ -66,8 +66,7 @@ while i < len(MoviesList):
i += 1 i += 1
count = 0 count = 0
# with open(Config.PlexAutoCollectionConfigFilePath, 'r') as f: with open(Config.PlexAutoCollectionConfigFilePath, 'r') as f:
with open('test.yaml', 'r') as f:
try: try:
currentYaml = yaml.safe_load(f) currentYaml = yaml.safe_load(f)
except yaml.YAMLError as exc: except yaml.YAMLError as exc:
@ -80,13 +79,13 @@ for movies in currentYaml['collections']:
for collection in MovieListFinal: for collection in MovieListFinal:
if collection.MovieTMDbCollectionName not in currentYamlCollections: if collection.MovieTMDbCollectionName not in currentYamlCollections:
with open('test.yaml', 'r') as f: with open(Config.PlexAutoCollectionConfigFilePath, 'r') as f:
new_coll = {f'{collection.MovieTMDbCollectionName}': {'sync_mode': 'sync', 'tmdb_collection': collection.MovieTMDbCollectionTMDbId, 'tmdb_summary': collection.MovieTMDbCollectionTMDbId}} new_coll = {f'{collection.MovieTMDbCollectionName}': {'sync_mode': 'sync', 'tmdb_collection': collection.MovieTMDbCollectionTMDbId, 'tmdb_summary': collection.MovieTMDbCollectionTMDbId}}
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.MovieTMDbCollectionName} to Yaml file...") print(f":: {dt.now().strftime('%d-%m-%Y %H:%M:%S')} :: CollectionUpdater :: Adding new collection: {collection.MovieTMDbCollectionName} to Yaml file...")
with open('test.yaml', '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.MovieTMDbCollectionName}"): if not os.path.exists(Config.PlexAutoCollectionConfigFileImagesPath + f"/{collection.MovieTMDbCollectionName}"):