Skip to content

Commit

Permalink
V 1.4.1
Browse files Browse the repository at this point in the history
Minor changes, not enough to warrant a new minor version, just a couple of bugfixes
  • Loading branch information
Cazzar authored Mar 13, 2019
2 parents ab2e594 + 6a94cb4 commit e62bd1d
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions Contents/Code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#this is from https://github.com/plexinc-agents/PlexThemeMusic.bundle/blob/master/Contents/Code/__init__.py
THEME_URL = 'http://tvthemes.plexapp.com/%s.mp3'

LINK_REGEX = r"https?:\/\/\w+.\w+(?:\/?\w+)? \[([\w ]+)\]"

def ValidatePrefs():
pass
Expand Down Expand Up @@ -79,7 +79,7 @@ def Search(self, results, media, lang, manual, movie):
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)
meta = MetadataSearchResult('%s' % result['id'], result['name'], try_get(result, 'year', None), score, lang)
results.Append(meta)

# results.Sort('score', descending=True)
Expand All @@ -104,7 +104,7 @@ def Update(self, metadata, media, lang, force, movie):
series = HttpReq("api/serie?id=%s&level=3&allpics=1&tagfilter=%d" % (aid, flags))

# build metadata on the TV show.
metadata.summary = try_get(series, 'summary')
metadata.summary = re.sub(LINK_REGEX, r'\1', try_get(series, 'summary'))
metadata.title = series['name']
metadata.rating = float(series['rating'])
year = try_get(series, "year", None)
Expand Down Expand Up @@ -215,14 +215,17 @@ def metadata_add(self, meta, images):
valid = list()

for art in images:
if 'support/plex_404.png' in art['url']:
continue
if ':' in art['url']:
urlparts = urllib.parse.urlparse(art['url'])
art['url'] = art['url'].replace("{scheme}://{host}:{port}/".format(scheme=urlparts.scheme, host=urlparts.hostname, port=urlparts.port), '')
Log("[metadata_add] :: Adding metadata %s (index %d)" % (art['url'], art['index']))
meta[art['url']] = Proxy.Media(HTTP.Request("http://{host}:{port}{relativeURL}".format(host=Prefs['Hostname'], port=Prefs['Port'], relativeURL=art['url'])).content, art['index'])
valid.append(art['url'])
try:
if 'support/plex_404.png' in art['url']:
continue
if ':' in art['url']:
urlparts = urllib.parse.urlparse(art['url'])
art['url'] = art['url'].replace("{scheme}://{host}:{port}/".format(scheme=urlparts.scheme, host=urlparts.hostname, port=urlparts.port), '')
Log("[metadata_add] :: Adding metadata %s (index %d)" % (art['url'], art['index']))
meta[art['url']] = Proxy.Media(HTTP.Request("http://{host}:{port}{relativeURL}".format(host=Prefs['Hostname'], port=Prefs['Port'], relativeURL=art['url'])).content, art['index'])
valid.append(art['url'])
except:
Log("[metadata_add] :: Invalid URL given (%s), skipping" % art['url'])

meta.validate_keys(valid)

Expand Down

0 comments on commit e62bd1d

Please sign in to comment.