Exemplo n.º 1
0
 def clean_downloaded_metadata(self, mi):
     if mi.title and self.domain in ('com', 'uk'):
         mi.title = fixcase(mi.title)
     mi.authors = fixauthors(mi.authors)
     if self.domain in ('com', 'uk'):
         mi.tags = list(map(fixcase, mi.tags))
     mi.isbn = check_isbn(mi.isbn)
Exemplo n.º 2
0
 def clean_downloaded_metadata(self, mi):
     if mi.title and self.domain in ('com', 'uk'):
         mi.title = fixcase(mi.title)
     mi.authors = fixauthors(mi.authors)
     if self.domain in ('com', 'uk'):
         mi.tags = list(map(fixcase, mi.tags))
     mi.isbn = check_isbn(mi.isbn)
Exemplo n.º 3
0
 def clean_downloaded_metadata(self, mi):
     docase = mi.language == "eng" or (mi.is_null("language") and self.domain in {"com", "uk"})
     if mi.title and docase:
         mi.title = fixcase(mi.title)
     mi.authors = fixauthors(mi.authors)
     if mi.tags and docase:
         mi.tags = list(map(fixcase, mi.tags))
     mi.isbn = check_isbn(mi.isbn)
Exemplo n.º 4
0
 def clean_downloaded_metadata(self, mi):
     docase = (mi.language == 'eng')
     if mi.title and docase:
         mi.title = fixcase(mi.title)
     mi.authors = fixauthors(mi.authors)
     if mi.tags and docase:
         mi.tags = list(map(fixcase, mi.tags))
     mi.isbn = check_isbn(mi.isbn)
Exemplo n.º 5
0
 def clean_downloaded_metadata(self, mi):
     docase = (mi.language == 'eng'
               or (mi.is_null('language') and self.domain in {'com', 'uk'}))
     if mi.title and docase:
         mi.title = fixcase(mi.title)
     mi.authors = fixauthors(mi.authors)
     if mi.tags and docase:
         mi.tags = list(map(fixcase, mi.tags))
     mi.isbn = check_isbn(mi.isbn)
Exemplo n.º 6
0
 def clean_downloaded_metadata(self, mi):
     docase = (
         mi.language == 'eng' or mi.is_null('language')
     )
     if mi.title and docase:
         mi.title = fixcase(mi.title)
     mi.authors = fixauthors(mi.authors)
     if mi.tags and docase:
         mi.tags = list(map(fixcase, mi.tags))
     mi.isbn = check_isbn(mi.isbn)
Exemplo n.º 7
0
 def clean_downloaded_metadata(self, mi):
     docase = (mi.language == 'zhn')
     if mi.title and docase:
         # Remove series information from title
         m = re.search(r'\S+\s+(\(.+?\s+Book\s+\d+\))$', mi.title)
         if m is not None:
             mi.title = mi.title.replace(m.group(1), '').strip()
         mi.title = fixcase(mi.title)
     mi.authors = fixauthors(mi.authors)
     if mi.tags and docase:
         mi.tags = list(map(fixcase, mi.tags))
     mi.isbn = check_isbn(mi.isbn)
     if mi.series and docase:
         mi.series = fixcase(mi.series)
     if mi.title and mi.series:
         for pat in (r':\s*Book\s+\d+\s+of\s+%s$', r'\(%s\)$',
                     r':\s*%s\s+Book\s+\d+$'):
             pat = pat % re.escape(mi.series)
             q = re.sub(pat, '', mi.title, flags=re.I).strip()
             if q and q != mi.title:
                 mi.title = q
                 break
Exemplo n.º 8
0
    def clean_downloaded_metadata(self, mi):
        """
        Overridden from the calibre default so that we can stop this plugin messing
        with the tag casing coming from Goodreads
        """
        series_in_title = r'\s*{0}\s*#?{1}\s*'.format(mi.series,
                                                      mi.series_index)
        if mi.title:
            mi.title = re.sub(series_in_title + r'[:-]',
                              r'',
                              mi.title,
                              flags=re.IGNORECASE).strip()
            mi.title = re.sub(r'(?:[^:-]+)[:-]' + series_in_title,
                              r'',
                              mi.title,
                              flags=re.IGNORECASE).strip()
            mi.title = re.sub(r'\(.*?\)', r'', mi.title,
                              flags=re.IGNORECASE).strip()
            mi.title = re.sub(r'\[.*?\]', r'', mi.title,
                              flags=re.IGNORECASE).strip()
            mi.title = fixcase(mi.title)
            mi.title = mi.title.strip()

        if mi.authors:
            mi.authors = fixauthors(mi.authors)
            try:
                plugin_prefs = JSONConfig('plugins/Quality Check')
                from calibre_plugins.quality_check.config import STORE_OPTIONS, KEY_AUTHOR_INITIALS_MODE, AUTHOR_INITIALS_MODES
                initials_mode = plugin_prefs[STORE_OPTIONS].get(
                    KEY_AUTHOR_INITIALS_MODE, u'A. B.')
                from calibre_plugins.quality_check.helpers import get_formatted_author_initials
                mi.authors = [
                    get_formatted_author_initials(initials_mode, author)
                    for author in mi.authors
                ]
            except:
                pass