Plex Companion: Compile regex only once
This commit is contained in:
parent
dec4b077d5
commit
1f9ac4f133
1 changed files with 2 additions and 2 deletions
|
@ -17,6 +17,7 @@ class MyHandler(BaseHTTPRequestHandler):
|
|||
def __init__(self, *args, **kwargs):
|
||||
BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
|
||||
self.serverlist = []
|
||||
self.regex = re.compile(r'''/playQueues/(\d+)$''')
|
||||
|
||||
def getServerByHost(self, host):
|
||||
if len(self.serverlist) == 1:
|
||||
|
@ -147,9 +148,8 @@ class MyHandler(BaseHTTPRequestHandler):
|
|||
containerKey = urlparse(params.get('containerKey')).path
|
||||
except:
|
||||
containerKey = ''
|
||||
regex = re.compile(r'''/playQueues/(\d+)$''')
|
||||
try:
|
||||
playQueueID = regex.findall(containerKey)[0]
|
||||
playQueueID = self.regex.findall(containerKey)[0]
|
||||
except IndexError:
|
||||
playQueueID = ''
|
||||
|
||||
|
|
Loading…
Reference in a new issue