cleanup and version

pull/351/head
meisnate12 3 years ago
parent 39dc94cca2
commit cff3025aac

@ -23,15 +23,15 @@ class AniDB:
if not self._login(self.username, self.password).xpath("//li[@class='sub-menu my']/@title"): if not self._login(self.username, self.password).xpath("//li[@class='sub-menu my']/@title"):
raise Failed("AniDB Error: Login failed") raise Failed("AniDB Error: Login failed")
def _request(self, url, language=None, postData=None): def _request(self, url, language=None, post=None):
if postData: if post:
return self.config.post_html(url, postData, headers=util.header(language)) return self.config.post_html(url, post, headers=util.header(language))
else: else:
return self.config.get_html(url, headers=util.header(language)) return self.config.get_html(url, headers=util.header(language))
def _login(self, username, password): def _login(self, username, password):
data = {"show": "main", "xuser": username, "xpass": password, "xdoautologin": "on"} data = {"show": "main", "xuser": username, "xpass": password, "xdoautologin": "on"}
return self._request(urls["login"], postData=data) return self._request(urls["login"], post=data)
def _popular(self, language): def _popular(self, language):
response = self._request(urls["popular"], language=language) response = self._request(urls["popular"], language=language)

@ -198,7 +198,7 @@ class AniList:
def validate_anilist_ids(self, anilist_ids, studio=False): def validate_anilist_ids(self, anilist_ids, studio=False):
anilist_id_list = util.get_int_list(anilist_ids, "AniList ID") anilist_id_list = util.get_int_list(anilist_ids, "AniList ID")
anilist_values = [] anilist_values = []
for anilist_id in anilist_ids: for anilist_id in anilist_id_list:
if studio: query = "query ($id: Int) {Studio(id: $id) {name}}" if studio: query = "query ($id: Int) {Studio(id: $id) {name}}"
else: query = "query ($id: Int) {Media(id: $id) {id}}" else: query = "query ($id: Int) {Media(id: $id) {id}}"
try: try:

