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