コード例 #1
0
    def plugin_load():
        try:
            logger.debug('%s plugin_load', package_name)
            Logic.db_init()
            LogicNormal.program_init()
            if ModelSetting.get_bool('auto_start'):
                Logic.scheduler_start()

            # tracker 자동 업데이트: 주기 1일
            if (datetime.now() -
                    datetime.strptime(ModelSetting.get('tracker_last_update'),
                                      '%Y-%m-%d')).days >= 1:
                trackers_url_from = 'https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best_ip.txt'
                new_trackers = requests.get(trackers_url_from).content.decode(
                    'utf8')
                if len(new_trackers.strip()) != 0:
                    ModelSetting.set('tracker_list', new_trackers)
                    ModelSetting.set('tracker_last_update',
                                     datetime.now().strftime('%Y-%m-%d'))
                    logger.debug('plugin:downloader: tracker downloaded: %s',
                                 ModelSetting.get('tracker_list'))

            # 편의를 위해 json 파일 생성
            from .plugin import plugin_info
            Util.save_from_dict_to_json(
                plugin_info,
                os.path.join(os.path.dirname(__file__), 'info.json'))
        except Exception as e:
            logger.error('Exception:%s', e)
            logger.error(traceback.format_exc())
コード例 #2
0
ファイル: logic.py プロジェクト: forumi0721/torrent_info
    def plugin_load():
        try:
            # DB 초기화
            Logic.db_init()

            # 편의를 위해 json 파일 생성
            from plugin import plugin_info
            Util.save_from_dict_to_json(
                plugin_info,
                os.path.join(os.path.dirname(__file__), 'info.json'))

            #
            # 자동시작 옵션이 있으면 보통 여기서
            #
            # 토렌트 캐쉬 초기화
            Logic.cache_init()

            # libtorrent 자동 설치
            new_build = int(
                plugin_info['install'].split('-')[-1].split('.')[0])
            installed_build = ModelSetting.get_int('libtorrent_build')
            if (new_build > installed_build) or (not Logic.is_installed()):
                Logic.install()

            # tracker 자동 업데이트
            tracker_update_every = ModelSetting.get_int('tracker_update_every')
            tracker_last_update = ModelSetting.get('tracker_last_update')
            if tracker_update_every > 0:
                if (datetime.now() -
                        datetime.strptime(tracker_last_update, '%Y-%m-%d')
                    ).days >= tracker_update_every:
                    Logic.update_tracker()
        except Exception as e:
            logger.error('Exception:%s', e)
            logger.error(traceback.format_exc())
コード例 #3
0
    def plugin_load():
        try:
            logger.debug('%s plugin_load', package_name)
            Logic.db_init()
            from .plugin import plugin_info
            Util.save_from_dict_to_json(plugin_info, os.path.join(os.path.dirname(__file__), 'info.json'))

            tmp = os.path.join(path_data, package_name)
            if not os.path.exists(tmp):
                os.makedirs(tmp)
            if not os.path.exists(ModelSetting.get('path_accounts')):
                os.makedirs(ModelSetting.get('path_accounts'))
            try:
                from google_auth_oauthlib.flow import InstalledAppFlow
            except:
                os.system("{} install google_auth_oauthlib".format(app.config['config']['pip']))
                from google_auth_oauthlib.flow import InstalledAppFlow

            tmp = os.path.join(os.path.dirname(__file__), 'bin')
            if os.path.exists(tmp):
                os.system('chmod 777 -R "%s"' % tmp)
            if ModelSetting.query.filter_by(key='gsheet_auto_start').first().value == 'True':
                Logic.scheduler_start()
        except Exception as e: 
            logger.error('Exception:%s', e)
            logger.error(traceback.format_exc())
コード例 #4
0
    def plugin_load():
        try:
            logger.debug('%s plugin_load', package_name)
            tmp = os.path.join(path_data, 'ivViewer_metadata')
            if not os.path.exists(tmp):
                os.makedirs(tmp)
                os.system('chmod 777 -R %s' % tmp)

            Logic.git_pull()
            if platform.system() != 'Windows':
                custom = os.path.join(
                    os.path.dirname(os.path.abspath(__file__)), 'files')
                os.system("chmod 777 -R %s" % custom)

            # DB 초기화
            Logic.db_init()

            # 편의를 위해 json 파일 생성
            from plugin import plugin_info
            Util.save_from_dict_to_json(
                plugin_info,
                os.path.join(os.path.dirname(__file__), 'info.json'))

            # 자동시작 옵션이 있으면 보통 여기서
            if ModelSetting.query.filter_by(
                    key='auto_start').first().value == 'True':
                Logic.scheduler_start()
        except Exception as e:
            logger.error('Exception:%s', e)
            logger.error(traceback.format_exc())
