diff --git a/Contents/Code/__init__.py b/Contents/Code/__init__.py index c7749cb..596ff57 100644 --- a/Contents/Code/__init__.py +++ b/Contents/Code/__init__.py @@ -54,13 +54,13 @@ def Search(self, results, media, lang, manual, movie): # http://127.0.0.1:8111/api/serie/search?query=Clannad&level=1&apikey=d422dfd2-bdc3-4219-b3bb-08b85aa65579 - prelimresults = HttpReq("api/serie/search?query=%s&level=%d&fuzzy=1" % (urllib.quote(name), 0)) + prelimresults = HttpReq("api/serie/search?query=%s&level=%d&fuzzy=%d" % (urllib.quote(name), 1, Prefs['Fuzzy'])) - for group in prelimresults['groups']: - for result in group['series']: - score = 100 if result['title'] == name else 85 # TODO: Improve this to respect synonyms./ - meta = MetadataSearchResult('%s' % result['id'], result['title'], result['year'], score, lang) - results.Append(meta) + for result in prelimresults: + #for result in group['series']: + score = 100 if result['name'] == name else 85 # TODO: Improve this to respect synonyms./ + meta = MetadataSearchResult('%s' % result['id'], result['name'], result['year'], score, lang) + results.Append(meta) # results.Sort('score', descending=True) @@ -71,11 +71,11 @@ def Update(self, metadata, media, lang, force, movie): # http://127.0.0.1:8111/api/ep/getbyfilename?apikey=d422dfd2-bdc3-4219-b3bb-08b85aa65579&filename=%5Bjoseole99%5D%20Clannad%20-%2001%20(1280x720%20Blu-ray%20H264)%20%5B8E128DF5%5D.mkv # episode_data = HttpReq("api/ep/getbyfilename?apikey=%s&filename=%s" % (GetApiKey(), urllib.quote(media.filename))) - series = HttpReq("api/serie?id=%s" % aid) + series = HttpReq("api/serie?id=%s&level=3" % aid) # build metadata on the TV show. metadata.summary = series['summary'] - metadata.title = series['title'] + metadata.title = series['name'] metadata.rating = float(series['rating']) tags = [] @@ -125,6 +125,11 @@ def Update(self, metadata, media, lang, force, movie): Log('Assumed tv rating to be: %s' % metadata.content_rating) + for t in series['titles']: + if (t['type'] == 'official' and t['language'] == 'ja'): + metadata.original_title = t['title'] + + if not movie: for ep in series['eps']: if ep['eptype'] != 1: @@ -137,7 +142,7 @@ def Update(self, metadata, media, lang, force, movie): pass episodeObj = metadata.seasons[season].episodes[ep['epnumber']] - episodeObj.title = ep['title'] + episodeObj.title = ep['name'] episodeObj.summary = ep['summary'] if ep['air'] != '1/01/0001 12:00:00 AM': diff --git a/Contents/DefaultPrefs.json b/Contents/DefaultPrefs.json index 9f9ed5b..1762047 100644 --- a/Contents/DefaultPrefs.json +++ b/Contents/DefaultPrefs.json @@ -29,6 +29,13 @@ "default": "8111" }, + { + "id": "Fuzzy", + "label": "Use fuzzy searching in Shoko for matching the titles.", + "type": "bool", + "default": false + }, + { "id": "Ratings", "label": "Enable using the \"assumed\" ratings portion of the code", diff --git a/Contents/Resources/Series/Shoko Series Scanner.py b/Contents/Resources/Series/Shoko Series Scanner.py index f8a8d2c..5f33f1d 100644 --- a/Contents/Resources/Series/Shoko Series Scanner.py +++ b/Contents/Resources/Series/Shoko Series Scanner.py @@ -78,7 +78,7 @@ def Scan(path, files, mediaList, subdirs, language=None, root=None): if len(episode_data) == 0: break series_data = HttpReq("api/serie/fromep?id=%d&nocast=1¬ag=1" % episode_data['id']) - showTitle = str(series_data['title']) #no idea why I need to do this. + showTitle = str(series_data['name']) #no idea why I need to do this. log('Scan', 'show title: %s', showTitle) seasonNumber = 0 @@ -102,7 +102,7 @@ def Scan(path, files, mediaList, subdirs, language=None, root=None): log('Scan', 'episode number: %s', episodeNumber) - episodeTitle = str(episode_data['title']) + episodeTitle = str(episode_data['name']) log('Scan', 'episode title: %s', episodeTitle) vid = Media.Episode(showTitle, int(seasonNumber), episodeNumber , episodeTitle, int(seasonYear))