update
This commit is contained in:
parent
85399580cb
commit
4b3c714261
@ -2,28 +2,37 @@ from config.config import Config
|
|||||||
from tmdbv3api import TMDb, Movie, Collection
|
from tmdbv3api import TMDb, Movie, Collection
|
||||||
from plexapi.server import PlexServer
|
from plexapi.server import PlexServer
|
||||||
from fuzzywuzzy import fuzz
|
from fuzzywuzzy import fuzz
|
||||||
|
from models.movie_collection import MovieCollection
|
||||||
|
|
||||||
# Instantiate Tmdb object
|
# Instantiate Tmdb object
|
||||||
tmdb = TMDb()
|
tmdb = TMDb()
|
||||||
tmdb.api_key = Config.tmdbApiKey
|
tmdb.api_key = Config.tmdbApiKey
|
||||||
tmdb.language = Config.tmdbLanguage
|
tmdb.language = Config.tmdbLanguage
|
||||||
|
|
||||||
# Instantiate movie object
|
# Instantiate TMDb movie & collection object
|
||||||
tmdbMovie = Movie()
|
tmdbMovie = Movie()
|
||||||
tmdbCollection = Collection()
|
tmdbCollection = Collection()
|
||||||
|
|
||||||
|
# Connect to Plex Server
|
||||||
baseurl = Config.plexBaseUrl
|
baseurl = Config.plexBaseUrl
|
||||||
token = Config.plexToken
|
token = Config.plexToken
|
||||||
plex = PlexServer(baseurl, token)
|
plex = PlexServer(baseurl, token)
|
||||||
|
|
||||||
|
# Create empty lists
|
||||||
|
AvailablePlexCollectionsMovies = []
|
||||||
PlexMovieList = []
|
PlexMovieList = []
|
||||||
MatchingList = []
|
MatchingList = []
|
||||||
TMDbCollection = []
|
TMDbCollection = []
|
||||||
MovieCollectionFinal = []
|
MovieCollectionFinal = []
|
||||||
|
|
||||||
movies = plex.library.section('Movies')
|
# Retrieve the library Movies from Plex
|
||||||
for video in movies.search():
|
plexMoviesLibrary = plex.library.section('Movies')
|
||||||
PlexMovieList.append(video.title)
|
|
||||||
|
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
|
i = 0
|
||||||
|
|
||||||
|
4
models/movie_collection.py
Normal file
4
models/movie_collection.py
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
class MovieCollection:
|
||||||
|
def __init__(self, id, title):
|
||||||
|
self.collectionTitle = title
|
||||||
|
self.collectionId = id
|
Loading…
x
Reference in New Issue
Block a user