コード例 #5
0
def initialize():
    try:
        global use_av

        app.config['SQLALCHEMY_BINDS'][
            P.package_name] = 'sqlite:///%s' % (os.path.join(
                path_data, 'db',
                '{package_name}.db'.format(package_name=P.package_name)))
        from framework.util import Util
        Util.save_from_dict_to_json(
            P.plugin_info, os.path.join(os.path.dirname(__file__),
                                        'info.json'))

        from .logic_base import LogicBase
        from .logic_tv import LogicTv
        from .logic_mv import LogicMv
        from .logic_av import LogicAv

        if use_av:
            P.module_list = [LogicBase(P), LogicTv(P), LogicMv(P), LogicAv(P)]
        else:
            P.module_list = [LogicBase(P), LogicTv(P), LogicMv(P)]
        P.logic = Logic(P)
        default_route(P)

    except Exception as e:
        P.logger.error('Exception:%s', e)
        P.logger.error(traceback.format_exc())
コード例 #6
0
def initialize():
    try:
        app.config['SQLALCHEMY_BINDS'][
            P.package_name] = 'sqlite:///%s' % (os.path.join(
                path_data, 'db',
                '{package_name}.db'.format(package_name=P.package_name)))
        from framework.util import Util
        Util.save_from_dict_to_json(
            P.plugin_info, os.path.join(os.path.dirname(__file__),
                                        'info.json'))

        from .logic_ktv import LogicKtv
        from .logic_jav_censored import LogicJavCensored
        from .logic_jav_censored_ama import LogicJavCensoredAma
        from .logic_ott_show import LogicOttShow
        from .logic_movie import LogicMovie
        from .logic_ftv import LogicFtv
        P.module_list = [
            LogicKtv(P),
            LogicJavCensored(P),
            LogicJavCensoredAma(P),
            LogicOttShow(P),
            LogicMovie(P),
            LogicFtv(P)
        ]
        P.logic = Logic(P)
        default_route(P)
    except Exception as e:
        P.logger.error('Exception:%s', e)
        P.logger.error(traceback.format_exc())
コード例 #7
0
def initialize():
    try:
        app.config['SQLALCHEMY_BINDS'][
            P.package_name] = 'sqlite:///%s' % (os.path.join(
                path_data, 'db',
                '{package_name}.db'.format(package_name=P.package_name)))
        from framework.util import Util
        Util.save_from_dict_to_json(
            P.plugin_info, os.path.join(os.path.dirname(__file__),
                                        'info.json'))
        ###############################################
        from .logic_receive_av import LogicReceiveAV
        P.module_list = [LogicReceiveAV(P)]
        if app.config['config']['is_server'] == False and app.config['config'][
                'is_debug'] == False:
            del P.menu['sub'][1]
        #else:
        #    from .logic_vod import LogicVod
        #    P.module_list.append(LogicVod(P))
        ###############################################
        P.logic = Logic(P)
        default_route(P)
    except Exception as e:
        P.logger.error('Exception:%s', e)
        P.logger.error(traceback.format_exc())
コード例 #8
0
 def plugin_load():
     try:
         Logic.db_init()
         if ModelSetting.get_bool('auto_start'):
             Logic.scheduler_start()
         from .plugin import plugin_info
         Util.save_from_dict_to_json(plugin_info, os.path.join(os.path.dirname(__file__), 'info.json'))   
     except Exception as e: 
         logger.error('Exception:%s', e)
         logger.error(traceback.format_exc())
コード例 #9
0
ファイル: logic.py プロジェクト: soju6jan/tvheadend
 def plugin_load():
     try:
         Logic.db_init()
         from .plugin import plugin_info
         Util.save_from_dict_to_json(
             plugin_info,
             os.path.join(os.path.dirname(__file__), 'info.json'))
     except Exception as e:
         logger.error('Exception:%s', e)
         logger.error(traceback.format_exc())
