mirror of
https://github.com/mza921/Plex-Auto-Collections
synced 2024-11-25 05:20:20 +00:00
Merge pull request #186 from mza921/develop
Legacy movie agent performance
This commit is contained in:
commit
c54998a1da
7 changed files with 25 additions and 12 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -10,3 +10,5 @@ config/config-*
|
|||
config/*.pickle
|
||||
**/cache.db*
|
||||
**/*.cache*
|
||||
config/*.yml
|
||||
config/db/*
|
|
@ -4,6 +4,10 @@ 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.9.0] - 2021-01-20 - [#142](https://github.com/mza921/Plex-Auto-Collections/pull/186)
|
||||
### Added
|
||||
- Legacy Plex Movie Agent GUIDs are now added to the GUID map to improve mapping performance
|
||||
|
||||
## [2.8.2] - 2020-12-26 - [#156](https://github.com/mza921/Plex-Auto-Collections/pull/156)
|
||||
### Fixed
|
||||
- [#151](https://github.com/mza921/Plex-Auto-Collections/issues/151) - Fixed variable reference in Radarr integration
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Plex Auto Collections
|
||||
##### Version 2.8.2
|
||||
##### Version 2.9.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)
|
||||
|
|
|
@ -43,8 +43,8 @@ def imdb_get_ids(plex, imdb_url):
|
|||
results = re.search('(?<=<div class="desc lister-total-num-results">).*?(?=</div>)', str(r.content))
|
||||
total = 100 if results is None else re.search('(\\d+)', results.group(0).replace(',', '')).group(1)
|
||||
else:
|
||||
results = re.search('<span>\\d+-\\d+ of \\d+ titles.</span>', str(r.content))
|
||||
total = 100 if results is None else re.findall('(\\d+)', results.group(0).replace(',', ''))[2]
|
||||
results = re.search('<span>\\d+-\\d+ of \\S+ titles.</span>', str(r.content))
|
||||
total = 100 if results is None else re.findall('(\\d+)', results.group(0).replace(',', ''))[-1]
|
||||
for i in range(1, math.ceil(int(total) / 100)):
|
||||
if imdb_url.startswith("https://www.imdb.com/list/ls"):
|
||||
r = requests.get(imdb_url + '?page={}'.format(i + 1), headers={'Accept-Language': library_language})
|
||||
|
@ -292,9 +292,9 @@ def tmdb_get_shows(config_path, plex, plex_map, data, method):
|
|||
for tshow in tmdb_shows:
|
||||
count += 1
|
||||
t_tvs.append(tshow.id)
|
||||
if count == amount:
|
||||
if count == data:
|
||||
break
|
||||
if count == amount:
|
||||
if count == data:
|
||||
break
|
||||
elif method in ["tmdb_popular", "tmdb_top_rated", "tmdb_trending_daily", "tmdb_trending_weekly"]:
|
||||
trending = Trending()
|
||||
|
|
|
@ -1002,7 +1002,7 @@ print("| | _/| |/ -_)\ \ / / _ \| || || _|/ _ \ | (__ / _ \| || |/ -_)/ _|
|
|||
print("| |_| |_|\___|/_\_\ /_/ \_\\\\_,_| \__|\___/ \___|\___/|_||_|\___|\__| \__||_|\___/|_||_|/__/ |")
|
||||
print("| |")
|
||||
print("|===================================================================================================|")
|
||||
print("| Version 2.8.2")
|
||||
print("| Version 2.9.0")
|
||||
print("| Locating config...")
|
||||
config_path = None
|
||||
app_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
|
|
|
@ -96,7 +96,7 @@ def get_map(config_path, plex):
|
|||
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
|
||||
update = None # TODO: Use this to refresh the GUID map
|
||||
key_id = None
|
||||
error_message = "Unable to map {} ID".format("TMDb/IMDb" if plex.library_type == "movie" else "TVDb")
|
||||
|
||||
|
@ -113,18 +113,25 @@ def get_map(config_path, plex):
|
|||
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)))
|
||||
print(adjust_space(current_length, "| GUID map | {} | {:<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:
|
||||
if 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)))
|
||||
print(adjust_space(current_length, "| GUID map | {} | {:<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
|
||||
# Check GUID map for TMDb ID
|
||||
key_id = query_guid_map(config_path, item.guid, 'tmdb_id')
|
||||
if TMDB.valid and key_id is None:
|
||||
key_id = imdb_tools.imdb_get_tmdb(config_path, check_id)
|
||||
if key_id:
|
||||
print(adjust_space(current_length, "| GUID map | {} | {:<46} | {:<6} | {}".format("^" if update == True else "+", item.guid, key_id, item.title)))
|
||||
update_guid_map(config_path, item.guid, tmdb_id=key_id)
|
||||
if TraktClient.valid and key_id is None:
|
||||
key_id = trakt_tools.trakt_imdb_to_tmdb(config_path, check_id)
|
||||
if key_id:
|
||||
print(adjust_space(current_length, "| GUID map | {} | {:<46} | {:<6} | {}".format("^" if update == True else "+", item.guid, key_id, item.title)))
|
||||
update_guid_map(config_path, item.guid, tmdb_id=key_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)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
PyYAML==5.3.1
|
||||
# Less common, pinned
|
||||
PlexAPI==4.2.0
|
||||
tmdbv3api==1.7.1
|
||||
tmdbv3api==1.7.4
|
||||
trakt.py==4.2.0
|
||||
# More common, flexible
|
||||
bs4
|
||||
|
|
Loading…
Reference in a new issue