From 3d898e572aacd5d5816a35d55df327ec79ccbe1f Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Tue, 18 Oct 2022 09:43:09 -0400 Subject: [PATCH] [132] remove CachedSession --- VERSION | 2 +- defaults/overlays/templates.yml | 1 + modules/anidb.py | 1 + modules/config.py | 39 ++++----------------------------- plex_meta_manager.py | 6 ++--- 5 files changed, 10 insertions(+), 39 deletions(-) diff --git a/VERSION b/VERSION index 6498ddd2..10d7ece5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.17.3-develop131 +1.17.3-develop132 diff --git a/defaults/overlays/templates.yml b/defaults/overlays/templates.yml index 2c9926c5..ee34045f 100644 --- a/defaults/overlays/templates.yml +++ b/defaults/overlays/templates.yml @@ -29,6 +29,7 @@ templates: - font_style - stroke_width - stroke_color + - back_color - back_width - back_height - back_align diff --git a/modules/anidb.py b/modules/anidb.py index 9356914b..8be6b595 100644 --- a/modules/anidb.py +++ b/modules/anidb.py @@ -15,6 +15,7 @@ urls = { "tag": f"{base_url}/tag", "login": f"{base_url}/perl-bin/animedb.pl" } + class AniDBObj: def __init__(self, anidb, anidb_id, data): self._anidb = anidb diff --git a/modules/config.py b/modules/config.py index 381aa9c1..a0020ca9 100644 --- a/modules/config.py +++ b/modules/config.py @@ -1,5 +1,5 @@ -import base64, os -from datetime import datetime, timedelta +import base64, os, requests +from datetime import datetime from lxml import html from modules import util, radarr, sonarr, operations from modules.anidb import AniDB @@ -28,7 +28,6 @@ from modules.trakt import Trakt from modules.tvdb import TVDb from modules.util import Failed, NotScheduled, NotScheduledRange, YAML from modules.webhooks import Webhooks -from requests_cache import CachedSession from retrying import retry logger = util.logger @@ -84,36 +83,7 @@ mass_rating_options = { "mal": "Use MyAnimeList Rating" } reset_overlay_options = {"tmdb": "Reset to TMDb poster", "plex": "Reset to Plex Poster"} -urls_expire_after = { - "*.imdb.com": 60 * 60 * 6, - "www.omdbapi.com/": 60 * 60 * 24, - "ergast.com/api/f1/": 60 * 60 * 24, - "anidb.net": 60 * 60 * 24, - "api.anidb.net:9001/httpapi": 60 * 60 * 24, - "graphql.anilist.co": 60 * 60 * 24, - "raw.githubusercontent.com/meisnate12/Plex-Meta-Manager-Anime-IDs/master/pmm_anime_ids.json": 60 * 60 * 24, - "flixpatrol.com": 60 * 60 * 24, - "www.themoviedb.org": 60 * 60 * 24, - "raw.githubusercontent.com/meisnate12/Plex-Meta-Manager-Configs": 60 * 60 * 24, - "www.icheckmovies.com/lists/": 60 * 60 * 24, - "letterboxd.com": 60 * 60 * 24, - "api.myanimelist.net/v2/": 60 * 60 * 24, - "api.jikan.moe/v4/": 60 * 60 * 24, - "api.trakt.tv": 60 * 60 * 24, - "www.thetvdb.com": 60 * 60 * 6, - "thetvdb.com": 60 * 60 * 6, - "s3.amazonaws.com/popular-movies/movies.json": 60 * 60 * 24, - "mdblist.com/lists": 60 * 60 * 12, - "mdblist.com/api": 60 * 60 * 1, - "api.github.com/repos/meisnate12/Plex-Meta-Manager": 60 * 60 * 1, - "raw.githubusercontent.com/meisnate12/": 60 * 60 * 1, - "notifiarr.com/api/v1": 0, - "dev.notifiarr.com/api/v1": 0, - "discord.com": 0, - "hooks.slack.com": 0, - "raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/**/VERSION": 0, - "*": 60 * 60 * 24, -} + class ConfigFile: def __init__(self, default_dir, attrs): logger.info("Locating config...") @@ -391,8 +361,7 @@ class ConfigFile: self.check_nightly = self.general["check_nightly"] self.latest_version = util.current_version(self.version, nightly=self.check_nightly) - self.session = CachedSession("config/http_cache", expire_after=timedelta(days=1), allowable_methods=["GET"], - allowable_codes=[200], match_headers=True, urls_expire_after=urls_expire_after) + self.session = requests.Session() if not self.general["verify_ssl"]: self.session.verify = False if self.session.verify is False: diff --git a/plex_meta_manager.py b/plex_meta_manager.py index 36c3f3b0..19083585 100644 --- a/plex_meta_manager.py +++ b/plex_meta_manager.py @@ -591,7 +591,7 @@ def run_collection(config, library, metadata, requested_collections): raise Failed(e) if not builder.added_items and builder.ignore_blank_results: - raise NonExisting(f"Overlay Warning: No items found") + raise NonExisting(f"{builder.Type} Warning: No items found") builder.display_filters() @@ -620,7 +620,7 @@ def run_collection(config, library, metadata, requested_collections): or (not builder.smart_url and len(builder.added_items) + builder.beginning_count < builder.minimum) ): logger.info("") - logger.info(f"Collection Minimum: {builder.minimum} not met for {mapping_name} Collection") + logger.info(f"{builder.Type} Minimum: {builder.minimum} not met for {mapping_name} Collection") delete_status = f"Minimum {builder.minimum} Not Met" valid = False if builder.details["delete_below_minimum"] and builder.obj: @@ -644,7 +644,7 @@ def run_collection(config, library, metadata, requested_collections): logger.stacktrace() run_item_details = False logger.info("") - logger.separator("No Collection to Update", space=False, border=False) + logger.separator("No {builder.Type} to Update", space=False, border=False) else: details_list = builder.update_details() if details_list: