Esempio n. 1
0
class MovieTitleIdentifier(MovieIdentifier):

    def __init__(self, srcfile, path):
        super(MovieTitleIdentifier, self).__init__(srcfile, path)
        self.db = FilmDB()
        self.title = os.path.basename(srcfile)
        self.parser = TitleParser(self.title)

    def get_titles(self):
        possible_titles = self.parser.parse()
        logger.debug("Found possible titles %s for title %s" % (possible_titles, self.title))
        possible_exact_titles = flatten(
            [self.db.query_title(title, year) for title, year in possible_titles])
        possible_fuzzy_titles = flatten(
            [self.db.query_fuzzy(title, year) for title, year in possible_titles])
        
        titles = set(possible_exact_titles).intersection(set(possible_fuzzy_titles))
        logger.debug("Found normalized titles %s" % titles)
        return titles

    def get_params(self, title):
        title, year = title
        params = {
            't': title,
            'tomatoes': True,
        }
        if year:
            params['y'] = year
        return params
Esempio n. 2
0
 def __init__(self, srcfile, path):
     super(MovieTitleIdentifier, self).__init__(srcfile, path)
     self.db = FilmDB()
     self.title = os.path.basename(srcfile)
     self.parser = TitleParser(self.title)