Пример #1
0
    def find_meta_tmdb(self):
        from lib_metadata import SiteTmdbFtv
        from tool_base import ToolBaseFile
        module_map = [('tmdb', SiteTmdbFtv)]

        for site, site_class in module_map:
            try:
                if self.data['filename'][
                        'name'] in EntityKtv.meta_cache and site in EntityKtv.meta_cache[
                            self.data['filename']['name']]:
                    self.data['meta'] = EntityKtv.meta_cache[
                        self.data['filename']['name']][site]
                    # 없는 것도 저장하여 중복검색 방지
                    if self.data['meta']['find']:
                        return
                site_data = site_class.search(self.data['filename']['name'])
                #logger.warning(f"{site} {d(site_data)}")
                if site_data['ret'] == 'success':
                    if len(site_data['data']
                           ) > 0 and site_data['data'][0]['score'] >= 80:
                        self.data['filename']['name'] = site_data['data'][0][
                            'title']
                        self.find_meta()
                        if self.data['meta']['find'] == False:
                            self.data['process_info']['status'] = 'ftv'
                            self.data['process_info'][
                                'ftv_title'] = ToolBaseFile.text_for_filename(
                                    site_data['data'][0]['title'])
                            self.data['process_info']['ftv_year'] = site_data[
                                'data'][0]['year']
                        return
            except Exception as exception:
                logger.error('Exception:%s', exception)
                logger.error(traceback.format_exc())
Пример #2
0
    def move_file(config, entity, source_path, target_folder, data, is_dry):
        #if entity.data['process_info']['status'] in ['number_and_date_match', 'meta_epi_empty', 'number_and_date_match_by_release', 'number_and_date_match_ott', 'meta_epi_not_find', 'no_date']:
        if True:
            year_tmp = entity.data['meta']['info']['year']
            if year_tmp == 0 or year_tmp == '0':
                year_tmp = ''
            genre = entity.data['meta']['info']['genre'][0].split('/')[0]
            if entity.data['meta']['info']['code'][1] == 'D':
                genre = config['메타 사이트별 장르 접두사']['daum'] + ' ' + genre
            elif entity.data['meta']['info']['code'][1] == 'W':
                genre = config['메타 사이트별 장르 접두사']['wavve'] + ' ' + genre
            elif entity.data['meta']['info']['code'][1] == 'V':
                genre = config['메타 사이트별 장르 접두사']['tving'] + ' ' + genre
            genre = genre.strip()
            genre = config['장르 변경 규칙'].get(genre, genre)

            program_folder = config['타겟 폴더 구조'].format(
                title=ToolBaseFile.text_for_filename(
                    entity.data['meta']['info']['title']),
                year=year_tmp,
                studio=entity.data['meta']['info']['studio'],
                genre=genre,
                release=entity.data['filename']['release'],
            )
            tmps = program_folder.replace('(1900)',
                                          '').replace('()',
                                                      '').replace('[]',
                                                                  '').strip()
            tmps = re.sub("\s{2,}", ' ', tmps)
            tmps = re.sub("/{2,}", '/', tmps)
            tmps = tmps.split('/')
            program_folder = os.path.join(target_folder, *tmps)

            #logger.debug(f"program_folder : {program_folder}")
            #logger.error(entity.data['process_info']['status'])

            program_folder = Task.get_prefer_folder(config, entity,
                                                    program_folder)

            target_filename = entity.get_newfilename()
            if target_filename is not None:
                #logger.warning(program_folder)
                #logger.error(f"original : {entity.data['filename']['original']}")
                #logger.error(f'target_filename : {target_filename}')
                data['result_folder'] = program_folder
                data['result_filename'] = target_filename
                if is_dry == False:
                    ToolBaseFile.file_move(source_path, program_folder,
                                           target_filename)
            else:
                logger.error(f"타겟 파일 None")
Пример #3
0
 def change_text_for_use_filename(text):
     from tool_base import ToolBaseFile
     return ToolBaseFile.text_for_filename(text)