Skip to content

Commit

Permalink
Revert "Merge pull request #115 from meisnate12/PerformanceUpdate"
Browse files Browse the repository at this point in the history
This reverts commit c52c81a, reversing
changes made to f8ce499.
  • Loading branch information
mza921 committed Nov 28, 2020
1 parent c52c81a commit 62b1c3e
Show file tree
Hide file tree
Showing 11 changed files with 764 additions and 755 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ app/config.yml
config/config-*
config/*.pickle
**/cache.db*
**/*.cache*
23 changes: 3 additions & 20 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +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.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`
Expand All @@ -43,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- [#50](https://github.com/mza921/Plex-Auto-Collections/issues/50) - Trakt access_token refresh


## [2.4.7] - 2020-11-09 - [#103](https://github.com/mza921/Plex-Auto-Collections/pull/103)
### Fixed
- [#92](https://github.com/mza921/Plex-Auto-Collections/issues/92) - fixed New Plex Movie Agent id lookup behind a proxy
Expand All @@ -56,6 +37,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- [#93](https://github.com/mza921/Plex-Auto-Collections/issues/93) - actually fixed `max_age`



## [2.4.5] - 2020-11-05 - [#97](https://github.com/mza921/Plex-Auto-Collections/pull/97)
### Changed
- `max_age` no longer takes years
Expand Down
308 changes: 117 additions & 191 deletions README.md

Large diffs are not rendered by default.

33 changes: 7 additions & 26 deletions app/config_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import yaml
import ruamel.yaml
import requests
from yaml.scanner import ScannerError
from urllib.parse import urlparse
from tmdbv3api import Collection
from plexapi.exceptions import Unauthorized
Expand All @@ -15,6 +14,7 @@
from plexapi.library import ShowSection
from trakt import Trakt
import trakt_helpers
import trakt


def check_for_attribute(config, attribute, parent=None, test_list=None, options="", default=None, do_print=True, default_is_none=False, var_type="str", throw=False, save=True):
Expand Down Expand Up @@ -76,11 +76,8 @@ def __init__(self, config_path, headless=False):
Config.headless = headless
Config.config_path = config_path
self.config_path = config_path
try:
with open(self.config_path, 'rt', encoding='utf-8') as yml:
self.data = yaml.load(yml, Loader=yaml.FullLoader)
except ScannerError as e:
sys.exit("| Scan Error: {}".format(str(e).replace('\n', '\n|\t ')))
with open(self.config_path, 'rt', encoding='utf-8') as yml:
self.data = yaml.load(yml, Loader=yaml.FullLoader)
if Config.valid == True:
self.collections = check_for_attribute(self.data, "collections", default={}, do_print=False)
self.plex = self.data['plex']
Expand Down Expand Up @@ -158,16 +155,6 @@ def __init__(self, config_path):
except SystemExit as e:
self.sync_mode = check_for_attribute(config, "sync_mode", parent="plex", default="append", test_list=["append", "sync"], do_print=False)
message = message + "\n" + str(e) if len(message) > 0 else str(e)
try:
self.cache = check_for_attribute(config, "cache", parent="plex", options="| \ttrue (Create a cache to store ids)\n| \tfalse (Do not create a cache to store ids)", var_type="bool", default=False, throw=True)
except SystemExit as e:
self.cache = check_for_attribute(config, "cache", parent="plex", var_type="bool", default=False, do_print=False)
message = message + "\n" + str(e) if len(message) > 0 else str(e)
try:
self.cache_interval = check_for_attribute(config, "cache_update_interval", parent="plex", var_type="int", default=60, throw=True)
except SystemExit as e:
self.cache_interval = check_for_attribute(config, "cache_update_interval", parent="plex", var_type="int", default=60, do_print=False)
message = message + "\n" + str(e) if len(message) > 0 else str(e)
self.timeout = 60
if len(fatal_message) > 0:
sys.exit(fatal_message + "\n" + message)
Expand Down Expand Up @@ -201,7 +188,7 @@ def __init__(self, config_path):
self.token = check_for_attribute(config, "token", parent="radarr")
self.quality_profile_id = check_for_attribute(config, "quality_profile_id", parent="radarr", var_type="int")
self.root_folder_path = check_for_attribute(config, "root_folder_path", parent="radarr")
self.add_to_radarr = check_for_attribute(config, "add_to_radarr", parent="radarr", var_type="bool", default_is_none=True, do_print=False)
self.add_movie = check_for_attribute(config, "add_movie", parent="radarr", var_type="bool", default_is_none=True, do_print=False)
self.search_movie = check_for_attribute(config, "search_movie", parent="radarr", var_type="bool", default=False, do_print=False)
elif Radarr.valid is None:
if TMDB.valid:
Expand Down Expand Up @@ -229,15 +216,9 @@ def __init__(self, config_path):
except SystemExit as e:
fatal_message = fatal_message + "\n" + str(e) if len(fatal_message) > 0 else str(e)
try:
self.add_to_radarr = check_for_attribute(config, "add_to_radarr", parent="radarr", options="| \ttrue (Add missing movies to Radarr)\n| \tfalse (Do not add missing movies to Radarr)", var_type="bool", default_is_none=True, throw=True)
self.add_movie = check_for_attribute(config, "add_movie", parent="radarr", options="| \ttrue (Add missing movies to Radarr)\n| \tfalse (Do not add missing movies to Radarr)", var_type="bool", default_is_none=True, throw=True)
except SystemExit as e:
message = message + "\n" + str(e) if len(message) > 0 else str(e)
if "add_movie" in config:
try:
self.add_to_radarr = check_for_attribute(config, "add_movie", parent="radarr", var_type="bool", throw=True, save=False)
print("| Config Warning: replace add_movie with add_to_radarr")
except SystemExit as e:
pass
try:
self.search_movie = check_for_attribute(config, "search_movie", parent="radarr", options="| \ttrue (Have Radarr seach the added movies)\n| \tfalse (Do not have Radarr seach the added movies)", var_type="bool", default=False, throw=True)
except SystemExit as e:
Expand Down Expand Up @@ -333,7 +314,7 @@ def __init__(self, config_path):
except:
print("| Config Error: Invalid url")
Tautulli.valid = False
print("| tautulli Connection {}".format("Successful" if Tautulli.valid else "failed"))
print("| tautulli connection {}".format("scuccessful" if Tautulli.valid else "failed"))


class TraktClient:
Expand Down Expand Up @@ -381,7 +362,7 @@ def __init__(self, config_path):
else:
self.refreshed_authorization = None
if trakt_helpers.check_trakt(self.refreshed_authorization):
# Save the refreshed authorization
# Save the refreshed authorization
trakt_helpers.save_authorization(Config(config_path).config_path, self.refreshed_authorization)
TraktClient.valid = True
else:
Expand Down
Loading

0 comments on commit 62b1c3e

Please sign in to comment.