Commit d5ec0014 authored by echel0n's avatar echel0n
Browse files

Fixed issues with matching shows with parsed results when containing accents

parent d4214c53
......@@ -21,6 +21,7 @@ from __future__ import unicode_literals
import os
import re
import time
import unicodedata
from collections import OrderedDict
from threading import Lock
......@@ -63,21 +64,22 @@ class NameParser(object):
if not all([name,]):
return show, show_id
def cache_lookup(name):
def cache_lookup(show_name):
def scene_exception_lookup(name):
return get_scene_exception_by_name(name)[0]
def scene_exception_lookup(show_name):
return get_scene_exception_by_name(show_name)[0]
def indexer_lookup(name):
show_id1 = int(IndexerApi().searchForShowID(full_sanitizeSceneName(name))[2])
show_id2 = int(srTraktAPI()['search'].query(full_sanitizeSceneName(name), 'show')[0].ids['tvdb'])
def indexer_lookup(show_name):
show_id1 = int(IndexerApi().searchForShowID(full_sanitizeSceneName(show_name))[2])
show_id2 = int(srTraktAPI()['search'].query(full_sanitizeSceneName(show_name), 'show')[0].ids['tvdb'])
return (None, show_id1)[show_id1 == show_id2]
for x in [unicodedata.normalize('NFKD', name).encode('ASCII', 'ignore'), name]:
lookup_list = [
lambda: cache_lookup(name),
lambda: scene_exception_lookup(name),
lambda: indexer_lookup(name),
lambda: cache_lookup(x),
lambda: scene_exception_lookup(x),
lambda: indexer_lookup(x),
# lookup show id
......@@ -90,7 +92,7 @@ class NameParser(object):
if show_id == 0:
continue, show_id), show_id)
if self.validate_show:
show = findCertainShow(show_id)
......@@ -101,7 +103,7 @@ class NameParser(object):
if show_id is None:
# ignore show name by caching it with a indexerid of 0, 0), 0)
return show, show_id or 0
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment