Revert "Merge pull request #142 from mza921/performance"

This reverts commit b9834a1b74, reversing
changes made to 62b1c3e0da.
This commit is contained in:
mza921 2020-12-16 23:40:52 -08:00
parent 9f47905558
commit 5aef838fcd
7 changed files with 131 additions and 269 deletions

1
.gitignore vendored
View file

@ -8,5 +8,4 @@ app/images
app/config.yml
config/config-*
config/*.pickle
config/db/*
**/cache.db*

View file

@ -4,36 +4,6 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.8.0] - 2020-12-14 - [#142](https://github.com/mza921/Plex-Auto-Collections/pull/142)
### Added
- Faster initialization of a GUID mapping database for the new Plex Movie Agent using the Plex database
### Removed
- `cache` and `cache_interval` options removed from the config. Movie/Show ID lookups are now always cached on each script execution.
### Fixed
- [#132](https://github.com/mza921/Plex-Auto-Collections/issues/132) - plex_search with a range of years
## [2.7.0] - 2020-11-26 - [#115](https://github.com/mza921/Plex-Auto-Collections/pull/115)
### Added
- Added `tmdb_trending_daily` and `tmdb_trending_weekly`
- Added requirements checking with an error message telling the user to update their requirements
- [#98](https://github.com/mza921/Plex-Auto-Collections/issues/98) - Added `cache` attribute to cache the IDs of movies/shows for quicker lookup and `cache_update_interval` to determine how often to update the cache
- [#123](https://github.com/mza921/Plex-Auto-Collections/issues/123) - Added new filter `plex_collection`
- [#125](https://github.com/mza921/Plex-Auto-Collections/issues/125) - Added error message for YAML Scan Failures
### Changed
- Created a mapping for TMDb ID to Plex Rating Key once each run instead of every time tmdb, imdb, tvdb, or trakt list was run.
- [#110](https://github.com/mza921/Plex-Auto-Collections/issues/110) - Added `add_to_radarr` as a collection level attribute override
- [#121](https://github.com/mza921/Plex-Auto-Collections/issues/121) - Added paging to `tmdb_network` and `tmdb_company` for show libraries
- Upgrade tmdbv3api dependency to 1.7.1
### Fixed
- [#109](https://github.com/mza921/Plex-Auto-Collections/issues/109) - The Cache shouldn't be created unless it has to be
- [#117](https://github.com/mza921/Plex-Auto-Collections/issues/117) - Typo
- [#118](https://github.com/mza921/Plex-Auto-Collections/issues/118) - Check for to see if the tmdb attribute exists
- [#120](https://github.com/mza921/Plex-Auto-Collections/issues/120) - Sometimes the collection wasn't found
## [2.6.0] - 2020-11-12 - [#113](https://github.com/mza921/Plex-Auto-Collections/pull/113)
### Added
- [#107](https://github.com/mza921/Plex-Auto-Collections/issues/107) - Added `plex_collection`

View file

@ -1,6 +1,5 @@
# Plex Auto Collections
##### Version 2.8.0
##### Version 2.6.0
Plex Auto Collections is a Python 3 script that works off a configuration file to create/update Plex collections. Collection management with this tool can be automated in a varying degree of customizability. Supports IMDB, TMDb, and Trakt lists as well as built in Plex Searches using actors, genres, year, studio and more.
![https://i.imgur.com/iHAYFIZ.png](https://i.imgur.com/iHAYFIZ.png)
@ -1119,16 +1118,13 @@ plex: # Req
Note that Plex does not allow a `show` to be added to a `movie` library or vice versa.
For `movie` libraries that use the new Plex Movie agent, a temporary copy of the Plex database is downloaded to facilitate the identification of movies. This occurs only during an initial run of the script, per config file. Depending on the size of the library, this can result in a large download.
This script can be run on a remote Plex server, but be sure that the `url` provided is publicly addressable and it's recommended to use `HTTPS`.
You can set the global default [Sync Mode](#sync-mode-collection-attribute) here by using `sync_mode`. Set it to `append` to only add movies/shows to the collection or set it to `sync` to add movies/shows to the collection and remove movies/shows from a collection.
| Sync Options | Description |
| :-- | :-- |
| `append` | Only Add Items to the Collection |
| `sync` | Add & Remove Items from the Collection |
##### Options
- `append` (Only Add Items to the Collection)
- `sync` (Add & Remove Items from the Collection)
Lastly, if you need help finding your Plex authentication token, please see Plex's [support article](https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/).

View file

@ -76,45 +76,45 @@ def imdb_get_movies(config_path, plex, data):
tmdb = TMDb()
tmdb.api_key = config_tools.TMDB(config_path).apikey
movie = Movie()
movie.api_key = config_tools.TMDB(config_path).apikey
return str(movie.external_ids(tmdb_id)['imdb_id'])
imdb_map = {}
matched_imdb_movies = []
missing_imdb_movies = []
current_length = 0
current_count = 0
plex_tools.create_cache(config_path)
plex_movies = plex.Library.all()
for m in plex_movies:
current_count += 1
print_display = "| Processing: {}/{} {}".format(current_count, len(plex_movies), m.title)
print(adjust_space(current_length, print_display), end="\r")
current_length = len(print_display)
if 'plex://' in m.guid:
item = m
# Check cache for imdb_id
imdb_id = plex_tools.query_cache(config_path, item.guid, 'imdb_id')
if not imdb_id:
imdb_id, tmdb_id = plex_tools.alt_id_lookup(plex, item)
print(adjust_space(current_length, "| Cache | + | {} | {} | {} | {}".format(item.guid, imdb_id, tmdb_id, item.title)))
plex_tools.update_cache(config_path, item.guid, imdb_id=imdb_id, tmdb_id=tmdb_id)
elif 'themoviedb://' in m.guid:
if not tmdb.api_key == "None":
tmdb_id = m.guid.split('themoviedb://')[1].split('?')[0]
tmdbapi = movie.details(tmdb_id)
imdb_id = tmdbapi.imdb_id if hasattr(tmdbapi, 'imdb_id') else None
else:
imdb_id = None
elif 'imdb://' in m.guid:
imdb_id = m.guid.split('imdb://')[1].split('?')[0]
else:
imdb_id = None
def tmdb_get_tvdb(config_path, tmdb_id):
show = TV()
show.api_key = config_tools.TMDB(config_path).apikey
return str(show.external_ids(tmdb_id)['tvdb_id'])
if imdb_id and imdb_id in title_ids:
imdb_map[imdb_id] = m
else:
imdb_map[m.ratingKey] = m
def imdb_get_tmdb(config_path, imdb_id):
movie = Movie()
movie.api_key = config_tools.TMDB(config_path).apikey
search = movie.external(external_id=imdb_id, external_source="imdb_id")['movie_results']
if len(search) == 1:
try:
return str(search[0]['id'])
except IndexError:
return None
else:
return None
print(adjust_space(current_length, "| Processed {} Movies".format(len(plex_movies))))
def tvdb_get_tmdb(config_path, tvdb_id):
movie = Movie()
movie.api_key = config_tools.TMDB(config_path).apikey
search = movie.external(external_id=tvdb_id, external_source="tvdb_id")['tv_results']
if len(search) == 1:
try:
return str(search[0]['id'])
except IndexError:
return None
else:
return None
def imdb_get_movies(config_path, plex, plex_map, data):
title_ids = data[1]
print("| {} Movies found on IMDb".format(len(title_ids)))
t_movie = Movie()
t_movie.api_key = config_tools.TMDB(config_path).apikey
matched = []
missing = []
for imdb_id in title_ids:
movie = imdb_map.pop(imdb_id, None)
if movie:
@ -154,9 +154,9 @@ def tmdb_get_movies(config_path, plex, data, method):
if count == amount:
break
elif method in ["tmdb_popular", "tmdb_top_rated", "tmdb_now_playing", "tmdb_trending_daily", "tmdb_trending_weekly"]:
trending = Trending()
trending.api_key = t_movie.api_key
for x in range(int(int(data) / 20) + 1):
#trending = Trending() #TURNON:Trending
#trending.api_key = t_movie.api_key #TURNON:Trending
for x in range(int(data / 20) + 1):
if method == "tmdb_popular":
tmdb_movies = t_movie.popular(x + 1)
elif method == "tmdb_top_rated":
@ -231,10 +231,40 @@ def tmdb_get_movies(config_path, plex, data, method):
matched = []
missing = []
for mid in t_movs:
mid = str(mid)
if mid in plex_map:
matched.append(plex.Server.fetchItem(plex_map[mid]))
plex_tools.create_cache(config_path)
# We want to search for a match first to limit TMDb API calls
# Too many rapid calls can cause a momentary block
# If needed in future maybe add a delay after x calls to let the limit reset
for mid in t_movs: # For each TMBd ID in TMBd Collection
match = False
for m in p_m_map: # For each movie in Plex
item = m
agent_type = urlparse(m.guid).scheme.split('.')[-1]
# Plex movie agent
if agent_type == 'plex':
# Check cache for tmdb_id
tmdb_id = plex_tools.query_cache(config_path, item.guid, 'tmdb_id')
imdb_id = plex_tools.query_cache(config_path, item.guid, 'imdb_id')
if not tmdb_id:
imdb_id, tmdb_id = plex_tools.alt_id_lookup(plex, item)
print("| Cache | + | {} | {} | {} | {}".format(item.guid, imdb_id, tmdb_id, item.title))
plex_tools.update_cache(config_path, item.guid, imdb_id=imdb_id, tmdb_id=tmdb_id)
if int(tmdb_id) == int(mid):
match = True
break
elif agent_type == 'themoviedb':
if int(p_m_map[m]) == int(mid):
match = True
break
elif agent_type == 'imdb':
imdb_id = t_movie.details(mid).imdb_id
for m in p_m_map:
if "tt" in p_m_map[m]:
if p_m_map[m] == imdb_id:
match = True
break
if match:
matched.append(m)
else:
# Duplicate TMDb call?
missing.append(t_movie.details(mid).imdb_id)
@ -315,9 +345,9 @@ def tmdb_get_shows(config_path, plex, data, method):
break
run_discover(data)
elif method in ["tmdb_popular", "tmdb_top_rated", "tmdb_trending_daily", "tmdb_trending_weekly"]:
trending = Trending()
trending.api_key = t_movie.api_key
for x in range(int(int(data) / 20) + 1):
#trending = Trending() #TURNON:Trending
#trending.api_key = t_movie.api_key #TURNON:Trending
for x in range(int(data / 20) + 1):
if method == "tmdb_popular":
tmdb_shows = t_tv.popular(x + 1)
elif method == "tmdb_top_rated":
@ -401,8 +431,23 @@ def tmdb_get_shows(config_path, plex, data, method):
return matched, missing
def tvdb_get_shows(config_path, plex, plex_map, data):
tvdb_id = str(data)
def tvdb_get_shows(config_path, plex, data):
config_tools.TraktClient(config_path)
id = int(data)
p_tv_map = {}
for item in plex.Library.all():
guid = urlparse(item.guid)
item_type = guid.scheme.split('.')[-1]
if item_type == 'thetvdb':
tvdb_id = guid.netloc
elif item_type == 'themoviedb' and TraktClient.valid:
tvdb_id = get_tvdb_id_from_tmdb_id(guid.netloc)
else:
tvdb_id = None
p_tv_map[item] = tvdb_id
matched = []
missing = []
match = False

View file

@ -497,7 +497,7 @@ def update_from_config(config_path, plex, headless=False, no_meta=False, no_imag
year_pair = get_method_pair_year(final_attr, collections[c][m][search_attr])
if len(year_pair[1]) > 0:
searches_used.append(final_attr[:-4] if final_attr.endswith(".not") else final_attr)
search.append(get_method_pair_int(final_attr, year_pair[1], final_attr[:-4] if final_attr.endswith(".not") else final_attr))
search.append(get_method_pair_int(final_attr, collections[c][m][search_attr], final_attr[:-4] if final_attr.endswith(".not") else final_attr))
elif final_attr in plex_searches:
if final_attr.startswith("tmdb_"):
final_attr = final_attr[5:]
@ -962,7 +962,7 @@ print("| | _/| |/ -_)\ \ / / _ \| || || _|/ _ \ | (__ / _ \| || |/ -_)/ _|
print("| |_| |_|\___|/_\_\ /_/ \_\\\\_,_| \__|\___/ \___|\___/|_||_|\___|\__| \__||_|\___/|_||_|/__/ |")
print("| |")
print("|===================================================================================================|")
print("| Version 2.8.0")
print("| Version 2.6.0")
print("| Locating config...")
config_path = None
app_dir = os.path.dirname(os.path.abspath(__file__))

View file

@ -16,10 +16,6 @@ from urllib.request import urlopen
from urllib.parse import urlparse
import os
import sqlite3
import tempfile
import glob
import shutil
from contextlib import closing
def get_movie(plex, data):
@ -87,108 +83,6 @@ def get_actor_rkey(plex, data):
except UnboundLocalError:
raise ValueError("| Config Error: Actor: {} not found".format(search))
def get_map(config_path, plex):
plex_map = {}
current_length = 0
current_count = 0
if TMDB.valid:
tmdb = TMDb()
tmdb.api_key = TMDB(config_path).apikey
tmovie = TMDb_Movie()
print("|")
if plex.library_type == "movie":
config_dir = os.path.dirname(config_path)
db_dir = os.path.join(config_dir, 'db')
guid_map = os.path.join(db_dir, "{}_guid.db".format(os.path.splitext(os.path.basename(config_path))[0]))
if not os.path.isfile(guid_map):
create_guid_map(config_path)
update_guid_map_from_db(config_path, plex)
print("| Mapping Plex {}".format("Movies" if plex.library_type == "movie" else "Shows"))
plex_items = plex.Library.all()
try:
for item in plex_items:
current_count += 1
print_display = "| Processing: {}/{} {}".format(current_count, len(plex_items), item.title)
print(adjust_space(current_length, print_display), end="\r")
current_length = len(print_display)
update = None
key_id = None
error_message = "Unable to map {} ID".format("TMDb/IMDb" if plex.library_type == "movie" else "TVDb")
guid = urlparse(item.guid)
item_type = guid.scheme.split('.')[-1]
check_id = guid.netloc
if item_type == 'plex' and plex.library_type == "movie":
# Check GUID map for TMDb ID
key_id = query_guid_map(config_path, item.guid, 'tmdb_id')
# Check GUID map for for IMDb ID
if not key_id:
key_id = query_guid_map(config_path, item.guid, 'imdb_id')
if not key_id:
imdb_id, tmdb_id = alt_id_lookup(plex, item)
if tmdb_id:
key_id = tmdb_id
print(adjust_space(current_length, "| Cache | {} | {:<46} | {:<6} | {}".format("^" if update == True else "+", item.guid, key_id, item.title)))
update_guid_map(config_path, item.guid, tmdb_id=key_id)
elif imdb_id:
key_id = imdb_id
print(adjust_space(current_length, "| Cache | {} | {:<46} | {:<6} | {}".format("^" if update == True else "+", item.guid, key_id, item.title)))
update_guid_map(config_path, item.guid, imdb_id=key_id)
elif item_type == 'imdb' and plex.library_type == "movie":
key_id = None
if TMDB.valid and key_id is None:
key_id = imdb_tools.imdb_get_tmdb(config_path, check_id)
if TraktClient.valid and key_id is None:
key_id = trakt_tools.trakt_imdb_to_tmdb(config_path, check_id)
if key_id is None:
if TMDB.valid and TraktClient.valid:
error_message = "Unable to convert IMDb ID: {} to TMDb ID using TMDb or Trakt".format(check_id)
elif TMDB.valid:
error_message = "Unable to convert IMDb ID: {} to TMDb ID using TMDb".format(check_id)
elif TraktClient.valid:
error_message = "Unable to convert IMDb ID: {} to TMDb ID using Trakt".format(check_id)
else:
error_message = "Configure TMDb or Trakt to covert IMDb ID: {} to TMDb ID".format(check_id)
elif item_type == 'themoviedb' and plex.library_type == "movie":
tmdbapi = tmovie.details(check_id)
if hasattr(tmdbapi, 'id'):
key_id = tmdbapi.id
else:
key_id = None
error_message = "TMDb ID: {} Invalid".format(check_id)
elif item_type == 'thetvdb' and plex.library_type == "show":
key_id = check_id
elif item_type == 'themoviedb' and plex.library_type == "show":
key_id = None
if TMDB.valid and key_id is None:
key_id = imdb_tools.tmdb_get_tvdb(config_path, check_id)
if TraktClient.valid and key_id is None:
key_id = trakt_tools.trakt_tmdb_to_tvdb(config_path, check_id)
if key_id is None:
if TMDB.valid and TraktClient.valid:
error_message = "Unable to convert TMDb ID: {} to TVDb ID using TMDb or Trakt".format(check_id)
elif TMDB.valid:
error_message = "Unable to convert TMDb ID: {} to TVDb ID using TMDb".format(check_id)
elif TraktClient.valid:
error_message = "Unable to convert TMDb ID: {} to TVDb ID using Trakt".format(check_id)
else:
error_message = "Configure TMDb or Trakt to covert TMDb ID: {} to TVDb ID".format(check_id)
elif item_type == "local":
key_id = None
error_message = "No match in Plex"
else:
key_id = None
error_message = "Agent {} not supported".format(item_type)
if key_id:
plex_map[key_id] = item.ratingKey
else:
print(adjust_space(current_length, "| {} {:<46} | {} for {}".format("Cache | ! |", item.guid, error_message, item.title)))
print(adjust_space(current_length, "| Processed {} {}".format(len(plex_items), "Movies" if plex.library_type == "movie" else "Shows")))
except:
print()
raise
return plex_map
# subtype can be 'movie', 'show', or None (movie/tv combined)
def get_collection(plex, data, exact=None, subtype=None):
collection_list = plex.Library.search(title=data, libtype="collection")
@ -460,8 +354,8 @@ def delete_collection(data):
data.delete()
print("| Collection deleted")
def alt_id_lookup(plex, movie):
req = Request('{}{}'.format(plex.url, movie.key))
def alt_id_lookup(plex, value):
req = Request('{}{}'.format(plex.url, value.key))
req.add_header('X-Plex-Token', plex.token)
req.add_header('User-Agent', 'Mozilla/5.0')
with urlopen(req) as response:
@ -478,79 +372,37 @@ def alt_id_lookup(plex, movie):
tmdb_id = guid
return imdb_id, tmdb_id
def create_guid_map(config_path):
config_dir = os.path.dirname(config_path)
db_dir = os.path.join(config_dir, 'db')
os.makedirs(db_dir, exist_ok=True)
guid_map = os.path.join(db_dir, "{}_guid.db".format(os.path.splitext(os.path.basename(config_path))[0]))
with closing(sqlite3.connect(guid_map)) as connection:
def create_cache(config_path):
cache = os.path.join(os.path.dirname(config_path), 'cache.db')
connection = sqlite3.connect(cache)
with sqlite3.connect(cache) as connection:
connection.row_factory = sqlite3.Row
with closing(connection.cursor()) as cursor:
cursor.execute(''' SELECT count(name) FROM sqlite_master WHERE type='table' AND name='guids' ''')
if cursor.fetchone()[0] != 1:
print("| Initializing GUID map database at {}".format(guid_map))
cursor.execute('CREATE TABLE IF NOT EXISTS guids (plex_guid TEXT PRIMARY KEY, imdb_id TEXT, tmdb_id TEXT, updated TEXT)')
else:
print("| Using GUID map database at {}".format(guid_map))
cursor = connection.cursor()
cursor.execute(''' SELECT count(name) FROM sqlite_master WHERE type='table' AND name='guids' ''')
if cursor.fetchone()[0] != 1:
print("| Initializing cache database.".format(cache))
cursor.execute('CREATE TABLE IF NOT EXISTS guids (plex_guid TEXT PRIMARY KEY, imdb_id TEXT, tmdb_id TEXT)')
def update_guid_map_from_db(config_path, plex):
config_dir = os.path.dirname(config_path)
temp_dir = tempfile.mkdtemp(dir=config_dir)
print("| Downloading temporary database to {}".format(temp_dir))
plex.Server.downloadDatabases(savepath=temp_dir, unpack=True)
os.remove(glob.glob(os.path.join(temp_dir, '*.zip'))[0])
plex_temp_db = glob.glob(os.path.join(temp_dir, '*'))[0]
print("| Updating GUID map from database")
with closing(sqlite3.connect(plex_temp_db)) as connection:
def query_cache(config_path, key, column):
cache = os.path.join(os.path.dirname(config_path), 'cache.db')
with sqlite3.connect(cache) as connection:
connection.row_factory = sqlite3.Row
with closing(connection.cursor()) as cursor:
for row in cursor.execute(
'''SELECT t.tag, mdi.guid, mdi.title, mdi.year
FROM metadata_items mdi
JOIN taggings tg
ON tg.metadata_item_id = mdi.id
JOIN tags t
ON t.id = tg.tag_id
AND t.tag_type = 314
WHERE mdi.metadata_type = 1
AND mdi.library_section_id = ?
AND (t.tag LIKE 'tmdb://%'
OR t.tag LIKE 'imdb://%')
GROUP BY mdi.id, t.tag''', (plex.Library.key, )):
if 'imdb' in row['tag']:
update_guid_map(config_path, row['guid'], imdb_id=urlparse(row['tag']).netloc)
elif 'tmdb' in row['tag']:
update_guid_map(config_path, row['guid'], tmdb_id=urlparse(row['tag']).netloc)
print("| GUID map | + | {:38} | {:<9} | {} ({})".format(row['guid'], urlparse(row['tag']).netloc, row['title'], row['year']))
shutil.rmtree(temp_dir)
cursor = connection.cursor()
cursor.execute("SELECT * FROM guids WHERE plex_guid = ?", (key, ))
row = cursor.fetchone()
if row:
return row[column]
def query_guid_map(config_path, key, column):
config_dir = os.path.dirname(config_path)
db_dir = os.path.join(config_dir, 'db')
guid_map = os.path.join(db_dir, "{}_guid.db".format(os.path.splitext(os.path.basename(config_path))[0]))
with closing(sqlite3.connect(guid_map)) as connection:
def update_cache(config_path, plex_guid, **kwargs):
cache = os.path.join(os.path.dirname(config_path), 'cache.db')
with sqlite3.connect(cache) as connection:
connection.row_factory = sqlite3.Row
with closing(connection.cursor()) as cursor:
cursor.execute("SELECT * FROM guids WHERE plex_guid = ?", (key, ))
row = cursor.fetchone()
if row:
return row[column]
def update_guid_map(config_path, plex_guid, **kwargs):
config_dir = os.path.dirname(config_path)
db_dir = os.path.join(config_dir, 'db')
guid_map = os.path.join(db_dir, "{}_guid.db".format(os.path.splitext(os.path.basename(config_path))[0]))
with closing(sqlite3.connect(guid_map)) as connection:
connection.row_factory = sqlite3.Row
with closing(connection.cursor()) as cursor:
cursor.execute('INSERT OR IGNORE INTO guids(plex_guid) VALUES(?)', (plex_guid, ))
if 'imdb_id' in kwargs:
imdb_id = kwargs['imdb_id']
cursor.execute('INSERT OR IGNORE INTO guids(plex_guid, imdb_id, updated) VALUES(?, ?, ?)', (plex_guid, imdb_id, datetime.now()))
cursor.execute('UPDATE guids SET imdb_id = ?, updated = ? WHERE plex_guid = ?', (imdb_id, datetime.now(), plex_guid))
if 'tmdb_id' in kwargs:
tmdb_id = kwargs['tmdb_id']
cursor.execute('INSERT OR IGNORE INTO guids(plex_guid, tmdb_id, updated) VALUES(?, ?, ?)', (plex_guid, tmdb_id, datetime.now()))
cursor.execute('UPDATE guids SET tmdb_id = ?, updated = ? WHERE plex_guid = ?', (tmdb_id, datetime.now(), plex_guid))
connection.commit()
cursor = connection.cursor()
if 'imdb_id' in kwargs:
imdb_id = kwargs['imdb_id']
cursor.execute('INSERT OR IGNORE INTO guids(plex_guid, imdb_id) VALUES(?, ?)', (plex_guid, imdb_id, ))
cursor.execute('UPDATE guids SET imdb_id = ? WHERE plex_guid = ?', (imdb_id, plex_guid))
if 'tmdb_id' in kwargs:
tmdb_id = kwargs['tmdb_id']
cursor.execute('INSERT OR IGNORE INTO guids(plex_guid, tmdb_id) VALUES(?, ?)', (plex_guid, tmdb_id, ))
cursor.execute('UPDATE guids SET tmdb_id = ? WHERE plex_guid = ?', (tmdb_id, plex_guid))

View file

@ -22,7 +22,7 @@ def trakt_get_movies(config_path, plex, data, method):
trakt_url = trakt_url[:-1]
trakt_list_path = urlparse(trakt_url).path
trakt_list_items = trakt.Trakt[trakt_list_path].items()
title_ids = [str(m.get_key('tmdb')) for m in trakt_list_items if isinstance(m, trakt.objects.movie.Movie)]
title_ids = [m.pk[1] for m in trakt_list_items if isinstance(m, trakt.objects.movie.Movie)]
imdb_map = {}
if title_ids: