[42] fix #1924 tmdb season naming issue

pull/1934/head
meisnate12 8 months ago
parent 9c06105b79
commit ce4c77c834

@ -1 +1 @@
1.20.0-develop41 1.20.0-develop42

@ -30,6 +30,7 @@ class Cache:
cursor.execute("DROP TABLE IF EXISTS omdb_data2") cursor.execute("DROP TABLE IF EXISTS omdb_data2")
cursor.execute("DROP TABLE IF EXISTS tvdb_data") cursor.execute("DROP TABLE IF EXISTS tvdb_data")
cursor.execute("DROP TABLE IF EXISTS tvdb_data2") cursor.execute("DROP TABLE IF EXISTS tvdb_data2")
cursor.execute("DROP TABLE IF EXISTS tmdb_show_data")
cursor.execute("DROP TABLE IF EXISTS overlay_ratings") cursor.execute("DROP TABLE IF EXISTS overlay_ratings")
cursor.execute("DROP TABLE IF EXISTS anidb_data") cursor.execute("DROP TABLE IF EXISTS anidb_data")
cursor.execute("DROP TABLE IF EXISTS anidb_data2") cursor.execute("DROP TABLE IF EXISTS anidb_data2")
@ -186,7 +187,7 @@ class Cache:
expiration_date TEXT)""" expiration_date TEXT)"""
) )
cursor.execute( cursor.execute(
"""CREATE TABLE IF NOT EXISTS tmdb_show_data ( """CREATE TABLE IF NOT EXISTS tmdb_show_data2 (
key INTEGER PRIMARY KEY, key INTEGER PRIMARY KEY,
tmdb_id INTEGER UNIQUE, tmdb_id INTEGER UNIQUE,
title TEXT, title TEXT,
@ -712,7 +713,7 @@ class Cache:
obj.vote_count, obj.vote_average, obj.language_iso, obj.language_name, "|".join(obj.genres), "|".join(obj.keywords), obj.vote_count, obj.vote_average, obj.language_iso, obj.language_name, "|".join(obj.genres), "|".join(obj.keywords),
obj.first_air_date.strftime("%Y-%m-%d") if obj.first_air_date else None, obj.first_air_date.strftime("%Y-%m-%d") if obj.first_air_date else None,
obj.last_air_date.strftime("%Y-%m-%d") if obj.last_air_date else None, obj.last_air_date.strftime("%Y-%m-%d") if obj.last_air_date else None,
obj.status, obj.type, obj.tvdb_id, "|".join([str(c) for c in obj.countries]), "|".join([str(s) for s in obj.seasons]), obj.status, obj.type, obj.tvdb_id, "|".join([str(c) for c in obj.countries]), "%|%".join([str(s) for s in obj.seasons]),
expiration_date.strftime("%Y-%m-%d"), obj.tmdb_id expiration_date.strftime("%Y-%m-%d"), obj.tmdb_id
)) ))

@ -79,11 +79,11 @@ class TMDbCountry:
class TMDbSeason: class TMDbSeason:
def __init__(self, data): def __init__(self, data):
self.season_number = data.split(":")[0] if isinstance(data, str) else data.season_number self.season_number = data.split("%:%")[0] if isinstance(data, str) else data.season_number
self.name = data.split(":")[1] if isinstance(data, str) else data.name self.name = data.split("%:%")[1] if isinstance(data, str) else data.name
def __repr__(self): def __repr__(self):
return f"{self.season_number}:{self.name}" return f"{self.season_number}%:%{self.name}"
class TMDBObj: class TMDBObj:
@ -158,7 +158,7 @@ class TMDbShow(TMDBObj):
self.tvdb_id = data["tvdb_id"] if isinstance(data, dict) else data.tvdb_id self.tvdb_id = data["tvdb_id"] if isinstance(data, dict) else data.tvdb_id
loop = data.origin_countries if not isinstance(data, dict) else data["countries"].split("|") if data["countries"] else [] # noqa loop = data.origin_countries if not isinstance(data, dict) else data["countries"].split("|") if data["countries"] else [] # noqa
self.countries = [TMDbCountry(c) for c in loop] self.countries = [TMDbCountry(c) for c in loop]
loop = data.seasons if not isinstance(data, dict) else data["seasons"].split("|") if data["seasons"] else [] # noqa loop = data.seasons if not isinstance(data, dict) else data["seasons"].split("%|%") if data["seasons"] else [] # noqa
self.seasons = [TMDbSeason(s) for s in loop] self.seasons = [TMDbSeason(s) for s in loop]
if self._tmdb.config.Cache and not ignore_cache: if self._tmdb.config.Cache and not ignore_cache:

Loading…
Cancel
Save