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
count = 0
# with open(Config.PlexAutoCollectionConfigFilePath, 'r') as f:
with open('test.yaml', 'r') as f:
with open(Config.PlexAutoCollectionConfigFilePath, 'r') as f:
try:
currentYaml = yaml.safe_load(f)
except yaml.YAMLError as exc:
@ -80,13 +79,13 @@ for movies in currentYaml['collections']:
for collection in MovieListFinal:
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}}
currentYaml['collections'].update(new_coll)
if currentYaml:
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)
if not os.path.exists(Config.PlexAutoCollectionConfigFileImagesPath + f"/{collection.MovieTMDbCollectionName}"):