@ -170,34 +170,34 @@ class Config:
self.session = requests.Session() self.session = requests.Session()
self.general = {} self.general = {
self.general["cache"] = check_for_attribute(self.data, "cache", parent="settings", var_type="bool", default=True) "cache": check_for_attribute(self.data, "cache", parent="settings", var_type="bool", default=True),
self.general["cache_expiration"] = check_for_attribute(self.data, "cache_expiration", parent="settings", var_type="int", default=60) "cache_expiration": check_for_attribute(self.data, "cache_expiration", parent="settings", var_type="int", default=60),
"asset_directory": check_for_attribute(self.data, "asset_directory", parent="settings", var_type="list_path", default=[os.path.join(default_dir, "assets")]),
"asset_folders": check_for_attribute(self.data, "asset_folders", parent="settings", var_type="bool", default=True),
"assets_for_all": check_for_attribute(self.data, "assets_for_all", parent="settings", var_type="bool", default=False),
"sync_mode": check_for_attribute(self.data, "sync_mode", parent="settings", default="append", test_list=sync_modes),
"run_again_delay": check_for_attribute(self.data, "run_again_delay", parent="settings", var_type="int", default=0),
"show_unmanaged": check_for_attribute(self.data, "show_unmanaged", parent="settings", var_type="bool", default=True),
"show_filtered": check_for_attribute(self.data, "show_filtered", parent="settings", var_type="bool", default=False),
"show_missing": check_for_attribute(self.data, "show_missing", parent="settings", var_type="bool", default=True),
"save_missing": check_for_attribute(self.data, "save_missing", parent="settings", var_type="bool", default=True)
}
if self.general["cache"]: if self.general["cache"]:
util.separator() util.separator()
self.Cache = Cache(self.config_path, self.general["cache_expiration"]) self.Cache = Cache(self.config_path, self.general["cache_expiration"])
else: else:
self.Cache = None self.Cache = None
self.general["asset_directory"] = check_for_attribute(self.data, "asset_directory", parent="settings", var_type="list_path", default=[os.path.join(default_dir, "assets")])
self.general["asset_folders"] = check_for_attribute(self.data, "asset_folders", parent="settings", var_type="bool", default=True)
self.general["assets_for_all"] = check_for_attribute(self.data, "assets_for_all", parent="settings", var_type="bool", default=False)
self.general["sync_mode"] = check_for_attribute(self.data, "sync_mode", parent="settings", default="append", test_list=sync_modes)
self.general["run_again_delay"] = check_for_attribute(self.data, "run_again_delay", parent="settings", var_type="int", default=0)
self.general["show_unmanaged"] = check_for_attribute(self.data, "show_unmanaged", parent="settings", var_type="bool", default=True)
self.general["show_filtered"] = check_for_attribute(self.data, "show_filtered", parent="settings", var_type="bool", default=False)
self.general["show_missing"] = check_for_attribute(self.data, "show_missing", parent="settings", var_type="bool", default=True)
self.general["save_missing"] = check_for_attribute(self.data, "save_missing", parent="settings", var_type="bool", default=True)
util.separator() util.separator()
self.TMDb = None self.TMDb = None
if "tmdb" in self.data: if "tmdb" in self.data:
logger.info("Connecting to TMDb...") logger.info("Connecting to TMDb...")
self.tmdb = {} self.TMDb = TMDb(self, {
try: self.tmdb["apikey"] = check_for_attribute(self.data, "apikey", parent="tmdb", throw=True) "apikey": check_for_attribute(self.data, "apikey", parent="tmdb", throw=True),
except Failed as e: raise Failed(e) "language": check_for_attribute(self.data, "language", parent="tmdb", default="en")
self.tmdb["language"] = check_for_attribute(self.data, "language", parent="tmdb", default="en") })
self.TMDb = TMDb(self, self.tmdb)
logger.info(f"TMDb Connection {'Failed' if self.TMDb is None else 'Successful'}") logger.info(f"TMDb Connection {'Failed' if self.TMDb is None else 'Successful'}")
else: else:
raise Failed("Config Error: tmdb attribute not found") raise Failed("Config Error: tmdb attribute not found")
@ -207,10 +207,8 @@ class Config:
self.OMDb = None self.OMDb = None
if "omdb" in self.data: if "omdb" in self.data:
logger.info("Connecting to OMDb...") logger.info("Connecting to OMDb...")
self.omdb = {}
try: try:
self.omdb["apikey"] = check_for_attribute(self.data, "apikey", parent="omdb", throw=True) self.OMDb = OMDb(self, {"apikey": check_for_attribute(self.data, "apikey", parent="omdb", throw=True)})
self.OMDb = OMDb(self, self.omdb)
except Failed as e: except Failed as e:
logger.error(e) logger.error(e)
logger.info(f"OMDb Connection {'Failed' if self.OMDb is None else 'Successful'}") logger.info(f"OMDb Connection {'Failed' if self.OMDb is None else 'Successful'}")
@ -222,13 +220,13 @@ class Config:
self.Trakt = None self.Trakt = None
if "trakt" in self.data: if "trakt" in self.data:
logger.info("Connecting to Trakt...") logger.info("Connecting to Trakt...")
self.trakt = {}
try: try:
self.trakt["client_id"] = check_for_attribute(self.data, "client_id", parent="trakt", throw=True) self.Trakt = Trakt(self, {
self.trakt["client_secret"] = check_for_attribute(self.data, "client_secret", parent="trakt", throw=True) "client_id": check_for_attribute(self.data, "client_id", parent="trakt", throw=True),
self.trakt["config_path"] = self.config_path "client_secret": check_for_attribute(self.data, "client_secret", parent="trakt", throw=True),
authorization = self.data["trakt"]["authorization"] if "authorization" in self.data["trakt"] and self.data["trakt"]["authorization"] else None "config_path": self.config_path,
self.Trakt = Trakt(self, self.trakt, authorization) "authorization": self.data["trakt"]["authorization"] if "authorization" in self.data["trakt"] else None
})
except Failed as e: except Failed as e:
logger.error(e) logger.error(e)
logger.info(f"Trakt Connection {'Failed' if self.Trakt is None else 'Successful'}") logger.info(f"Trakt Connection {'Failed' if self.Trakt is None else 'Successful'}")
@ -240,13 +238,13 @@ class Config:
self.MyAnimeList = None self.MyAnimeList = None
if "mal" in self.data: if "mal" in self.data:
logger.info("Connecting to My Anime List...") logger.info("Connecting to My Anime List...")
self.mal = {}
try: try:
self.mal["client_id"] = check_for_attribute(self.data, "client_id", parent="mal", throw=True) self.MyAnimeList = MyAnimeList(self, {
self.mal["client_secret"] = check_for_attribute(self.data, "client_secret", parent="mal", throw=True) "client_id": check_for_attribute(self.data, "client_id", parent="mal", throw=True),
self.mal["config_path"] = self.config_path "client_secret": check_for_attribute(self.data, "client_secret", parent="mal", throw=True),
authorization = self.data["mal"]["authorization"] if "authorization" in self.data["mal"] and self.data["mal"]["authorization"] else None "config_path": self.config_path,
self.MyAnimeList = MyAnimeList(self, self.mal, authorization) "authorization": self.data["mal"]["authorization"] if "authorization" in self.data["mal"] else None
})
except Failed as e: except Failed as e:
logger.error(e) logger.error(e)
logger.info(f"My Anime List Connection {'Failed' if self.MyAnimeList is None else 'Successful'}") logger.info(f"My Anime List Connection {'Failed' if self.MyAnimeList is None else 'Successful'}")
@ -259,11 +257,11 @@ class Config:
if "anidb" in self.data: if "anidb" in self.data:
util.separator() util.separator()
logger.info("Connecting to AniDB...") logger.info("Connecting to AniDB...")
self.anidb = {}
try: try:
self.anidb["username"] = check_for_attribute(self.data, "username", parent="anidb", throw=True) self.AniDB = AniDB(self, {
self.anidb["password"] = check_for_attribute(self.data, "password", parent="anidb", throw=True) "username": check_for_attribute(self.data, "username", parent="anidb", throw=True),
self.AniDB = AniDB(self, self.anidb) "password": check_for_attribute(self.data, "password", parent="anidb", throw=True)
})
except Failed as e: except Failed as e:
logger.error(e) logger.error(e)
logger.info(f"My Anime List Connection {'Failed Continuing as Guest ' if self.MyAnimeList is None else 'Successful'}") logger.info(f"My Anime List Connection {'Failed Continuing as Guest ' if self.MyAnimeList is None else 'Successful'}")
@ -281,42 +279,43 @@ class Config:
logger.info("Connecting to Plex Libraries...") logger.info("Connecting to Plex Libraries...")
self.general["plex"] = {} self.general["plex"] = {
self.general["plex"]["url"] = check_for_attribute(self.data, "url", parent="plex", var_type="url", default_is_none=True) "url": check_for_attribute(self.data, "url", parent="plex", var_type="url", default_is_none=True),
self.general["plex"]["token"] = check_for_attribute(self.data, "token", parent="plex", default_is_none=True) "token": check_for_attribute(self.data, "token", parent="plex", default_is_none=True),
self.general["plex"]["timeout"] = check_for_attribute(self.data, "timeout", parent="plex", var_type="int", default=60) "timeout": check_for_attribute(self.data, "timeout", parent="plex", var_type="int", default=60),
self.general["plex"]["clean_bundles"] = check_for_attribute(self.data, "clean_bundles", parent="plex", var_type="bool", default=False) "clean_bundles": check_for_attribute(self.data, "clean_bundles", parent="plex", var_type="bool", default=False),
self.general["plex"]["empty_trash"] = check_for_attribute(self.data, "empty_trash", parent="plex", var_type="bool", default=False) "empty_trash": check_for_attribute(self.data, "empty_trash", parent="plex", var_type="bool", default=False),
self.general["plex"]["optimize"] = check_for_attribute(self.data, "optimize", parent="plex", var_type="bool", default=False) "optimize": check_for_attribute(self.data, "optimize", parent="plex", var_type="bool", default=False)
}
self.general["radarr"] = {} self.general["radarr"] = {
self.general["radarr"]["url"] = check_for_attribute(self.data, "url", parent="radarr", var_type="url", default_is_none=True) "url": check_for_attribute(self.data, "url", parent="radarr", var_type="url", default_is_none=True),
self.general["radarr"]["token"] = check_for_attribute(self.data, "token", parent="radarr", default_is_none=True) "token": check_for_attribute(self.data, "token", parent="radarr", default_is_none=True),
self.general["radarr"]["add"] = check_for_attribute(self.data, "add", parent="radarr", var_type="bool", default=False) "add": check_for_attribute(self.data, "add", parent="radarr", var_type="bool", default=False),
self.general["radarr"]["root_folder_path"] = check_for_attribute(self.data, "root_folder_path", parent="radarr", default_is_none=True) "root_folder_path": check_for_attribute(self.data, "root_folder_path", parent="radarr", default_is_none=True),
self.general["radarr"]["monitor"] = check_for_attribute(self.data, "monitor", parent="radarr", var_type="bool", default=True) "monitor": check_for_attribute(self.data, "monitor", parent="radarr", var_type="bool", default=True),
self.general["radarr"]["availability"] = check_for_attribute(self.data, "availability", parent="radarr", test_list=radarr.availability_descriptions, default="announced") "availability": check_for_attribute(self.data, "availability", parent="radarr", test_list=radarr.availability_descriptions, default="announced"),
self.general["radarr"]["quality_profile"] = check_for_attribute(self.data, "quality_profile", parent="radarr", default_is_none=True) "quality_profile": check_for_attribute(self.data, "quality_profile", parent="radarr", default_is_none=True),
self.general["radarr"]["tag"] = check_for_attribute(self.data, "tag", parent="radarr", var_type="lower_list", default_is_none=True) "tag": check_for_attribute(self.data, "tag", parent="radarr", var_type="lower_list", default_is_none=True),
self.general["radarr"]["search"] = check_for_attribute(self.data, "search", parent="radarr", var_type="bool", default=False) "search": check_for_attribute(self.data, "search", parent="radarr", var_type="bool", default=False)
}
self.general["sonarr"] = {} self.general["sonarr"] = {
self.general["sonarr"]["url"] = check_for_attribute(self.data, "url", parent="sonarr", var_type="url", default_is_none=True) "url": check_for_attribute(self.data, "url", parent="sonarr", var_type="url", default_is_none=True),
self.general["sonarr"]["token"] = check_for_attribute(self.data, "token", parent="sonarr", default_is_none=True) "token": check_for_attribute(self.data, "token", parent="sonarr", default_is_none=True),
self.general["sonarr"]["add"] = check_for_attribute(self.data, "add", parent="sonarr", var_type="bool", default=False) "add": check_for_attribute(self.data, "add", parent="sonarr", var_type="bool", default=False),
self.general["sonarr"]["root_folder_path"] = check_for_attribute(self.data, "root_folder_path", parent="sonarr", default_is_none=True) "root_folder_path": check_for_attribute(self.data, "root_folder_path", parent="sonarr", default_is_none=True),
self.general["sonarr"]["monitor"] = check_for_attribute(self.data, "monitor", parent="sonarr", test_list=sonarr.monitor_descriptions, default="all") "monitor": check_for_attribute(self.data, "monitor", parent="sonarr", test_list=sonarr.monitor_descriptions, default="all"),
self.general["sonarr"]["quality_profile"] = check_for_attribute(self.data, "quality_profile", parent="sonarr", default_is_none=True) "quality_profile": check_for_attribute(self.data, "quality_profile", parent="sonarr", default_is_none=True),
self.general["sonarr"]["language_profile"] = check_for_attribute(self.data, "language_profile", parent="sonarr", default_is_none=True) "language_profile": check_for_attribute(self.data, "language_profile", parent="sonarr", default_is_none=True),
self.general["sonarr"]["series_type"] = check_for_attribute(self.data, "series_type", parent="sonarr", test_list=sonarr.series_type_descriptions, default="standard") "series_type": check_for_attribute(self.data, "series_type", parent="sonarr", test_list=sonarr.series_type_descriptions, default="standard"),
self.general["sonarr"]["season_folder"] = check_for_attribute(self.data, "season_folder", parent="sonarr", var_type="bool", default=True) "season_folder": check_for_attribute(self.data, "season_folder", parent="sonarr", var_type="bool", default=True),
self.general["sonarr"]["tag"] = check_for_attribute(self.data, "tag", parent="sonarr", var_type="lower_list", default_is_none=True) "tag": check_for_attribute(self.data, "tag", parent="sonarr", var_type="lower_list", default_is_none=True),
self.general["sonarr"]["search"] = check_for_attribute(self.data, "search", parent="sonarr", var_type="bool", default=False) "search": check_for_attribute(self.data, "search", parent="sonarr", var_type="bool", default=False),
self.general["sonarr"]["cutoff_search"] = check_for_attribute(self.data, "cutoff_search", parent="sonarr", var_type="bool", default=False) "cutoff_search": check_for_attribute(self.data, "cutoff_search", parent="sonarr", var_type="bool", default=False)
}
self.general["tautulli"] = {} self.general["tautulli"] = {
self.general["tautulli"]["url"] = check_for_attribute(self.data, "url", parent="tautulli", var_type="url", default_is_none=True) "url": check_for_attribute(self.data, "url", parent="tautulli", var_type="url", default_is_none=True),
self.general["tautulli"]["apikey"] = check_for_attribute(self.data, "apikey", parent="tautulli", default_is_none=True) "apikey": check_for_attribute(self.data, "apikey", parent="tautulli", default_is_none=True)
}
self.libraries = [] self.libraries = []
libs = check_for_attribute(self.data, "libraries", throw=True) libs = check_for_attribute(self.data, "libraries", throw=True)
@ -444,13 +443,14 @@ class Config:
else: else:
params["metadata_path"] = [("File", os.path.join(default_dir, f"{library_name}.yml"))] params["metadata_path"] = [("File", os.path.join(default_dir, f"{library_name}.yml"))]
params["default_dir"] = default_dir params["default_dir"] = default_dir
params["plex"] = {} params["plex"] = {
params["plex"]["url"] = check_for_attribute(lib, "url", parent="plex", var_type="url", default=self.general["plex"]["url"], req_default=True, save=False) "url": check_for_attribute(lib, "url", parent="plex", var_type="url", default=self.general["plex"]["url"], req_default=True, save=False),
params["plex"]["token"] = check_for_attribute(lib, "token", parent="plex", default=self.general["plex"]["token"], req_default=True, save=False) "token": check_for_attribute(lib, "token", parent="plex", default=self.general["plex"]["token"], req_default=True, save=False),
params["plex"]["timeout"] = check_for_attribute(lib, "timeout", parent="plex", var_type="int", default=self.general["plex"]["timeout"], save=False) "timeout": check_for_attribute(lib, "timeout", parent="plex", var_type="int", default=self.general["plex"]["timeout"], save=False),
params["plex"]["clean_bundles"] = check_for_attribute(lib, "clean_bundles", parent="plex", var_type="bool", default=self.general["plex"]["clean_bundles"], save=False) "clean_bundles": check_for_attribute(lib, "clean_bundles", parent="plex", var_type="bool", default=self.general["plex"]["clean_bundles"], save=False),
params["plex"]["empty_trash"] = check_for_attribute(lib, "empty_trash", parent="plex", var_type="bool", default=self.general["plex"]["empty_trash"], save=False) "empty_trash": check_for_attribute(lib, "empty_trash", parent="plex", var_type="bool", default=self.general["plex"]["empty_trash"], save=False),
params["plex"]["optimize"] = check_for_attribute(lib, "optimize", parent="plex", var_type="bool", default=self.general["plex"]["optimize"], save=False) "optimize": check_for_attribute(lib, "optimize", parent="plex", var_type="bool", default=self.general["plex"]["optimize"], save=False)
}
library = Plex(self, params) library = Plex(self, params)
logger.info("") logger.info("")
logger.info(f"{display_name} Library Connection Successful") logger.info(f"{display_name} Library Connection Successful")
@ -466,18 +466,18 @@ class Config:
logger.info("") logger.info("")
logger.info(f"Connecting to {display_name} library's Radarr...") logger.info(f"Connecting to {display_name} library's Radarr...")
logger.info("") logger.info("")
radarr_params = {}
try: try:
radarr_params["url"] = check_for_attribute(lib, "url", parent="radarr", var_type="url", default=self.general["radarr"]["url"], req_default=True, save=False) library.Radarr = Radarr(self, {
radarr_params["token"] = check_for_attribute(lib, "token", parent="radarr", default=self.general["radarr"]["token"], req_default=True, save=False) "url": check_for_attribute(lib, "url", parent="radarr", var_type="url", default=self.general["radarr"]["url"], req_default=True, save=False),
radarr_params["add"] = check_for_attribute(lib, "add", parent="radarr", var_type="bool", default=self.general["radarr"]["add"], save=False) "token": check_for_attribute(lib, "token", parent="radarr", default=self.general["radarr"]["token"], req_default=True, save=False),
radarr_params["root_folder_path"] = check_for_attribute(lib, "root_folder_path", parent="radarr", default=self.general["radarr"]["root_folder_path"], req_default=True, save=False) "add": check_for_attribute(lib, "add", parent="radarr", var_type="bool", default=self.general["radarr"]["add"], save=False),
radarr_params["monitor"] = check_for_attribute(lib, "monitor", parent="radarr", var_type="bool", default=self.general["radarr"]["monitor"], save=False) "root_folder_path": check_for_attribute(lib, "root_folder_path", parent="radarr", default=self.general["radarr"]["root_folder_path"], req_default=True, save=False),
radarr_params["availability"] = check_for_attribute(lib, "availability", parent="radarr", test_list=radarr.availability_descriptions, default=self.general["radarr"]["availability"], save=False) "monitor": check_for_attribute(lib, "monitor", parent="radarr", var_type="bool", default=self.general["radarr"]["monitor"], save=False),
radarr_params["quality_profile"] = check_for_attribute(lib, "quality_profile", parent="radarr", default=self.general["radarr"]["quality_profile"], req_default=True, save=False) "availability": check_for_attribute(lib, "availability", parent="radarr", test_list=radarr.availability_descriptions, default=self.general["radarr"]["availability"], save=False),
radarr_params["tag"] = check_for_attribute(lib, "tag", parent="radarr", var_type="lower_list", default=self.general["radarr"]["tag"], default_is_none=True, save=False) "quality_profile": check_for_attribute(lib, "quality_profile", parent="radarr",default=self.general["radarr"]["quality_profile"], req_default=True, save=False),
radarr_params["search"] = check_for_attribute(lib, "search", parent="radarr", var_type="bool", default=self.general["radarr"]["search"], save=False) "tag": check_for_attribute(lib, "tag", parent="radarr", var_type="lower_list", default=self.general["radarr"]["tag"], default_is_none=True, save=False),
library.Radarr = Radarr(self, radarr_params) "search": check_for_attribute(lib, "search", parent="radarr", var_type="bool", default=self.general["radarr"]["search"], save=False)
})
except Failed as e: except Failed as e:
util.print_stacktrace() util.print_stacktrace()
util.print_multiline(e, error=True) util.print_multiline(e, error=True)
@ -490,24 +490,21 @@ class Config:
logger.info("") logger.info("")
logger.info(f"Connecting to {display_name} library's Sonarr...") logger.info(f"Connecting to {display_name} library's Sonarr...")
logger.info("") logger.info("")
sonarr_params = {}
try: try:
sonarr_params["url"] = check_for_attribute(lib, "url", parent="sonarr", var_type="url", default=self.general["sonarr"]["url"], req_default=True, save=False) library.Sonarr = Sonarr(self, {
sonarr_params["token"] = check_for_attribute(lib, "token", parent="sonarr", default=self.general["sonarr"]["token"], req_default=True, save=False) "url": check_for_attribute(lib, "url", parent="sonarr", var_type="url", default=self.general["sonarr"]["url"], req_default=True, save=False),
sonarr_params["add"] = check_for_attribute(lib, "add", parent="sonarr", var_type="bool", default=self.general["sonarr"]["add"], save=False) "token": check_for_attribute(lib, "token", parent="sonarr", default=self.general["sonarr"]["token"], req_default=True, save=False),
sonarr_params["root_folder_path"] = check_for_attribute(lib, "root_folder_path", parent="sonarr", default=self.general["sonarr"]["root_folder_path"], req_default=True, save=False) "add": check_for_attribute(lib, "add", parent="sonarr", var_type="bool", default=self.general["sonarr"]["add"], save=False),
sonarr_params["monitor"] = check_for_attribute(lib, "monitor", parent="sonarr", test_list=sonarr.monitor_descriptions, default=self.general["sonarr"]["monitor"], save=False) "root_folder_path": check_for_attribute(lib, "root_folder_path", parent="sonarr", default=self.general["sonarr"]["root_folder_path"], req_default=True, save=False),
sonarr_params["quality_profile"] = check_for_attribute(lib, "quality_profile", parent="sonarr", default=self.general["sonarr"]["quality_profile"], req_default=True, save=False) "monitor": check_for_attribute(lib, "monitor", parent="sonarr", test_list=sonarr.monitor_descriptions, default=self.general["sonarr"]["monitor"], save=False),
if self.general["sonarr"]["language_profile"]: "quality_profile": check_for_attribute(lib, "quality_profile", parent="sonarr", default=self.general["sonarr"]["quality_profile"], req_default=True, save=False),
sonarr_params["language_profile"] = check_for_attribute(lib, "language_profile", parent="sonarr", default=self.general["sonarr"]["language_profile"], save=False) "language_profile": check_for_attribute(lib, "language_profile", parent="sonarr", default=self.general["sonarr"]["language_profile"], save=False) if self.general["sonarr"]["language_profile"] else check_for_attribute(lib, "language_profile", parent="sonarr", default_is_none=True, save=False),
else: "series_type": check_for_attribute(lib, "series_type", parent="sonarr", test_list=sonarr.series_type_descriptions, default=self.general["sonarr"]["series_type"], save=False),
sonarr_params["language_profile"] = check_for_attribute(lib, "language_profile", parent="sonarr", default_is_none=True, save=False) "season_folder": check_for_attribute(lib, "season_folder", parent="sonarr", var_type="bool", default=self.general["sonarr"]["season_folder"], save=False),
sonarr_params["series_type"] = check_for_attribute(lib, "series_type", parent="sonarr", test_list=sonarr.series_type_descriptions, default=self.general["sonarr"]["series_type"], save=False) "tag": check_for_attribute(lib, "tag", parent="sonarr", var_type="lower_list", default=self.general["sonarr"]["tag"], default_is_none=True, save=False),
sonarr_params["season_folder"] = check_for_attribute(lib, "season_folder", parent="sonarr", var_type="bool", default=self.general["sonarr"]["season_folder"], save=False) "search": check_for_attribute(lib, "search", parent="sonarr", var_type="bool", default=self.general["sonarr"]["search"], save=False),
sonarr_params["tag"] = check_for_attribute(lib, "tag", parent="sonarr", var_type="lower_list", default=self.general["sonarr"]["tag"], default_is_none=True, save=False) "cutoff_search": check_for_attribute(lib, "cutoff_search", parent="sonarr", var_type="bool", default=self.general["sonarr"]["cutoff_search"], save=False)
sonarr_params["search"] = check_for_attribute(lib, "search", parent="sonarr", var_type="bool", default=self.general["sonarr"]["search"], save=False) })
sonarr_params["cutoff_search"] = check_for_attribute(lib, "cutoff_search", parent="sonarr", var_type="bool", default=self.general["sonarr"]["cutoff_search"], save=False)
library.Sonarr = Sonarr(self, sonarr_params)
except Failed as e: except Failed as e:
util.print_stacktrace() util.print_stacktrace()
util.print_multiline(e, error=True) util.print_multiline(e, error=True)
@ -520,11 +517,11 @@ class Config:
logger.info("") logger.info("")
logger.info(f"Connecting to {display_name} library's Tautulli...") logger.info(f"Connecting to {display_name} library's Tautulli...")
logger.info("") logger.info("")
tautulli_params = {}
try: try:
tautulli_params["url"] = check_for_attribute(lib, "url", parent="tautulli", var_type="url", default=self.general["tautulli"]["url"], req_default=True, save=False) library.Tautulli = Tautulli(self, {
tautulli_params["apikey"] = check_for_attribute(lib, "apikey", parent="tautulli", default=self.general["tautulli"]["apikey"], req_default=True, save=False) "url": check_for_attribute(lib, "url", parent="tautulli", var_type="url", default=self.general["tautulli"]["url"], req_default=True, save=False),
library.Tautulli = Tautulli(self, tautulli_params) "apikey": check_for_attribute(lib, "apikey", parent="tautulli", default=self.general["tautulli"]["apikey"], req_default=True, save=False)
})
except Failed as e: except Failed as e:
util.print_stacktrace() util.print_stacktrace()
util.print_multiline(e, error=True) util.print_multiline(e, error=True)

