Commit 1c3481ff authored by echel0n's avatar echel0n
Browse files

Fixed issues with mapped series provider id's to series id's

parent 99224190
......@@ -1738,7 +1738,8 @@ class CMD_Show(ApiCall):
showDict["skip_downloaded"] = (0, 1)[show_object.skip_downloaded]
showDict["series_id"] = show_object.series_id
showDict["tvdbid"] = map_series_providers(show_object.series_provider_id, show_object.series_id, show_object.name)[1]
showDict["series_provider_id"] = show_object.series_provider.name
showDict["tvdbid"] = map_series_providers(show_object.series_provider_id, show_object.series_id, show_object.name)[SeriesProviderID.THETVDB.name]
showDict["imdbid"] = show_object.imdb_id
showDict["network"] = show_object.network
......@@ -2564,8 +2565,6 @@ class CMD_Shows(ApiCall):
if self.paused is not None and bool(self.paused) != bool(curShow.paused):
continue
series_provider_show = map_series_providers(curShow.series_provider_id, curShow.series_id, curShow.name)
showDict = {
"paused": (0, 1)[curShow.paused],
"quality": Qualities(curShow.quality).display_name,
......@@ -2573,7 +2572,7 @@ class CMD_Shows(ApiCall):
"search_format": curShow.search_format,
"anime": (0, 1)[curShow.anime],
"series_id": curShow.series_id,
"series_provider_series_id": series_provider_show[1],
"series_provider_id": curShow.series_provider.name,
"network": curShow.network,
"show_name": curShow.name,
"status": curShow.status,
......
......@@ -743,7 +743,7 @@ class MetadataProvider(object):
sickrage.app.log.debug("Searching for any " + img_type + " images on Fanart.tv for " + show.name)
try:
series_id = map_series_providers(show.series_provider_id, show.series_id, show.name)[1]
series_id = map_series_providers(show.series_provider_id, show.series_id, show.name)[SeriesProviderID.THETVDB.name]
if series_id:
request = fanart.Request(
apikey=sickrage.app.fanart_api_key,
......
......@@ -31,6 +31,8 @@ def map_series_providers(series_provider_id, series_id, name):
session = sickrage.app.main_db.session()
mapped = {}
for series_provider_id in SeriesProviderID:
mapped[series_provider_id.name] = None
# init mapped series_provider_ids object
for mapped_series_provider_id in SeriesProviderID:
......@@ -57,8 +59,7 @@ def map_series_providers(series_provider_id, series_id, name):
continue
if mapped_show and len(mapped_show) == 1:
sickrage.app.log.debug(
"Mapping " + sickrage.app.series_providers[series_provider_id].name + "->" + mapped_series_provider + " for show: " + name)
sickrage.app.log.debug(f"Mapping {sickrage.app.series_providers[series_provider_id].name} -> {mapped_series_provider} for show: {name}")
mapped[mapped_series_provider_id.name] = int(mapped_show['id'])
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment