diff --git a/models/movie_collection.py b/models/movie_collection.py index 59078c7..6bae606 100644 --- a/models/movie_collection.py +++ b/models/movie_collection.py @@ -1,7 +1,7 @@ class MovieCollection: - def __init__(self, id, title): - self.collectionTitle = title - self.collectionId = id + def __init__(self): + self.collectionTitle = "" + self.collectionId = "" def get_existing_collections(self): pass \ No newline at end of file diff --git a/plexAutoCollectionUpdater.py b/plexAutoCollectionUpdater.py index ef117cf..c52b9c9 100644 --- a/plexAutoCollectionUpdater.py +++ b/plexAutoCollectionUpdater.py @@ -28,23 +28,24 @@ MovieCollectionFinal = [] print(":: CollectionUpdater :: Creating Empty lists") # Retrieve the library Movies from Plex -print(f":: {dt.now()} :: CollectionUpdater :: Retrieving Movies section from Plex") +print(f":: {dt.now().strftime('%d-%m-%Y %H:%M:%S')} :: CollectionUpdater :: Retrieving Movies section from Plex") plexMoviesLibrary = plex.library.section('Movies') -print(f":: {dt.now()} :: CollectionUpdater :: Movies section from Plex retrieved") +print(f":: {dt.now().strftime('%d-%m-%Y %H:%M:%S')} :: CollectionUpdater :: Movies section from Plex retrieved") -print(f":: {dt.now()} :: CollectionUpdater :: Creating Movies list and Collection Available in Plex") +print(f":: {dt.now().strftime('%d-%m-%Y %H:%M:%S')} :: CollectionUpdater :: Creating Movies list and Collection Available in Plex") for movie in plexMoviesLibrary.search(): for collection in movie.collections: if collection.tag and collection.tag not in AvailablePlexCollectionsMovies: AvailablePlexCollectionsMovies.append(collection.tag) + print(f":: {dt.now().strftime('%d-%m-%Y %H:%M:%S')} :: CollectionUpdater :: Adding {movie.title} in the list of movies Available in Plex") PlexMovieList.append(movie.title) -print(f":: {dt.now()} :: CollectionUpdater :: Lists created") +print(f":: {dt.now().strftime('%d-%m-%Y %H:%M:%S')} :: CollectionUpdater :: Lists created") i = 0 length = len(PlexMovieList) -print(f":: {dt.now()} :: CollectionUpdater :: Comparing Movies in Plex to find similar movies...") +print(f":: {dt.now().strftime('%d-%m-%Y %H:%M:%S')} :: CollectionUpdater :: Comparing Movies in Plex to find similar movies...") while i < length: for movie in PlexMovieList: if 85 < fuzz.ratio(PlexMovieList[i], movie) < 100: @@ -52,8 +53,9 @@ while i < length: MatchingList.append(PlexMovieList[i]) i += 1 -print(f":: {dt.now()} :: CollectionUpdater :: Comparison is finished...") +print(f":: {dt.now().strftime('%d-%m-%Y %H:%M:%S')} :: CollectionUpdater :: Comparison is finished...") +print(f":: {dt.now().strftime('%d-%m-%Y %H:%M:%S')} :: CollectionUpdater :: Searching TMDb for movies in the Matching List") for movie in MatchingList: movieSearch = tmdbMovie.search(movie) movieId = movieSearch[0].id @@ -69,5 +71,8 @@ for id in TMDbCollection: MovieCollectionFinal.append(tmdbCollection.details(id)) for movie in MovieCollectionFinal: + coll = MovieCollection() nameLength = len(movie) - print(movie.name[:nameLength - 13]) \ No newline at end of file + coll.collectionTitle = movie.name[:nameLength - 13] + coll.collectionId = movie.id + print(f"Collection {coll.collectionTitle} with Id: {coll.collectionId} has been added") \ No newline at end of file