Merge pull request #1059 from croneter/fix-regex
Fix a couple of issues with music when using direct paths: correctly escape music paths for Kodi regex matching
This commit is contained in:
commit
aff0fd7a5f
1 changed files with 3 additions and 2 deletions
|
@ -2,6 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, unicode_literals
|
||||
from logging import getLogger
|
||||
import re
|
||||
|
||||
from .plex_api.media import Media
|
||||
from . import utils
|
||||
|
@ -85,7 +86,7 @@ def _turn_to_regex(path):
|
|||
else:
|
||||
if not path.endswith('\\'):
|
||||
path = '%s\\' % path
|
||||
# Need to escape backslashes
|
||||
path = path.replace('\\', '\\\\')
|
||||
# Escape all characters that could cause problems
|
||||
path = re.escape(path)
|
||||
# Beginning of path only needs to be similar
|
||||
return '^%s' % path
|
||||
|
|
Loading…
Reference in a new issue