update
This commit is contained in:
		@@ -22,14 +22,15 @@ baseurl = Config.plexBaseUrl
 | 
			
		||||
token = Config.plexToken
 | 
			
		||||
plex = PlexServer(baseurl, token)
 | 
			
		||||
 | 
			
		||||
plexMoviesLibrary = plex.library.section('Movies')
 | 
			
		||||
plexMoviesLibrary = plexMoviesLibrary.search()
 | 
			
		||||
def MovieCollectionList(library):
 | 
			
		||||
    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()
 | 
			
		||||
        tmdbMovie = Movie()
 | 
			
		||||
 | 
			
		||||
@@ -58,14 +59,14 @@ for item in plexMoviesLibrary:
 | 
			
		||||
        if movie.MovieTMDbCollectionTMDbId:
 | 
			
		||||
            logger.info(f'Movie {movie.PlexTitle} has been added to Collection List')
 | 
			
		||||
            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
 | 
			
		||||
count = 0
 | 
			
		||||
MovieListFinal = []
 | 
			
		||||
ExistingCollectionId = []
 | 
			
		||||
    i = 0
 | 
			
		||||
    count = 0
 | 
			
		||||
    MovieListFinal = []
 | 
			
		||||
    ExistingCollectionId = []
 | 
			
		||||
 | 
			
		||||
while i < len(MoviesList):
 | 
			
		||||
    while i < len(MoviesList):
 | 
			
		||||
        for movie in MoviesList:
 | 
			
		||||
            if MoviesList[i].MovieTMDbCollectionTMDbId == movie.MovieTMDbCollectionTMDbId:
 | 
			
		||||
                count += 1
 | 
			
		||||
@@ -77,9 +78,10 @@ while i < len(MoviesList):
 | 
			
		||||
        i += 1
 | 
			
		||||
        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:
 | 
			
		||||
        with open(configFile, 'r') as f:
 | 
			
		||||
            try:
 | 
			
		||||
@@ -114,7 +116,10 @@ def UpdateYAML(configFile):
 | 
			
		||||
                urllib.request.urlretrieve(Config.tmdbImgUrl + f"{collection.MovieTMDbCollectionPosterPath}",
 | 
			
		||||
                                           Config.PlexAutoCollectionConfigFileImagesPath + f"/{collection.MovieTMDbCollectionName}/poster.jpeg")
 | 
			
		||||
 | 
			
		||||
UpdateYAML(Config.PlexAutoCollectionConfigFilePath)
 | 
			
		||||
#UpdateYAML(Config.PlexAutoCollectionConfigFilePath4K)
 | 
			
		||||
MovieListFinal = MovieCollectionList('Movies')
 | 
			
		||||
UpdateYAML(Config.PlexAutoCollectionConfigFilePath, MovieListFinal)
 | 
			
		||||
 | 
			
		||||
MovieListFinal = MovieCollectionList('4K Movies')
 | 
			
		||||
UpdateYAML(Config.PlexAutoCollectionConfigFilePath4K)
 | 
			
		||||
 | 
			
		||||
logger.info(f"All collections have been updated in plex...")
 | 
			
		||||
		Reference in New Issue
	
	Block a user