This commit is contained in:
Gregory Salaun 2021-12-08 11:00:52 +01:00
parent 85399580cb
commit 4b3c714261
2 changed files with 17 additions and 4 deletions

View File

@ -2,28 +2,37 @@ from config.config import Config
from tmdbv3api import TMDb, Movie, Collection
from plexapi.server import PlexServer
from fuzzywuzzy import fuzz
from models.movie_collection import MovieCollection
# Instantiate Tmdb object
tmdb = TMDb()
tmdb.api_key = Config.tmdbApiKey
tmdb.language = Config.tmdbLanguage
# Instantiate movie object
# Instantiate TMDb movie & collection object
tmdbMovie = Movie()
tmdbCollection = Collection()
# Connect to Plex Server
baseurl = Config.plexBaseUrl
token = Config.plexToken
plex = PlexServer(baseurl, token)
# Create empty lists
AvailablePlexCollectionsMovies = []
PlexMovieList = []
MatchingList = []
TMDbCollection = []
MovieCollectionFinal = []
movies = plex.library.section('Movies')
for video in movies.search():
PlexMovieList.append(video.title)
# Retrieve the library Movies from Plex
plexMoviesLibrary = plex.library.section('Movies')
for movie in plexMoviesLibrary.all():
for collection in movie.collections:
if collection.tag and collection.tag not in AvailablePlexCollectionsMovies:
AvailablePlexCollectionsMovies.append(collection.tag)
PlexMovieList.append(movie.title)
i = 0

View File

@ -0,0 +1,4 @@
class MovieCollection:
def __init__(self, id, title):
self.collectionTitle = title
self.collectionId = id