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())
Example #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())
Example #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())
Example #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())
Example #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())
Example #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())