first commit
This commit is contained in:
commit
216a001f60
56
app/plexAutoCollectionUpdater.py
Normal file
56
app/plexAutoCollectionUpdater.py
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
from config.config import Config
|
||||||
|
from tmdbv3api import TMDb, Movie, Collection
|
||||||
|
from plexapi.server import PlexServer
|
||||||
|
from fuzzywuzzy import fuzz
|
||||||
|
|
||||||
|
# Instantiate Tmdb object
|
||||||
|
tmdb = TMDb()
|
||||||
|
tmdb.api_key = Config.tmdbApiKey
|
||||||
|
tmdb.language = Config.tmdbLanguage
|
||||||
|
|
||||||
|
# Instantiate movie object
|
||||||
|
tmdbMovie = Movie()
|
||||||
|
tmdbCollection = Collection()
|
||||||
|
|
||||||
|
baseurl = Config.plexBaseUrl
|
||||||
|
token = Config.plexToken
|
||||||
|
plex = PlexServer(baseurl, token)
|
||||||
|
|
||||||
|
PlexMovieList = []
|
||||||
|
MatchingList = []
|
||||||
|
TMDbCollection = []
|
||||||
|
MovieCollectionFinal = []
|
||||||
|
|
||||||
|
movies = plex.library.section('Movies')
|
||||||
|
for video in movies.search():
|
||||||
|
PlexMovieList.append(video.title)
|
||||||
|
|
||||||
|
i = 0
|
||||||
|
|
||||||
|
length = len(PlexMovieList)
|
||||||
|
|
||||||
|
while i < length:
|
||||||
|
|
||||||
|
for movie in PlexMovieList:
|
||||||
|
if fuzz.ratio(PlexMovieList[i], movie) > 85 and fuzz.ratio(PlexMovieList[i], movie) < 100:
|
||||||
|
if PlexMovieList[i] not in MatchingList:
|
||||||
|
MatchingList.append(PlexMovieList[i])
|
||||||
|
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
for movie in MatchingList:
|
||||||
|
movieSearch = tmdbMovie.search(movie)
|
||||||
|
movieId = movieSearch[0].id
|
||||||
|
movieDetails = tmdbMovie.details(movie_id=movieId)
|
||||||
|
|
||||||
|
if movieDetails.belongs_to_collection is not None:
|
||||||
|
collectionId = movieDetails.belongs_to_collection
|
||||||
|
|
||||||
|
if collectionId.id not in TMDbCollection:
|
||||||
|
TMDbCollection.append(collectionId.id)
|
||||||
|
|
||||||
|
for id in TMDbCollection:
|
||||||
|
MovieCollectionFinal.append(tmdbCollection.details(id))
|
||||||
|
pass
|
||||||
|
|
||||||
|
print("")
|
0
config/__init__.py
Normal file
0
config/__init__.py
Normal file
BIN
config/__pycache__/__init__.cpython-39.pyc
Normal file
BIN
config/__pycache__/__init__.cpython-39.pyc
Normal file
Binary file not shown.
BIN
config/__pycache__/config.cpython-39.pyc
Normal file
BIN
config/__pycache__/config.cpython-39.pyc
Normal file
Binary file not shown.
6
config/config.py
Normal file
6
config/config.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
class Config(object):
|
||||||
|
tmdbApiKey = '41d05b7a36ba961740f7c05cc4ef634b'
|
||||||
|
tmdbLanguage = 'fr-FR'
|
||||||
|
tmdbApiUrl = 'https://api.themoviedb.org/3/search/'
|
||||||
|
plexBaseUrl = 'https://plex.rouggy.ovh'
|
||||||
|
plexToken = 'VeQQwtf-sNtWWLwzCEih'
|
3
requirements.txt
Normal file
3
requirements.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
tmdbv3api==1.7.6
|
||||||
|
PlexAPI==4.8.0
|
||||||
|
fuzzywuzzy==0.18.0
|
Loading…
x
Reference in New Issue
Block a user