def process_telegram_data(self, data, target=None):
     try:
         ret = ModelBotDownloaderKtvItem.process_telegram_data(data)
         #logger.debug(ret)
         if ret is not None:
             if ModelSetting.get_bool('receive_info_send_telegram'):
                 msg = '😉 TV 정보 수신\n'
                 msg += '제목 : %s\n' % data['filename']
                 if ret is None:
                     msg += '중복 마그넷입니다.'
                     #TelegramHandle.sendMessage(msg)
                 else:
                     url = '%s/%s/api/%s/add_download?url=%s' % (SystemModelSetting.get('ddns'), package_name, self.name, ret.magnet)
                     if SystemModelSetting.get_bool('auth_use_apikey'):
                         url += '&apikey=%s' % SystemModelSetting.get('auth_apikey')
                     if app.config['config']['is_sjva_server']:
                         msg += '\n' + ret.magnet + '\n'
                     else:
                         msg += '\n➕ 다운로드 추가\n<%s>\n' % url
                     try:
                         if ret.daum_id is not None:
                             url = 'https://search.daum.net/search?w=tv&q=%s&irk=%s&irt=tv-program&DA=TVP' % (urllib.quote(ret.daum_title.encode('utf8')), ret.daum_id)
                             msg += '\n● Daum 정보\n%s' % url
                     except Exception as e: 
                         logger.error('Exception:%s', e)
                         logger.error(traceback.format_exc())  
                 import framework.common.notify as Notify
                 Notify.send_message(msg, image_url=ret.daum_poster_url, message_id='bot_downloader_ktv_receive')
             self.invoke()
             TorrentProcess.receive_new_data(ret, package_name)
     except Exception, e:
             logger.error('Exception:%s', e)
             logger.error(traceback.format_exc())
Пример #2
0
    def send_telegram_message(item):
        try:
            msg = '😉 봇 다운로드 - 영화 처리결과\n'
            msg += '제목 : %s (%s)\n' % (item.movie_title, item.movie_year)
            msg += '파일 : %s\n' % item.filename

            if item.download_status == 'true':
                status_str = '✔조건일치 - 요청'
            elif item.download_status == 'false':
                status_str = '⛔패스 '
            elif item.download_status == 'no':
                status_str = '자동 다운로드 사용안함'
            elif item.download_status == 'true_only_status':
                status_str = '✔조건일치 - 상태만'
            elif item.download_status == 'false_only_status':
                status_str = '⛔조건불일치 - 상태만'

            msg += '결과 : %s\n' % status_str
            msg += '%s/%s/list\n' % (SystemModelSetting.get('ddns'),
                                     package_name)
            msg += '로그\n' + item.log

            import framework.common.notify as Notify
            Notify.send_message(msg, message_id='bot_downloader_movie_result')
        except Exception as e:
            logger.error('Exception:%s', e)
            logger.error(traceback.format_exc())
Пример #3
0
 def process_telegram_data(data):
     try:
         logger.debug('receive data')
         logger.debug(data)
         type_list = ModelSetting.get('cache_save_type_list').split('|')
         type_list = Util.get_list_except_empty(type_list)
         if len(type_list) == 0 or data['t'] in type_list:
             ret = ModelOffcloud2Cache.add(data)
             if ret is not None:
                 logger.debug('Offcloud2 %s append' % ret.name)
                 if ModelSetting.get_bool(
                         'cache_receive_info_send_telegram'):
                     msg = '😉 Offcloud2 캐쉬 정보 수신\n'
                     msg += 'Type : %s\n' % data['t']
                     msg += '%s\n' % data['n']
                     from system.model import ModelSetting as SystemModelSetting
                     ddns = SystemModelSetting.get('ddns')
                     url = '%s/%s/api/cache_download?id=%s' % (
                         ddns, package_name, ret.id)
                     if SystemModelSetting.get_bool('auth_use_apikey'):
                         url += '&apikey=%s' % SystemModelSetting.get(
                             'auth_apikey')
                     msg += '➕ 리모트 다운로드 추가\n<%s>' % url
                     import framework.common.notify as Notify
                     Notify.send_message(
                         msg, message_id='offcloud2_cache_receive')
     except Exception as e:
         logger.error(e)
         logger.error(traceback.format_exc())
Пример #4
0
    def process_telegram_data(data):
        try:
            ret = ModelMovieItem.process_telegram_data(data)
            #logger.debug('telegram bot receive. is exist : %s', ret)
            if ret is not None:
                if ModelSetting.get_bool('receive_info_send_telegram'):
                    msg = '😉 영화 정보 수신\n'
                    msg += '제목 : %s (%s)\n' % (ret.movie_title, ret.movie_year)
                    msg += '파일 : %s\n' % ret.filename
                    url = '%s/%s/api/add_download?id=%s' % (
                        SystemModelSetting.get('ddns'), package_name, ret.id)
                    if SystemModelSetting.get_bool('auth_use_apikey'):
                        url += '&apikey=%s' % SystemModelSetting.get(
                            'auth_apikey')
                    if app.config['config']['is_sjva_server']:
                        msg += '\n' + ret.magnet + '\n'
                    else:
                        msg += '\n➕ 다운로드 추가\n<%s>\n' % url
                    #msg += '\n➕ 다운로드 추가\n<%s>\n' % url
                    try:
                        if ret.movie_title is not None:
                            if ret.movie_target == 'imdb':
                                url = 'https://www.imdb.com/title/%s' % ret.movie_id
                                msg += '\n● IMDB 정보\n%s' % url
                            else:
                                url = 'https://movie.daum.net/moviedb/main?movieId=%s' % (
                                    ret.movie_id)
                                msg += '\n● Daum 정보\n%s' % url
                    except Exception as e:
                        logger.error('Exception:%s', e)
                        logger.error(traceback.format_exc())

                    import framework.common.notify as Notify
                    Notify.send_message(
                        msg,
                        image_url=ret.daum_poster,
                        message_id='bot_downloader_movie_receive')
                LogicNormal.invoke()
                TorrentProcess.receive_new_data(ret, package_name)
        except Exception, e:
            logger.error('Exception:%s', e)
            logger.error(traceback.format_exc())
Пример #5
0
 def send_telegram(where, title):
     try:
         if LogicNormal.pre_telegram_title == title:
             return
         else:
             LogicNormal.pre_telegram_title = title
         if where == '0':
             msg = '트랜스미션'
         elif where == '1':
             msg = '다운로드스테이션'
         elif where == '2':
             msg = '큐빗토렌트'
         elif where == '3':
             msg = 'aria2'
         msg += '\n%s 다운로드 완료' % title
         import framework.common.notify as Notify
         Notify.send_message(msg, message_id='downloader_completed_remove')
     except Exception as e:
         logger.error('Exception:%s', e)
         logger.error(traceback.format_exc())
Пример #6
0
    def process_telegram_data(data):
        try:
            ret = ModelItem.process_telegram_data(data)
            logger.debug(data)
            #ret = None
            if ret is not None:
                if ModelSetting.get_bool('receive_send_notify'):
                    msg = '😉 AV 정보 수신\n'
                    msg += '제목 : [%s] %s (%s)\n' % (ret.code, ret.title,
                                                    ret.date)
                    msg += '파일 : %s\n' % ret.filename
                    msg += '폴더 : %s\n' % ret.dirname
                    msg += '크기 : %s\n' % Util.sizeof_fmt(ret.total_size)

                    url = '%s/%s/api/add_download?id=%s' % (
                        SystemModelSetting.get('ddns'), package_name, ret.id)
                    if SystemModelSetting.get_bool('auth_use_apikey'):
                        url += '&apikey=%s' % SystemModelSetting.get(
                            'auth_apikey')
                    if app.config['config']['is_sjva_server']:
                        msg += '\n' + ret.magnet + '\n'
                    else:
                        msg += '\n➕ 다운로드 추가\n<%s>\n' % url
                    #msg += '\n➕ 다운로드 추가\n<%s>\n' % url

                    poster = ret.poster if ModelSetting.get_bool(
                        'show_poster_notify') else None
                    import framework.common.notify as Notify
                    Notify.send_message(msg,
                                        image_url=poster,
                                        message_id='bot_downloader_av_receive')
                LogicNormal.invoke()
                TorrentProcess.receive_new_data(ret, package_name)
        except Exception, e:
            logger.error('Exception:%s', e)
            logger.error(traceback.format_exc())
    def send_telegram_message(self, item):
        try:
            telegram_log = '😉 봇 다운로드 - TV\n'
            telegram_log += '정보 : %s (%s), %s회, %s\n' % (item.daum_title, item.daum_genre, item.filename_number, item.filename_date)
            
            if item.download_status.startswith('True'):
                status_str = '✔요청 '
            elif item.download_status.startswith('False'):
                status_str = '⛔패스 '
            else:
                status_str = '🕛대기 '
            if item.plex_key is not None:
                if item.plex_key.startswith('P'):
                    status_str += '(PLEX 프로그램⭕ 에피소드❌) '
                elif item.plex_key.startswith('E'):
                    status_str += '(PLEX 프로그램⭕ 에피소드⭕) '
            else:
                status_str += '(PLEX 프로그램❌) '
                
            if item.download_status == 'True_by_plex_in_lib_multi_epi':
                status_str += '에피소드 멀티파일'
            elif item.download_status == 'False_by_plex_in_one_epi':
                status_str += '에피소드 이미 있음'
            elif item.download_status == 'True_by_plex_in_lib_no_epi':
                status_str += '에피소드 없음'
            elif item.download_status == 'True_blacklist':
                status_str += '블랙리스트에 없음'
            elif item.download_status == 'False_whitelist':
                status_str += '화이트리스트에 없음'
            elif item.download_status == 'False_except_program':
                status_str += '블랙리스트'
            elif item.download_status == 'True_whitelist_program':
                status_str += '화이트리스트'
            elif item.download_status == 'True_whitelist_first_epi':
                status_str += '첫번째 에피소드'
            elif item.download_status == 'False_no_meta':
                status_str += 'Daum 검색 실패'
            elif item.download_status == 'False_except_genre':
                status_str += '블랙리스트 장르'
            elif item.download_status == 'True_whitelist_genre':
                status_str += '화이트리스트 장르'
            elif item.download_status == 'False_not_allow_duplicate_episode':
                status_str += '중복 제외'
            elif item.download_status == 'False_exist_download_quality':
                status_str += '동일 화질 받음'
            elif item.download_status == 'False_not_match_condition_quality':
                status_str += '화질 조건 불일치'
            elif item.download_status == 'False_not_match_condition_include_keyword':
                status_str += '단어 포함 조건'
            elif item.download_status == 'False_match_condition_except_keyword':
                status_str += '단어 제외 조건'

            telegram_log += '결과 : %s\n' % status_str
            telegram_log += '파일명 : %s\n' % item.filename
            telegram_log += '%s/%s/list\n' % (SystemModelSetting.get('ddns'), package_name)
            #telegram_log += item.download_status + '\n'
            telegram_log += '로그\n' + item.log

            import framework.common.notify as Notify
            Notify.send_message(telegram_log, message_id='bot_downloader_ktv_result')

        except Exception as e: 
            logger.error('Exception:%s', e)
            logger.error(traceback.format_exc())