コード例 #10
0
ファイル: plugin.py プロジェクト: wiserain/vnStat2
    def __init__(self):
        from framework import app, path_data
        db_file = os.path.join(path_data, 'db', f'{self.package_name}.db')
        app.config['SQLALCHEMY_BINDS'][
            self.package_name] = f'sqlite:///{db_file}'

        from framework.util import Util
        Util.save_from_dict_to_json(
            self.plugin_info,
            os.path.join(os.path.dirname(__file__), 'info.json'))
コード例 #11
0
ファイル: logic.py プロジェクト: wnd2da/smi2srt
 def plugin_load():
     try:
         Logic.db_init()
         if ModelSetting.query.filter_by(key='auto_start').first().value == 'True':
             Logic.scheduler_start()
         from plugin import plugin_info
         Util.save_from_dict_to_json(plugin_info, os.path.join(os.path.dirname(__file__), 'info.json'))
     except Exception as e: 
         logger.error('Exception:%s', e)
         logger.error(traceback.format_exc())
コード例 #12
0
ファイル: logic.py プロジェクト: k123s456h/gallery-dl
    def plugin_load():
        try:
            # DB 초기화
            Logic.db_init()

            # gallery-dl conf
            if not os.path.isfile(
                    os.path.join(os.path.dirname(os.path.abspath(__file__)),
                                 'gallery-dl.conf')):
                logger.debug(
                    "[gallery-dl] No config file found. Restoring default config..."
                )
                Logic.restore_setting()

            # bypass
            bypass = ModelSetting.get_bool('bypass')
            if bypass == True:
                Logic.bypass(daemon=True)

            # 편의를 위해 json 파일 생성
            from plugin import plugin_info
            Util.save_from_dict_to_json(
                plugin_info,
                os.path.join(os.path.dirname(__file__), 'info.json'))

            LogicQueue.queue_start()

            # 대기중인 item 다운로드
            entity_list = ModelGalleryDlItem.get_waiting_all()
            for entity in entity_list:
                LogicQueue.add_queue(entity.url)

            # hitomi 데이터 다운로드
            enable = ModelSetting.get_bool('enable_searcher')
            if enable == True:
                from datetime import datetime
                before = ModelSetting.get('hitomi_last_time')
                if (datetime.now() - datetime.strptime(
                        before, '%Y-%m-%d %H:%M:%S')).days >= 1:
                    t = threading.Thread(target=LogicHitomi.download_json,
                                         args=())
                    t.setDaemon(True)
                    t.start()

            # 자동시작 옵션이 있으면 보통 여기서
            if ModelSetting.get_bool('auto_start'):
                Logic.scheduler_start('normal')
                if enable == True:
                    Logic.scheduler_start('data')
                    Logic.scheduler_start('hitomi')

        except Exception as e:
            logger.error('[gallery-dl] Exception:%s', e)
            logger.error(traceback.format_exc())
コード例 #13
0
 def plugin_load():
     try:
         logger.info('%s plugin_load', package_name)
         Logic.db_init()
         # 편의를 위해 json 파일 생성
         from plugin import plugin_info
         Util.save_from_dict_to_json(
             plugin_info,
             os.path.join(os.path.dirname(__file__), 'info.json'))
     except Exception as e:
         logger.error('Exception:%s', e)
         logger.error(traceback.format_exc())
コード例 #14
0
ファイル: plugin.py プロジェクト: wiserain/torrent_info
    def __init__(self):
        from framework import app, path_data

        db_file = os.path.join(path_data, "db", f"{self.package_name}.db")
        app.config["SQLALCHEMY_BINDS"][
            self.package_name] = f"sqlite:///{db_file}"

        from framework.util import Util

        Util.save_from_dict_to_json(
            self.plugin_info,
            os.path.join(os.path.dirname(__file__), "info.json"))
