Skip to content

Commit

Permalink
v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Cazzar authored Feb 8, 2017
2 parents b5881e4 + 08293c2 commit 67a250c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
23 changes: 14 additions & 9 deletions Contents/Code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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 = []
Expand Down Expand Up @@ -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:
Expand All @@ -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':
Expand Down
7 changes: 7 additions & 0 deletions Contents/DefaultPrefs.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions Contents/Resources/Series/Shoko Series Scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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&notag=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
Expand All @@ -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))
Expand Down

0 comments on commit 67a250c

Please sign in to comment.