Skip to content

Commit

Permalink
Juste modif tmdb for JP contry
Browse files Browse the repository at this point in the history
  • Loading branch information
TEALC82 committed Jul 14, 2024
1 parent ed9e5a5 commit 771b494
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
13 changes: 2 additions & 11 deletions stream_fusion/utils/jackett/jackett_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ def __init__(self, config):
self.__session = requests.Session()

def search(self, media):
parts = media.titles[0].split(':')
newtitle = parts[0]

self.logger.info("Started Jackett search for " + media.type + " " + newtitle + " [" + media.titles[0] + "]")
self.logger.info("Started Jackett search for " + media.type + " " + media.titles[0])

indexers = self.__get_indexers()
threads = []
Expand Down Expand Up @@ -143,17 +140,11 @@ def __search_series_indexer(self, series, indexer):
results = []

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

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

if has_imdb_search_capability:
Expand Down
14 changes: 11 additions & 3 deletions stream_fusion/utils/metdata/tmdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,21 @@ def get_metadata(self, id, type):
languages=self.config['languages']
)
else:
origin = data["tv_results"][0]["origin_country"][0]
if origin == "JP":
title = self.replace_weird_characters(data["tv_results"][0]["name"]).split(":")
if len(title[0]) == 0:
titles = [self.replace_weird_characters(data["tv_results"][0]["name"])]
else:
titles = [title[0]]
else:
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=titles,
season="S{:02d}".format(int(full_id[1])),
episode="E{:02d}".format(int(full_id[2])),
origin=data["tv_results"][0]["origin_country"][0],
languages=self.config['languages']
)
else:
Expand All @@ -42,5 +51,4 @@ def get_metadata(self, id, type):
result.titles.append(self.replace_weird_characters(data["tv_results"][0]["name"]))

self.logger.info("Got metadata for " + type + " with id " + id)
self.logger.info(">> Origin : " + result.origin + " <<")
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, languages):
def __init__(self, id, titles, season, episode, languages):
super().__init__(id, titles, languages, "series")
self.season = season
self.episode = episode
self.origin = origin
self.seasonfile = None
5 changes: 4 additions & 1 deletion stream_fusion/utils/zilean/zilean_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ def __search_movie(self, movie):

def __search_series(self, series):
unique_titles = self.__remove_duplicate_titles(series.titles)
clean_titles = [self.__clean_title(title) for title in unique_titles]
if series.origin == "JP":
clean_titles = series.titlealt
else:
clean_titles = [self.__clean_title(title) for title in unique_titles]
search_texts = clean_titles.copy()

if hasattr(series, 'season') and hasattr(series, 'episode'):
Expand Down

0 comments on commit 771b494

Please sign in to comment.