Ejemplo n.º 1
0
    def __init__(self, path):
        '''
        use movie title information contained in <path>'s filename to init

        path: path to target movie file
        '''

        # split pathname into useful things upon creation
        self.__abspath = uni(os.path.abspath(path))
        self.__dirpath = uni(os.path.split(self.__abspath)[0])
        self.__filename = os.path.splitext(os.path.split(self.__abspath)[1])
        self.basename = uni(self.__filename[0])
        self.ext = uni(self.__filename[1])
        # extract the title and year from the basename
        self.title = split_full_title(self.basename, False)['title']
        self.year = split_full_title(self.basename)['year']
        self.full_title = self.title + ' (' + self.year + ')'
        # unicode support
        self.uni_title = split_full_title(self.basename)['title']
        self.uni_full_title = self.uni_title + ' (' + self.year + ')'
        self.tmdb_data = None
        self.matched_method = None
Ejemplo n.º 2
0
def is_title_match(self, possible_matching_title):
    '''
    compare title with <possible_matching_title>
    returns method that matched:
        *
        orig = original title it was released with
        local = localized title
        *
        exact = titles match exactly
        words = some extra punctuation in one of the titles but all words match
        *
        ascii = all accents and non-ascii characters have been replaced
        uni = accents and special characters included
    '''

    if self.originaltitle.lower() == possible_matching_title.lower():
        return 'orig_exact_uni'

    if self.title.lower() == possible_matching_title.lower():
        return 'local_exact_uni'

    if (split_full_title(self.originaltitle)['title'].lower() ==
        possible_matching_title.lower()):
        return 'orig_words_uni'
    if (split_full_title(self.originaltitle, False)['title'].lower() ==
        possible_matching_title.lower()):
        return 'orig_words_ascii'

    if (split_full_title(self.title)['title'].lower() ==
        possible_matching_title.lower()):
        return 'local_words_uni'
    if (split_full_title(self.title, False)['title'].lower() ==
        possible_matching_title.lower()):
        return 'local_words_ascii'

    # nothing matches
    return False