@ -39,12 +39,12 @@ urls = {
} }
class MyAnimeList: class MyAnimeList:
def __init__(self, config, params, authorization=None): def __init__(self, config, params):
self.config = config self.config = config
self.client_id = params["client_id"] self.client_id = params["client_id"]
self.client_secret = params["client_secret"] self.client_secret = params["client_secret"]
self.config_path = params["config_path"] self.config_path = params["config_path"]
self.authorization = authorization self.authorization = params["authorization"]
if not self._save(self.authorization): if not self._save(self.authorization):
if not self._refresh(): if not self._refresh():
self._authorization() self._authorization()

@ -14,12 +14,12 @@ builders = [
] ]
class Trakt: class Trakt:
def __init__(self, config, params, authorization=None): def __init__(self, config, params):
self.config = config self.config = config
self.client_id = params["client_id"] self.client_id = params["client_id"]
self.client_secret = params["client_secret"] self.client_secret = params["client_secret"]
self.config_path = params["config_path"] self.config_path = params["config_path"]
self.authorization = authorization self.authorization = params["authorization"]
if not self._save(self.authorization): if not self._save(self.authorization):
if not self._refresh(): if not self._refresh():
self._authorization() self._authorization()

@ -105,7 +105,7 @@ def start(config_path, is_test=False, time_scheduled=None, requested_collections
logger.info(util.centered("| __/| | __/> < | | | | __/ || (_| | | | | | (_| | | | | (_| | (_| | __/ | ")) logger.info(util.centered("| __/| | __/> < | | | | __/ || (_| | | | | | (_| | | | | (_| | (_| | __/ | "))
logger.info(util.centered("|_| |_|\\___/_/\\_\\ |_| |_|\\___|\\__\\__,_| |_| |_|\\__,_|_| |_|\\__,_|\\__, |\\___|_| ")) logger.info(util.centered("|_| |_|\\___/_/\\_\\ |_| |_|\\___|\\__\\__,_| |_| |_|\\__,_|_| |_|\\__,_|\\__, |\\___|_| "))
logger.info(util.centered(" |___/ ")) logger.info(util.centered(" |___/ "))
logger.info(util.centered(" Version: 1.11.3-beta1 ")) logger.info(util.centered(" Version: 1.11.3-beta2 "))
if time_scheduled: start_type = f"{time_scheduled} " if time_scheduled: start_type = f"{time_scheduled} "
elif is_test: start_type = "Test " elif is_test: start_type = "Test "
elif requested_collections: start_type = "Collections " elif requested_collections: start_type = "Collections "

Loading…
Cancel
Save