update
This commit is contained in:
parent
261c00fc91
commit
936d2858c3
@ -22,14 +22,15 @@ baseurl = Config.plexBaseUrl
|
|||||||
token = Config.plexToken
|
token = Config.plexToken
|
||||||
plex = PlexServer(baseurl, token)
|
plex = PlexServer(baseurl, token)
|
||||||
|
|
||||||
plexMoviesLibrary = plex.library.section('Movies')
|
def MovieCollectionList(library):
|
||||||
plexMoviesLibrary = plexMoviesLibrary.search()
|
plexMoviesLibrary = plex.library.section(library)
|
||||||
|
plexMoviesLibrary = plexMoviesLibrary.search()
|
||||||
|
|
||||||
MoviesList = []
|
MoviesList = []
|
||||||
|
|
||||||
logger.info(f"Retrieving {len(plexMoviesLibrary)} Movies from Plex and Updating TMDb information...")
|
logger.info(f"Retrieving {len(plexMoviesLibrary)} Movies from Plex and Updating TMDb information...")
|
||||||
|
|
||||||
for item in plexMoviesLibrary:
|
for item in plexMoviesLibrary:
|
||||||
movie = UpdatedMovie()
|
movie = UpdatedMovie()
|
||||||
tmdbMovie = Movie()
|
tmdbMovie = Movie()
|
||||||
|
|
||||||
@ -58,14 +59,14 @@ for item in plexMoviesLibrary:
|
|||||||
if movie.MovieTMDbCollectionTMDbId:
|
if movie.MovieTMDbCollectionTMDbId:
|
||||||
logger.info(f'Movie {movie.PlexTitle} has been added to Collection List')
|
logger.info(f'Movie {movie.PlexTitle} has been added to Collection List')
|
||||||
MoviesList.append(movie)
|
MoviesList.append(movie)
|
||||||
logger.info(f"Retrieved Movies from Plex and Updated TMDb information for {len(MoviesList)} movies...")
|
logger.info(f"Retrieved Movies from Plex and Updated TMDb information for {len(MoviesList)} movies...")
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
count = 0
|
count = 0
|
||||||
MovieListFinal = []
|
MovieListFinal = []
|
||||||
ExistingCollectionId = []
|
ExistingCollectionId = []
|
||||||
|
|
||||||
while i < len(MoviesList):
|
while i < len(MoviesList):
|
||||||
for movie in MoviesList:
|
for movie in MoviesList:
|
||||||
if MoviesList[i].MovieTMDbCollectionTMDbId == movie.MovieTMDbCollectionTMDbId:
|
if MoviesList[i].MovieTMDbCollectionTMDbId == movie.MovieTMDbCollectionTMDbId:
|
||||||
count += 1
|
count += 1
|
||||||
@ -77,9 +78,10 @@ while i < len(MoviesList):
|
|||||||
i += 1
|
i += 1
|
||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
logger.info(f"Found a total of {len(MovieListFinal)} collections, updating config file now !")
|
logger.info(f"Found a total of {len(MovieListFinal)} collections, updating config file now !")
|
||||||
|
return MovieListFinal
|
||||||
|
|
||||||
def UpdateYAML(configFile):
|
def UpdateYAML(configFile, MovieListFinal):
|
||||||
try:
|
try:
|
||||||
with open(configFile, 'r') as f:
|
with open(configFile, 'r') as f:
|
||||||
try:
|
try:
|
||||||
@ -114,7 +116,10 @@ def UpdateYAML(configFile):
|
|||||||
urllib.request.urlretrieve(Config.tmdbImgUrl + f"{collection.MovieTMDbCollectionPosterPath}",
|
urllib.request.urlretrieve(Config.tmdbImgUrl + f"{collection.MovieTMDbCollectionPosterPath}",
|
||||||
Config.PlexAutoCollectionConfigFileImagesPath + f"/{collection.MovieTMDbCollectionName}/poster.jpeg")
|
Config.PlexAutoCollectionConfigFileImagesPath + f"/{collection.MovieTMDbCollectionName}/poster.jpeg")
|
||||||
|
|
||||||
UpdateYAML(Config.PlexAutoCollectionConfigFilePath)
|
MovieListFinal = MovieCollectionList('Movies')
|
||||||
#UpdateYAML(Config.PlexAutoCollectionConfigFilePath4K)
|
UpdateYAML(Config.PlexAutoCollectionConfigFilePath, MovieListFinal)
|
||||||
|
|
||||||
|
MovieListFinal = MovieCollectionList('4K Movies')
|
||||||
|
UpdateYAML(Config.PlexAutoCollectionConfigFilePath4K)
|
||||||
|
|
||||||
logger.info(f"All collections have been updated in plex...")
|
logger.info(f"All collections have been updated in plex...")
|
Loading…
x
Reference in New Issue
Block a user