Skip to content

Commit

Permalink
New Titles for JP series
Browse files Browse the repository at this point in the history
  • Loading branch information
TEALC82 committed Jul 12, 2024
1 parent 78095ba commit 35bf509
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
9 changes: 1 addition & 8 deletions stream_fusion/utils/jackett/jackett_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ def __search_movie_indexer(self, movie, indexer):
def __search_series_indexer(self, series, indexer):
season = str(int(series.season.replace('S', '')))
episode = str(int(series.episode.replace('E', '')))
origin = series.origin_country

has_imdb_search_capability = (os.getenv("DISABLE_JACKETT_IMDB_SEARCH") != "true"
and indexer.tv_search_capatabilities is not None
Expand All @@ -141,17 +140,11 @@ def __search_series_indexer(self, series, indexer):
results = []

for index, lang in enumerate(languages):
if origin == "JP":
parts = titles[index].split(':', 1)
mytitle = parts[0].strip()
else:
mytitle = titles[index]

params = {
'apikey': self.__api_key,
't': 'tvsearch',
'cat': '5000',
'q': mytitle,
'q': titles[index],
}

if has_imdb_search_capability:
Expand Down
18 changes: 15 additions & 3 deletions stream_fusion/utils/metdata/tmdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,31 @@ def get_metadata(self, id, type):
languages=self.config['languages']
)
else:
if data["tv_results"][0]["origin_country"] = "JP":
atitles = [self.replace_weird_characters(data["tv_results"][0]["name"])]
parts = atitles.split(':', 1)
update_titles = parts[0].strip()
else:
update_titles = [self.replace_weird_characters(data["tv_results"][0]["name"])]

result = Series(
id=id,
titles=[self.replace_weird_characters(data["tv_results"][0]["name"])],
titles=update_titles,
season="S{:02d}".format(int(full_id[1])),
episode="E{:02d}".format(int(full_id[2])),
origin_country=data["tv_results"][0]["origin_country"],
languages=self.config['languages']
)
else:
if type == "movie":
result.titles.append(self.replace_weird_characters(data["movie_results"][0]["title"]))
else:
result.titles.append(self.replace_weird_characters(data["tv_results"][0]["name"]))
if data["tv_results"][0]["origin_country"] = "JP":
atitles = [self.replace_weird_characters(data["tv_results"][0]["name"])]
parts = atitles.split(':', 1)
update_titles = parts[0].strip()
result.titles.append(self.replace_weird_characters(update_titles))
else:
result.titles.append(self.replace_weird_characters(data["tv_results"][0]["name"]))

self.logger.info("Got metadata for " + type + " with id " + id)
return result
3 changes: 1 addition & 2 deletions stream_fusion/utils/models/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@


class Series(Media):
def __init__(self, id, titles, season, episode, origin_country, languages):
def __init__(self, id, titles, season, episode, languages):
super().__init__(id, titles, languages, "series")
self.season = season
self.episode = episode
self.origin_country = origin_country
self.seasonfile = None

0 comments on commit 35bf509

Please sign in to comment.