From c77b4449d73b5dc063bd975a90f8a89ffa3f582e Mon Sep 17 00:00:00 2001 From: burkasaurusrex Date: Wed, 7 Oct 2020 23:55:03 -0600 Subject: [PATCH 01/10] Create dependabot.yml --- .github/dependabot.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..cf7a39f --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "pip" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "daily" From a96060303da29023ceccb035a10534b57649fee8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 Oct 2020 06:34:40 +0000 Subject: [PATCH 02/10] Bump plexapi from 4.1.1 to 4.1.2 Bumps [plexapi](https://github.com/pkkid/python-plexapi) from 4.1.1 to 4.1.2. - [Release notes](https://github.com/pkkid/python-plexapi/releases) - [Commits](https://github.com/pkkid/python-plexapi/compare/4.1.1...4.1.2) Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index d042e15..fe50f67 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ # Remove PyYAML==5.1.2 # Less common, pinned -PlexAPI==4.1.1 +PlexAPI==4.1.2 tmdbv3api==1.6.2 trakt.py==4.2.0 # More common, flexible From c4d48622d6fdd9778532b7366f966bbcdcf9620d Mon Sep 17 00:00:00 2001 From: Burke Davis Date: Mon, 26 Oct 2020 23:24:00 -0700 Subject: [PATCH 03/10] Update docker image --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 89663ff..9004c34 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.8-slim +FROM python:slim VOLUME /config COPY . / RUN \ From b06b534b08fec82088e423bd2c64f000efe07367 Mon Sep 17 00:00:00 2001 From: Burke Davis Date: Tue, 27 Oct 2020 00:02:17 -0700 Subject: [PATCH 04/10] Slight refactor / fix type mismatch --- app/imdb_tools.py | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/app/imdb_tools.py b/app/imdb_tools.py index a6f42ee..58d3015 100644 --- a/app/imdb_tools.py +++ b/app/imdb_tools.py @@ -86,12 +86,17 @@ def imdb_get_movies(config_path, plex, data): return matched_imbd_movies, missing_imdb_movies -def tmdb_get_movies(config_path, plex, data, is_list=False): +def tmdb_parse_id(data): try: - tmdb_id = re.search('.*?(\\d+)', data) + tmdb_id = re.search('.*?(\\d+)', str(data)) tmdb_id = tmdb_id.group(1) + return tmdb_id except AttributeError: # Bad URL Provided raise ValueError("| Config Error: TMDb: {} is invalid".format(data)) + + +def tmdb_get_movies(config_path, plex, data, is_list=False): + tmdb_id = tmdb_parse_id(data) t_movs = [] t_movie = Movie() t_movie.api_key = config_tools.TMDB(config_path).apikey # Set TMDb api key for Movie @@ -212,11 +217,9 @@ def get_tvdb_id_from_tmdb_id(id): def tmdb_get_shows(config_path, plex, data, is_list=False): config_tools.TraktClient(config_path) - try: - tmdb_id = re.search('.*?(\\d+)', data) - tmdb_id = tmdb_id.group(1) - except AttributeError: # Bad URL Provided - return + + tmdb_id = tmdb_parse_id(data) + t_tvs = [] t_tv = TV() t_tv.api_key = config_tools.TMDB(config_path).apikey # Set TMDb api key for Movie @@ -271,11 +274,8 @@ def tmdb_get_shows(config_path, plex, data, is_list=False): def tvdb_get_shows(config_path, plex, data, is_list=False): config_tools.TraktClient(config_path) - try: - id = re.search('(\\d+)', data) - id = id.group(1) - except AttributeError: - raise ValueError("| Config Error: TVDb ID: {} is invalid it must be a number".format(data)) + + id = tmdb_parse_id(data) p_tv_map = {} for item in plex.Library.all(): @@ -306,10 +306,8 @@ def tvdb_get_shows(config_path, plex, data, is_list=False): def tmdb_get_summary(config_path, data, type): # Instantiate TMDB objects - try: - id = re.search('.*?(\\d+)', data).group(1) - except AttributeError: - raise ValueError("| Config Error: TMBd ID: {} is invalid it must be a number".format(data)) + id = tmdb_parse_id(data) + api_key = config_tools.TMDB(config_path).apikey language = config_tools.TMDB(config_path).language is_movie = config_tools.Plex(config_path).library_type == "movie" From 38207498c08bd943f245edb079587d1cfd8455ea Mon Sep 17 00:00:00 2001 From: Burke Davis Date: Tue, 27 Oct 2020 00:08:20 -0700 Subject: [PATCH 05/10] Fix clobber of tvdb id --- app/imdb_tools.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app/imdb_tools.py b/app/imdb_tools.py index 58d3015..93395af 100644 --- a/app/imdb_tools.py +++ b/app/imdb_tools.py @@ -88,11 +88,19 @@ def imdb_get_movies(config_path, plex, data): def tmdb_parse_id(data): try: - tmdb_id = re.search('.*?(\\d+)', str(data)) + tmdb_id = re.search('.*?(\\d+)', str(data)) # re.search requires a string tmdb_id = tmdb_id.group(1) return tmdb_id except AttributeError: # Bad URL Provided - raise ValueError("| Config Error: TMDb: {} is invalid".format(data)) + raise ValueError("| Config Error: TMBd ID: {} is invalid it must be a number".format(data)) + +def tvdb_parse_id(data): + try: + tvdb_id = re.search('(\\d+)', str(data)) # re.search requires a string + tvdb_id = tvdb_id.group(1) + return tvdb_id + except AttributeError: + raise ValueError("| Config Error: TVDb ID: {} is invalid it must be a number".format(data)) def tmdb_get_movies(config_path, plex, data, is_list=False): @@ -275,7 +283,7 @@ def tmdb_get_shows(config_path, plex, data, is_list=False): def tvdb_get_shows(config_path, plex, data, is_list=False): config_tools.TraktClient(config_path) - id = tmdb_parse_id(data) + id = tvdb_parse_id(data) p_tv_map = {} for item in plex.Library.all(): From 842529a6375b05ff86dafcb52e6e9cd71962f36b Mon Sep 17 00:00:00 2001 From: Burke Davis Date: Tue, 27 Oct 2020 00:30:39 -0700 Subject: [PATCH 06/10] Fix typo --- app/plex_auto_collections.py | 2 +- app/plex_tools.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/plex_auto_collections.py b/app/plex_auto_collections.py index fffee92..6a24b2a 100644 --- a/app/plex_auto_collections.py +++ b/app/plex_auto_collections.py @@ -89,7 +89,7 @@ def update_from_config(config_path, plex, headless=False, no_meta=False, no_imag v_print = v if m == "tmdb_id" and tmdb_id is None: try: - tmdb_id = re.search('.*?(\\d+)', v).group(1) + tmdb_id = re.search('.*?(\\d+)', str(v)).group(1) except AttributeError: print("| Config Error: TMDb ID: {} is invalid".format(v)) add = False diff --git a/app/plex_tools.py b/app/plex_tools.py index b5239e4..16faf57 100644 --- a/app/plex_tools.py +++ b/app/plex_tools.py @@ -137,7 +137,7 @@ def add_to_collection(config_path, plex, method, value, c, map, subfilters=None) movies, missing = imdb_tools.imdb_get_movies(config_path, plex, value) elif method == "tmdb_list": movies, missing = imdb_tools.tmdb_get_movies(config_path, plex, value, is_list=True) - elif method in ["tmdb_id", "tmdb_movie", "tmd_collection"]: + elif method in ["tmdb_id", "tmdb_movie", "tmdb_collection"]: movies, missing = imdb_tools.tmdb_get_movies(config_path, plex, value) elif method == "trakt_list" and TraktClient.valid: movies, missing = trakt_tools.trakt_get_movies(config_path, plex, value) From 78dbd4666582761ff0d474d0f62da25f27f8a064 Mon Sep 17 00:00:00 2001 From: Burke Davis Date: Tue, 27 Oct 2020 00:33:27 -0700 Subject: [PATCH 07/10] Bump to version 2.1.1 --- README.md | 2 +- app/plex_auto_collections.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8e9ae8c..9626455 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Plex Auto Collections -##### Version 2.1.0 +##### Version 2.1.1 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 filters such as actors, genres, year, studio and more. ![https://i.imgur.com/iHAYFIZ.png](https://i.imgur.com/iHAYFIZ.png) diff --git a/app/plex_auto_collections.py b/app/plex_auto_collections.py index 6a24b2a..15d509a 100644 --- a/app/plex_auto_collections.py +++ b/app/plex_auto_collections.py @@ -615,7 +615,7 @@ def append_collection(config_path, config_update=None): print("| |_| |_|\___|/_\_\ /_/ \_\\\\_,_| \__|\___/ \___|\___/|_||_|\___|\__| \__||_|\___/|_||_|/__/ |") print("| |") print("|===================================================================================================|") -print("| Version 2.1.0") +print("| Version 2.1.1") print("| Locating config...") config_path = None app_dir = os.path.dirname(os.path.abspath(__file__)) From 0507d44f269c32f6bc601499375769a2ae5b7cfc Mon Sep 17 00:00:00 2001 From: burkasaurusrex Date: Tue, 27 Oct 2020 14:47:38 -0600 Subject: [PATCH 08/10] Log typo fix --- app/imdb_tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/imdb_tools.py b/app/imdb_tools.py index 93395af..81c2e7b 100644 --- a/app/imdb_tools.py +++ b/app/imdb_tools.py @@ -92,7 +92,7 @@ def tmdb_parse_id(data): tmdb_id = tmdb_id.group(1) return tmdb_id except AttributeError: # Bad URL Provided - raise ValueError("| Config Error: TMBd ID: {} is invalid it must be a number".format(data)) + raise ValueError("| Config Error: TMDb ID: {} is invalid it must be a number".format(data)) def tvdb_parse_id(data): try: From d8057a07a99e7f4a3529bec1afcf1b91c08a5046 Mon Sep 17 00:00:00 2001 From: burkasaurusrex Date: Tue, 27 Oct 2020 14:53:23 -0600 Subject: [PATCH 09/10] Fix missing 're' import --- app/plex_auto_collections.py | 1 + 1 file changed, 1 insertion(+) diff --git a/app/plex_auto_collections.py b/app/plex_auto_collections.py index 15d509a..949853a 100644 --- a/app/plex_auto_collections.py +++ b/app/plex_auto_collections.py @@ -1,5 +1,6 @@ import os import argparse +import re import sys import threading import glob From e8a5f431ee5f18c785c50a2440c1e41bdc8695d3 Mon Sep 17 00:00:00 2001 From: burkasaurusrex Date: Tue, 27 Oct 2020 15:02:33 -0600 Subject: [PATCH 10/10] Slight dockerfile tweak --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9004c34..3098e7c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:slim +FROM python:3-slim VOLUME /config COPY . / RUN \