Catalogs: fix exclude tags rules not working in non-English locales when
creating catalogs in EPUB/MOBI formats. Fixes #1228949 [Exclude books for catalogs not functional in German localisation](https://bugs.launchpad.net/calibre/+bug/1228949)
This commit is contained in:
Kovid Goyal 2013-09-25 17:45:29 +05:30
commit f6a7ef58f7

View File

@ -4447,21 +4447,21 @@ class CatalogBuilder(object):
""" """
excluded_tags = [] excluded_tags = []
for rule in self.opts.exclusion_rules: for rule in self.opts.exclusion_rules:
if rule[1].lower() == 'tags': if rule[1] == _('Tags'):
excluded_tags.extend(rule[2].split(',')) excluded_tags.extend(rule[2].split(','))
# Remove dups # Remove dups
excluded_tags = list(set(excluded_tags)) excluded_tags = list(set(excluded_tags))
# Report excluded books # Report excluded books
if self.opts.verbose and excluded_tags: if excluded_tags:
self.opts.log.info(" Books excluded by tag:") self.opts.log.info(" Books excluded by tag:")
data = self.db.get_data_as_dict(ids=self.opts.ids) data = self.db.get_data_as_dict(ids=self.opts.ids)
for record in data: for record in data:
matched = list(set(record['tags']) & set(excluded_tags)) matched = list(set(record['tags']) & set(excluded_tags))
if matched: if matched:
for rule in self.opts.exclusion_rules: for rule in self.opts.exclusion_rules:
if rule[1] == 'Tags' and rule[2] == str(matched[0]): if rule[1] == _('Tags') and rule[2] == str(matched[0]):
self.opts.log.info(" - '%s' by %s (Exclusion rule '%s')" % self.opts.log.info(" - '%s' by %s (Exclusion rule '%s')" %
(record['title'], record['authors'][0], rule[0])) (record['title'], record['authors'][0], rule[0]))