update
This commit is contained in:
parent
4701035529
commit
b642a8451f
@ -3,6 +3,7 @@ from tmdbv3api import TMDb, Movie, Collection
|
||||
from plexapi.server import PlexServer
|
||||
from fuzzywuzzy import fuzz
|
||||
from models.movie_collection import MovieCollection
|
||||
from datetime import datetime as dt
|
||||
|
||||
# Instantiate Tmdb object
|
||||
tmdb = TMDb()
|
||||
@ -24,20 +25,26 @@ PlexMovieList = []
|
||||
MatchingList = []
|
||||
TMDbCollection = []
|
||||
MovieCollectionFinal = []
|
||||
print(":: CollectionUpdater :: Creating Empty lists")
|
||||
|
||||
# Retrieve the library Movies from Plex
|
||||
print(f":: {dt.now()} :: 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()} :: 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)
|
||||
PlexMovieList.append(movie.title)
|
||||
print(f":: {dt.now()} :: CollectionUpdater :: Lists created")
|
||||
|
||||
i = 0
|
||||
|
||||
length = len(PlexMovieList)
|
||||
|
||||
print(f":: {dt.now()} :: CollectionUpdater :: Comparing Movies in Plex to find similar movies...")
|
||||
while i < length:
|
||||
for movie in PlexMovieList:
|
||||
if 85 < fuzz.ratio(PlexMovieList[i], movie) < 100:
|
||||
@ -45,6 +52,8 @@ while i < length:
|
||||
MatchingList.append(PlexMovieList[i])
|
||||
i += 1
|
||||
|
||||
print(f":: {dt.now()} :: CollectionUpdater :: Comparison is finished...")
|
||||
|
||||
for movie in MatchingList:
|
||||
movieSearch = tmdbMovie.search(movie)
|
||||
movieId = movieSearch[0].id
|
||||
@ -60,4 +69,4 @@ for id in TMDbCollection:
|
||||
MovieCollectionFinal.append(tmdbCollection.details(id))
|
||||
|
||||
for movie in MovieCollectionFinal:
|
||||
print(movie)
|
||||
print(movie.name)
|
Loading…
x
Reference in New Issue
Block a user