mirror of
https://github.com/moparisthebest/SickRage
synced 2025-01-05 10:58:01 -05:00
Fix for bug #911, escapes regex for ignored words
This commit is contained in:
parent
e57fa4d585
commit
461b1d89d3
@ -154,8 +154,8 @@ def get_scene_exception_by_name_multiple(show_name):
|
||||
|
||||
if out:
|
||||
return out
|
||||
else:
|
||||
return [(None, None)]
|
||||
|
||||
return (None, None)
|
||||
|
||||
|
||||
def retrieve_exceptions():
|
||||
@ -246,7 +246,6 @@ def retrieve_exceptions():
|
||||
else:
|
||||
logger.log(u"No scene exceptions update needed")
|
||||
|
||||
|
||||
# cleanup
|
||||
exception_dict.clear()
|
||||
anidb_exception_dict.clear()
|
||||
|
@ -53,26 +53,27 @@ def filterBadReleases(name, parse=True):
|
||||
logger.log(u"Unable to parse the filename " + name + " into a valid episode", logger.DEBUG)
|
||||
return False
|
||||
except InvalidShowException:
|
||||
logger.log(u"Unable to parse the filename " + name + " into a valid show", logger.DEBUG)
|
||||
return False
|
||||
pass
|
||||
# logger.log(u"Unable to parse the filename " + name + " into a valid show", logger.DEBUG)
|
||||
# return False
|
||||
|
||||
# if any of the bad strings are in the name then say no
|
||||
if sickbeard.IGNORE_WORDS:
|
||||
resultFilters.extend(sickbeard.IGNORE_WORDS.split(','))
|
||||
filters = [re.compile('(^|[\W_])%s($|[\W_])' % filter.strip(), re.I) for filter in resultFilters]
|
||||
filters = [re.compile('(^|[\W_])%s($|[\W_])' % re.escape(filter.strip()), re.I) for filter in resultFilters]
|
||||
for regfilter in filters:
|
||||
if regfilter.search(name):
|
||||
logger.log(u"Invalid scene release: " + name + " contains pattern: " + regfilter.pattern + ", ignoring it",
|
||||
logger.log(u"Invalid scene release: " + name + " contained: " + regfilter.pattern + ", ignoring it",
|
||||
logger.DEBUG)
|
||||
return False
|
||||
|
||||
# if any of the good strings aren't in the name then say no
|
||||
if sickbeard.REQUIRE_WORDS:
|
||||
require_words = sickbeard.REQUIRE_WORDS.split(',')
|
||||
filters = [re.compile('(^|[\W_])%s($|[\W_])' % filter.strip(), re.I) for filter in require_words]
|
||||
filters = [re.compile('(^|[\W_])%s($|[\W_])' % re.escape(filter.strip()), re.I) for filter in require_words]
|
||||
for regfilter in filters:
|
||||
if not regfilter.search(name):
|
||||
logger.log(u"Invalid scene release: " + name + " doesn't contain pattern: " + regfilter.pattern + ", ignoring it",
|
||||
logger.log(u"Invalid scene release: " + name + " doesn't contain: " + regfilter.pattern + ", ignoring it",
|
||||
logger.DEBUG)
|
||||
return False
|
||||
|
||||
|
1
tests/cache/.gitignore
vendored
1
tests/cache/.gitignore
vendored
@ -1 +0,0 @@
|
||||
*.db
|
@ -34,7 +34,7 @@ import shutil
|
||||
from sickbeard import encodingKludge as ek, providers, tvcache
|
||||
from sickbeard import db
|
||||
from sickbeard.databases import mainDB
|
||||
from sickbeard.databases import cache_db
|
||||
from sickbeard.databases import cache_db, failed_db
|
||||
|
||||
#=================
|
||||
# test globals
|
||||
@ -42,7 +42,7 @@ from sickbeard.databases import cache_db
|
||||
TESTDIR = os.path.abspath('.')
|
||||
TESTDBNAME = "sickbeard.db"
|
||||
TESTCACHEDBNAME = "cache.db"
|
||||
|
||||
TESTFAILEDDBNAME = "failed.db"
|
||||
|
||||
SHOWNAME = u"show name"
|
||||
SEASON = 4
|
||||
@ -102,6 +102,7 @@ createTestCacheFolder()
|
||||
#=================
|
||||
def _dummy_saveConfig():
|
||||
return True
|
||||
|
||||
# this overrides the sickbeard save_config which gets called during a db upgrade
|
||||
# this might be considered a hack
|
||||
mainDB.sickbeard.save_config = _dummy_saveConfig
|
||||
@ -165,7 +166,6 @@ class TestCacheDBConnection(TestDBConnection, object):
|
||||
sickbeard.db.DBConnection = TestDBConnection
|
||||
sickbeard.tvcache.CacheDBConnection = TestCacheDBConnection
|
||||
|
||||
|
||||
#=================
|
||||
# test functions
|
||||
#=================
|
||||
@ -174,23 +174,29 @@ def setUp_test_db():
|
||||
"""
|
||||
# upgrading the db
|
||||
db.upgradeDatabase(db.DBConnection(), mainDB.InitialSchema)
|
||||
|
||||
# fix up any db problems
|
||||
db.sanityCheckDatabase(db.DBConnection(), mainDB.MainSanityCheck)
|
||||
|
||||
#and for cache.b too
|
||||
# and for cachedb too
|
||||
db.upgradeDatabase(db.DBConnection("cache.db"), cache_db.InitialSchema)
|
||||
|
||||
# and for faileddb too
|
||||
db.upgradeDatabase(db.DBConnection("failed.db"), failed_db.InitialSchema)
|
||||
|
||||
|
||||
def tearDown_test_db():
|
||||
"""Deletes the test db
|
||||
although this seams not to work on my system it leaves me with an zero kb file
|
||||
"""
|
||||
# uncomment next line so leave the db intact between test and at the end
|
||||
return False
|
||||
#return False
|
||||
if os.path.exists(os.path.join(TESTDIR, TESTDBNAME)):
|
||||
os.remove(os.path.join(TESTDIR, TESTDBNAME))
|
||||
if os.path.exists(os.path.join(TESTDIR, TESTCACHEDBNAME)):
|
||||
os.remove(os.path.join(TESTDIR, TESTCACHEDBNAME))
|
||||
if os.path.exists(os.path.join(TESTDIR, TESTFAILEDDBNAME)):
|
||||
os.remove(os.path.join(TESTDIR, TESTFAILEDDBNAME))
|
||||
|
||||
|
||||
def setUp_test_episode_file():
|
||||
|
Loading…
Reference in New Issue
Block a user