Compile regex only once
This commit is contained in:
parent
fc03ebc8d4
commit
5fcccba105
1 changed files with 2 additions and 3 deletions
|
@ -15,7 +15,7 @@ from variables import PLEX_TO_KODI_TIMEFACTOR
|
||||||
log = getLogger("PLEX."+__name__)
|
log = getLogger("PLEX."+__name__)
|
||||||
|
|
||||||
CONTAINERSIZE = int(settings('limitindex'))
|
CONTAINERSIZE = int(settings('limitindex'))
|
||||||
|
REGEX_PLEX_KEY = re.compile(r'''/(.+)/(\d+)$''')
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,9 +36,8 @@ def GetPlexKeyNumber(plexKey):
|
||||||
|
|
||||||
Returns ('','') if nothing is found
|
Returns ('','') if nothing is found
|
||||||
"""
|
"""
|
||||||
regex = re.compile(r'''/(.+)/(\d+)$''')
|
|
||||||
try:
|
try:
|
||||||
result = regex.findall(plexKey)[0]
|
result = REGEX_PLEX_KEY.findall(plexKey)[0]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
result = ('', '')
|
result = ('', '')
|
||||||
return result
|
return result
|
||||||
|
|
Loading…
Reference in a new issue