diff --git a/stream_fusion/utils/jackett/jackett_service.py b/stream_fusion/utils/jackett/jackett_service.py index d797009..13ddbc4 100644 --- a/stream_fusion/utils/jackett/jackett_service.py +++ b/stream_fusion/utils/jackett/jackett_service.py @@ -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 @@ -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: diff --git a/stream_fusion/utils/metdata/tmdb.py b/stream_fusion/utils/metdata/tmdb.py index baed559..0e92cfd 100644 --- a/stream_fusion/utils/metdata/tmdb.py +++ b/stream_fusion/utils/metdata/tmdb.py @@ -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 diff --git a/stream_fusion/utils/models/series.py b/stream_fusion/utils/models/series.py index 0b9744c..c348de1 100644 --- a/stream_fusion/utils/models/series.py +++ b/stream_fusion/utils/models/series.py @@ -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