コード例 #15
0
def initialize():
    try:
        app.config['SQLALCHEMY_BINDS'][
            P.package_name] = 'sqlite:///%s' % (os.path.join(
                path_data, 'db',
                '{package_name}.db'.format(package_name=P.package_name)))
        from framework.util import Util
        Util.save_from_dict_to_json(
            P.plugin_info, os.path.join(os.path.dirname(__file__),
                                        'info.json'))
    except Exception as e:
        P.logger.error('Exception:%s', e)
        P.logger.error(traceback.format_exc())
コード例 #16
0
def initialize():
    try:
        app.config['SQLALCHEMY_BINDS'][P.package_name] = 'sqlite:///%s' % (os.path.join(path_data, 'db', '{package_name}.db'.format(package_name=P.package_name)))
        from framework.util import Util
        Util.save_from_dict_to_json(P.plugin_info, os.path.join(os.path.dirname(__file__), 'info.json'))
        from .logic_podbbang import LogicPodbbang
        from .logic_google import LogicGoogle

        P.module_list = [LogicPodbbang(P), LogicGoogle(P)]
        P.logic = Logic(P)
        default_route(P)
    except Exception as e: 
        P.logger.error('Exception:%s', e)
        P.logger.error(traceback.format_exc())
コード例 #17
0
    def plugin_load():
        try:
            Logic.db_init()
            from plugin import plugin_info
            Util.save_from_dict_to_json(plugin_info, os.path.join(os.path.dirname(__file__), 'info.json'))   

            def func():
                LogicKlive.channel_load_from_site()
            t = threading.Thread(target=func, args=())
            t.setDaemon(True)
            t.start()
        except Exception as e: 
            logger.error('Exception:%s', e)
            logger.error(traceback.format_exc())
コード例 #18
0
ファイル: logic.py プロジェクト: wordian/rss2
    def plugin_load():
        try:
            logger.debug('%s plugin_load', package_name)
            # DB 초기화
            Logic.db_init()
            Logic.migration()
            if ModelSetting.get_bool('auto_start'):
                Logic.scheduler_start()

            # 편의를 위해 json 파일 생성
            from .plugin import plugin_info
            Util.save_from_dict_to_json(plugin_info, os.path.join(os.path.dirname(__file__), 'info.json'))
        except Exception as e:
            logger.error('Exception:%s', e)
            logger.error(traceback.format_exc())
コード例 #19
0
    def plugin_load():
        try:
            logger.debug('%s plugin_load', package_name)
            Logic.db_init()
            #if ModelSetting.query.filter_by(key='auto_start').first().value == 'True':
            #    Logic.scheduler_start()
            # 편의를 위해 json 파일 생성
            from .plugin import plugin_info
            Util.save_from_dict_to_json(
                plugin_info,
                os.path.join(os.path.dirname(__file__), 'info.json'))

            LogicNormal.proxy_init()
        except Exception as e:
            logger.error('Exception:%s', e)
            logger.error(traceback.format_exc())
コード例 #20
0
ファイル: logic.py プロジェクト: byorial/static_host
    def plugin_load():
        try:
            # DB 초기화
            Logic.db_init()

            # 편의를 위해 json 파일 생성
            from .plugin import plugin_info
            Util.save_from_dict_to_json(plugin_info, os.path.join(os.path.dirname(__file__), 'info.json'))

            #
            # 자동시작 옵션이 있으면 보통 여기서
            #
            Logic.register_rules(ModelSetting.get_json('rules'))
        except Exception as e:
            logger.error('Exception:%s', e)
            logger.error(traceback.format_exc())
コード例 #21
0
ファイル: logic.py プロジェクト: joyfuI/youtube-dl
    def plugin_load():
        try:
            logger.debug('%s plugin_load', package_name)
            Logic.db_init()

            # youtube-dl 업데이트
            youtube_dl = LogicNormal.get_youtube_dl_package(ModelSetting.get('youtube_dl_package'))
            logger.debug('%s upgrade' % youtube_dl)
            logger.debug(subprocess.check_output([sys.executable, '-m', 'pip', 'install', '--upgrade', youtube_dl],
                                                 universal_newlines=True))

            # 편의를 위해 json 파일 생성
            from .plugin import plugin_info
            Util.save_from_dict_to_json(plugin_info, os.path.join(os.path.dirname(__file__), 'info.json'))
        except Exception as e:
            logger.error('Exception:%s', e)
            logger.error(traceback.format_exc())
