mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-26 06:20:23 +00:00
[29] #954 Fix anidb_popular
This commit is contained in:
parent
c52c2a5de6
commit
b6373d900d
5 changed files with 10 additions and 9 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.17.1-develop28
|
||||
1.17.1-develop29
|
||||
|
|
|
@ -82,7 +82,7 @@ class AniDB:
|
|||
|
||||
def _popular(self):
|
||||
response = self._request(urls["popular"])
|
||||
return util.get_int_list(response.xpath("//td[@class='name anime']/a/@href"), "AniDB ID")
|
||||
return util.get_int_list(response.xpath("//td[@class='thumb anime']/a/@href"), "AniDB ID")
|
||||
|
||||
def _relations(self, anidb_id):
|
||||
response = self._request(f"{urls['anime']}/{anidb_id}{urls['relation']}")
|
||||
|
|
|
@ -504,6 +504,7 @@ class CollectionBuilder:
|
|||
try:
|
||||
results = self.config.TMDb.search_people(tmdb_person)
|
||||
if results:
|
||||
valid_names.append(tmdb_person)
|
||||
valid_names.append(results[0].name)
|
||||
if results[0].biography:
|
||||
self.summaries["tmdb_person"] = results[0].biography
|
||||
|
|
|
@ -199,7 +199,7 @@ class ConfigFile:
|
|||
if "trakt" in self.data: self.data["trakt"] = self.data.pop("trakt")
|
||||
if "mal" in self.data: self.data["mal"] = self.data.pop("mal")
|
||||
|
||||
def check_for_attribute(data, attribute, parent=None, test_list=None, default=None, do_print=True, default_is_none=False, req_default=False, var_type="str", throw=False, save=True):
|
||||
def check_for_attribute(data, attribute, parent=None, test_list=None, default=None, do_print=True, default_is_none=False, req_default=False, var_type="str", throw=False, save=True, int_min=0):
|
||||
endline = ""
|
||||
if parent is not None:
|
||||
if data and parent in data:
|
||||
|
@ -232,7 +232,7 @@ class ConfigFile:
|
|||
if isinstance(data[attribute], bool): return data[attribute]
|
||||
else: message = f"{text} must be either true or false"
|
||||
elif var_type == "int":
|
||||
if isinstance(data[attribute], int) and data[attribute] >= 0: return data[attribute]
|
||||
if isinstance(data[attribute], int) and data[attribute] >= int_min: return data[attribute]
|
||||
else: message = f"{text} must an integer >= 0"
|
||||
elif var_type == "path":
|
||||
if os.path.exists(os.path.abspath(data[attribute])): return data[attribute]
|
||||
|
@ -288,7 +288,7 @@ class ConfigFile:
|
|||
|
||||
self.general = {
|
||||
"cache": check_for_attribute(self.data, "cache", parent="settings", var_type="bool", default=True),
|
||||
"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, int_min=1),
|
||||
"asset_directory": check_for_attribute(self.data, "asset_directory", parent="settings", var_type="list_path", default_is_none=True),
|
||||
"asset_folders": check_for_attribute(self.data, "asset_folders", parent="settings", var_type="bool", default=True),
|
||||
"asset_depth": check_for_attribute(self.data, "asset_depth", parent="settings", var_type="int", default=0),
|
||||
|
@ -391,7 +391,7 @@ class ConfigFile:
|
|||
self.TMDb = TMDb(self, {
|
||||
"apikey": check_for_attribute(self.data, "apikey", parent="tmdb", throw=True),
|
||||
"language": check_for_attribute(self.data, "language", parent="tmdb", default="en"),
|
||||
"expiration": check_for_attribute(self.data, "cache_expiration", parent="tmdb", var_type="int", default=60)
|
||||
"expiration": check_for_attribute(self.data, "cache_expiration", parent="tmdb", var_type="int", default=60, int_min=1)
|
||||
})
|
||||
region = check_for_attribute(self.data, "region", parent="tmdb", test_list=self.TMDb.iso_3166_1, default_is_none=True)
|
||||
self.TMDb.region = str(region).upper() if region else region
|
||||
|
@ -407,7 +407,7 @@ class ConfigFile:
|
|||
try:
|
||||
self.OMDb = OMDb(self, {
|
||||
"apikey": check_for_attribute(self.data, "apikey", parent="omdb", throw=True),
|
||||
"expiration": check_for_attribute(self.data, "cache_expiration", parent="omdb", var_type="int", default=60)
|
||||
"expiration": check_for_attribute(self.data, "cache_expiration", parent="omdb", var_type="int", default=60, int_min=1)
|
||||
})
|
||||
except Failed as e:
|
||||
logger.error(e)
|
||||
|
@ -423,7 +423,7 @@ class ConfigFile:
|
|||
try:
|
||||
self.Mdblist.add_key(
|
||||
check_for_attribute(self.data, "apikey", parent="mdblist", throw=True),
|
||||
check_for_attribute(self.data, "cache_expiration", parent="mdblist", var_type="int", default=60)
|
||||
check_for_attribute(self.data, "cache_expiration", parent="mdblist", var_type="int", default=60, int_min=1)
|
||||
)
|
||||
logger.info("Mdblist Connection Successful")
|
||||
except Failed as e:
|
||||
|
|
|
@ -268,7 +268,7 @@ def logger_input(prompt, timeout=60):
|
|||
else: raise SystemError("Input Timeout not supported on this system")
|
||||
|
||||
def header(language="en-US,en;q=0.5"):
|
||||
return {"Accept-Language": "eng" if language == "default" else language, "User-Agent": "Mozilla/5.0"}
|
||||
return {"Accept-Language": "eng" if language == "default" else language, "User-Agent": "Mozilla/5.0 Firefox/102.0"}
|
||||
|
||||
def alarm_handler(signum, frame):
|
||||
raise TimeoutExpired
|
||||
|
|
Loading…
Reference in a new issue