update
This commit is contained in:
parent
4c2ee97f34
commit
99c5ad5501
@ -70,11 +70,14 @@ for movie in MatchingList:
|
|||||||
for id in TMDbCollection:
|
for id in TMDbCollection:
|
||||||
MovieCollectionFinal.append(tmdbCollection.details(id))
|
MovieCollectionFinal.append(tmdbCollection.details(id))
|
||||||
|
|
||||||
|
MovieCollectionList = []
|
||||||
|
|
||||||
for movie in MovieCollectionFinal:
|
for movie in MovieCollectionFinal:
|
||||||
coll = MovieCollection()
|
coll = MovieCollection()
|
||||||
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
|
||||||
|
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 Yaml File...")
|
||||||
|
|
||||||
@ -84,5 +87,17 @@ with open(Config.PlexAutoCollectionConfigFilePath, 'r') as f:
|
|||||||
except yaml.YAMLError as exc:
|
except yaml.YAMLError as exc:
|
||||||
print(exc)
|
print(exc)
|
||||||
|
|
||||||
for collection in currentYaml.items():
|
currentYamlCollections = []
|
||||||
print(collection.keys)
|
|
||||||
|
for movies in currentYaml['collections']:
|
||||||
|
currentYamlCollections.append(movies)
|
||||||
|
|
||||||
|
for collection in MovieCollectionList:
|
||||||
|
if collection.collectionTitle not in currentYamlCollections:
|
||||||
|
with open(Config.PlexAutoCollectionConfigFilePath, 'r') as f:
|
||||||
|
new_coll = {f'{collection.collectionTitle}': {'sync_mode': 'sync', 'tmdb_collection': collection.collectionId, 'tmdb_summary': collection.collectionId}}
|
||||||
|
currentYaml['collections'].update(new_coll)
|
||||||
|
|
||||||
|
if currentYaml:
|
||||||
|
with open(Config.PlexAutoCollectionConfigFilePath, 'w') as f:
|
||||||
|
yaml.safe_dump(currentYaml, f)
|
Loading…
x
Reference in New Issue
Block a user