コード例 #22
0
    def plugin_load():
        try:
            Logic.db_init()
            if ModelSetting.get_bool('auto_start'):
                Logic.scheduler_start()
            else:
                #Logic.one_execute()
                pass
            from .plugin import plugin_info
            Util.save_from_dict_to_json(plugin_info, os.path.join(os.path.dirname(__file__), 'info.json'))   

            # 리턴안되는 문제 발생
            #from framework.common.util import SJVASupportControl
            #tmp = SJVASupportControl.epg_refresh()
            #logger.debug('EPG 결과 : %s', tmp)
        except Exception as e: 
            logger.error('Exception:%s', e)
            logger.error(traceback.format_exc())
コード例 #23
0
    def plugin_load():
        try:
            if platform.system() != 'Windows':
                custom = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'guacamole')    
                os.system("chmod 777 -R %s" % custom)

            logger.debug('%s plugin_load', package_name)
            # DB 초기화 
            Logic.db_init()

            # 편의를 위해 json 파일 생성
            from plugin import plugin_info
            Util.save_from_dict_to_json(plugin_info, os.path.join(os.path.dirname(__file__), 'info.json'))

            # 자동시작 옵션이 있으면 보통 여기서 
            if ModelSetting.query.filter_by(key='auto_start').first().value == 'True':
                Logic.scheduler_start()
        except Exception as e: 
            logger.error('Exception:%s', e)
            logger.error(traceback.format_exc())
コード例 #24
0
    def plugin_load():
        try:
            logger.debug('%s plugin_load', package_name)
            # DB 초기화
            Logic.db_init()

            # 편의를 위해 json 파일 생성
            from .plugin import plugin_info
            Util.save_from_dict_to_json(
                plugin_info,
                os.path.join(os.path.dirname(__file__), 'info.json'))

            # 기타 자동시작 옵션
            is_installed = Logic.is_installed()
            if not is_installed or not any(
                    x in is_installed
                    for x in plugin_info['supported_vnstat_version']):
                Logic.install(show_modal=False)
        except Exception as e:
            logger.error('Exception:%s', e)
            logger.error(traceback.format_exc())
コード例 #25
0
    def plugin_load():
        try:
            logger.debug('%s plugin_load', package_name)
            # DB 초기화
            Logic.db_init()

            # 필요 패키지 설치
            try:
                from bs4 import BeautifulSoup
                import cfscrape
                from discord_webhook import DiscordWebhook
            except:
                try:
                    os.system('pip install -r %s' % os.path.join(
                        os.path.dirname(__file__), 'requirements.txt'))
                except:
                    logger.error('pip install error!!')
                    pass

            # 다운로드 폴더 생성
            download_path = Logic.get_setting_value('dfolder')
            if not os.path.exists(download_path):
                try:
                    os.mkdir(download_path)
                except:
                    logger.error('donwload_path make error!!')
            # 편의를 위해 json 파일 생성
            from plugin import plugin_info
            Util.save_from_dict_to_json(
                plugin_info,
                os.path.join(os.path.dirname(__file__), 'info.json'))

            # 자동시작 옵션이 있으면 보통 여기서
            if ModelSetting.query.filter_by(
                    key='auto_start').first().value == 'True':
                Logic.scheduler_start()
        except Exception as e:
            logger.error('Exception:%s', e)
            logger.error(traceback.format_exc())
コード例 #26
0
    def plugin_load():
        try:
            logger.debug('%s plugin_load', package_name)
            # DB 초기화
            Logic.db_init()

            if ModelSetting.get('auto_start') == 'True':
                Logic.scheduler_start()

            ### edit by lapis
            if ModelSetting.get('program_auto_download_failed') == 'True':
                LogicProgram.retry_download_failed()
            ###

            # 편의를 위해 json 파일 생성
            from .plugin import plugin_info
            Util.save_from_dict_to_json(
                plugin_info,
                os.path.join(os.path.dirname(__file__), 'info.json'))
        except Exception as e:
            logger.error('Exception:%s', e)
            logger.error(traceback.format_exc())
コード例 #27
0
 def plugin_load():
     # 편의를 위해 json 파일 생성
     from .plugin import plugin_info
     Util.save_from_dict_to_json(
         plugin_info, os.path.join(os.path.dirname(__file__), 'info.json'))