Fix fnmatch
fnmatch does not accept regular expressions as presumed in
0c4851e436 See
http://docs.python.org/2/library/fnmatch.html
This patch actually completely broke tagging. All we need to do is make
sure any [ or ] used is conbverted into [[] or []].
Fixes #2557 and #2362
This commit is contained in:
1 parent
966f8c36b1
commit
824ac86d18
2 files changed
+6
-3
No files matched your search
@@ -11,6 +11,9 @@ import sys
|
|||||||
|
|
||||||
log = CPLog(__name__)
|
log = CPLog(__name__)
|
||||||
|
|
||||||
|
def fnEscape(pattern):
|
||||||
|
return pattern.replace('[','[[').replace(']','[]]').replace('[[','[[]')
|
||||||
|
|
||||||
def link(src, dst):
|
def link(src, dst):
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
import ctypes
|
import ctypes
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from couchpotato.api import addApiView
|
|||||||
from couchpotato.core.event import addEvent, fireEvent, fireEventAsync
|
from couchpotato.core.event import addEvent, fireEvent, fireEventAsync
|
||||||
from couchpotato.core.helpers.encoding import toUnicode, ss, sp
|
from couchpotato.core.helpers.encoding import toUnicode, ss, sp
|
||||||
from couchpotato.core.helpers.variable import getExt, mergeDicts, getTitle, \
|
from couchpotato.core.helpers.variable import getExt, mergeDicts, getTitle, \
|
||||||
getImdb, link, symlink, tryInt, splitString
|
getImdb, link, symlink, tryInt, splitString, fnEscape
|
||||||
from couchpotato.core.logger import CPLog
|
from couchpotato.core.logger import CPLog
|
||||||
from couchpotato.core.plugins.base import Plugin
|
from couchpotato.core.plugins.base import Plugin
|
||||||
from couchpotato.core.settings.model import Library, File, Profile, Release, \
|
from couchpotato.core.settings.model import Library, File, Profile, Release, \
|
||||||
@@ -644,7 +644,7 @@ Remove it if you want it to be renamed (again, or at least let it try again)
|
|||||||
|
|
||||||
# Match all found ignore files with the tag_files and delete if found
|
# Match all found ignore files with the tag_files and delete if found
|
||||||
for tag_file in tag_files:
|
for tag_file in tag_files:
|
||||||
ignore_file = fnmatch.filter(ignore_files, '%s.%s.ignore' % (re.escape(os.path.splitext(tag_file)[0]), tag if tag else '*'))
|
ignore_file = fnmatch.filter(ignore_files, fnEscape('%s.%s.ignore' % (os.path.splitext(tag_file)[0], tag if tag else '*')))
|
||||||
for filename in ignore_file:
|
for filename in ignore_file:
|
||||||
try:
|
try:
|
||||||
os.remove(filename)
|
os.remove(filename)
|
||||||
@@ -677,7 +677,7 @@ Remove it if you want it to be renamed (again, or at least let it try again)
|
|||||||
|
|
||||||
# Match all found ignore files with the tag_files and return True found
|
# Match all found ignore files with the tag_files and return True found
|
||||||
for tag_file in tag_files:
|
for tag_file in tag_files:
|
||||||
ignore_file = fnmatch.filter(ignore_files, '%s.%s.ignore' % (os.path.splitext(tag_file)[0], tag if tag else '*'))
|
ignore_file = fnmatch.filter(ignore_files, fnEscape('%s.%s.ignore' % (os.path.splitext(tag_file)[0], tag if tag else '*')))
|
||||||
if ignore_file:
|
if ignore_file:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user