Esempio n. 1
0
def IkaUI_main():
    IkaUtils.dprint(_('Hello!'))

    application = wx.App()
    input_plugin = VideoCapture()

    engine = IkaEngine(keep_alive=True)
    engine.close_session_at_eof = True
    engine.set_capture(input_plugin)

    # 設定画面を持つ各種 Output Plugin
    # -> 設定画面の生成とプラグインリストへの登録
    outputs_with_gui = [
        outputs.CSV(),
        # outputs.Fluentd(),
        outputs.JSON(),
        # outputs.Hue(),
        outputs.OBS(),
        outputs.Twitter(),
        outputs.Screenshot(),
        outputs.Boyomi(),
        outputs.Slack(),
        outputs.StatInk(),
        outputs.DebugVideoWriter(),
        outputs.WebSocketServer(),
    ]
    gui = IkaLogGUI(engine, outputs_with_gui)

    plugins = []

    # とりあえずデバッグ用にコンソールプラグイン
    plugins.append(outputs.Console())

    # 各パネルをプラグインしてイベントを受信する
    plugins.append(gui.preview)
    plugins.append(gui.last_result)

    # 設定画面を持つ input plugin もイベントを受信する
    plugins.append(input_plugin)

    # UI 自体もイベントを受信
    plugins.append(gui)

    plugins.extend(outputs_with_gui)

    # 本当に困ったときのデバッグログ増加モード
    if 'IKALOG_DEBUG' in os.environ:
        plugins.append(outputs.DebugLog())

    # プラグインリストを登録
    engine.set_plugins(plugins)

    gui.run()
    application.MainLoop()

    IkaUtils.dprint(_('Bye!'))
Esempio n. 2
0
def _init_outputs(opts):
    # 使いたいプラグインを適宜設定
    OutputPlugins = []

    output_plugins = IkaConfig.OUTPUT_PLUGINS

    # Set output_args with command line options.
    output_args = IkaConfig.OUTPUT_ARGS.copy()

    vars = {'__INPUT_FILE__': opts.get('input_file', '__INPUT_FILE__')}

    # Screen: IkaLog 実行中にキャプチャ画像を表示します。
    if 'Screen' in output_plugins:
        args = _replace_vars(output_args['Screen'], vars)
        OutputPlugins.append(outputs.Screen(**args))

    # Console(): 各種メッセージを表示します。
    if 'Console' in output_plugins:
        args = _replace_vars(output_args['Console'], vars)
        OutputPlugins.append(outputs.Console(**args))

    # IkaOutput_CSV: CSVログファイルを出力します。
    if 'CSV' in output_plugins:
        args = _replace_vars(output_args['CSV'], vars)
        OutputPlugins.append(outputs.CSV(**args))

    # Fluentd: Fluentd にデータを投げます。
    if 'Fluentd' in output_plugins:
        args = _replace_vars(output_args['Fluentd'], vars)
        OutputPlugins.append(outputs.Fluentd(**args))

    if 'Hue' in output_plugins:
        args = _replace_vars(output_args['Hue'], vars)
        OutputPlugins.append(outputs.Hue(**args))

    # JSON: JSONログファイルを出力します。
    if ('JSON' in output_plugins) or opts.get('output_json'):
        if opts.get('output_json'):
            output_args['JSON']['json_filename'] = opts['output_json']
        args = _replace_vars(output_args['JSON'], vars)
        OutputPlugins.append(outputs.JSON(**args))

    # Screenshot: 戦績画面のスクリーンショットを保存します。
    if 'Screenshot' in output_plugins:
        args = _replace_vars(output_args['Screenshot'], vars)
        OutputPlugins.append(outputs.Screenshot(**args))

    # Slack: Slack 連携
    if 'Slack' in output_plugins:
        args = _replace_vars(output_args['Slack'], vars)
        OutputPlugins.append(outputs.Slack(**args))

    # StatInk: stat.ink (スプラトゥーンプレイ実績投稿サイト)
    if 'StatInk' in output_plugins:
        if opts.get('video_id'):
            output_args['StatInk']['video_id'] = opts['video_id']
        if opts.get('statink_payload'):
            output_args['StatInk']['payload_file'] = opts['statink_payload']

        args = _replace_vars(output_args['StatInk'], vars)
        OutputPlugins.append(outputs.StatInk(**args))

    # Twitter: Twitter 連携
    if 'Twitter' in output_plugins:
        args = _replace_vars(output_args['Twitter'], vars)
        OutputPlugins.append(outputs.Twitter(**args))

    # WebSocket サーバ
    if 'WebSocket' in output_plugins:
        args = _replace_vars(output_args['WebSocket'], vars)
        OutputPlugins.append(outputs.WebSocket(**args))

    # REST API Server
    if 'RESTAPIServer' in output_plugins:
        OutputPlugins.append(
            outputs.RESTAPIServer(**output_args['RESTAPIServer']))

    # Video description for YouTube. It is expected to be used with
    # input.CVFile. Multiple matches in a video is not tested.
    #
    # YouTube 用、動画の概要。input.CVFile と組み合わせた使用を想定。
    # ビデオ内に複数のゲームがある場合には未検証。
    if (('Description' in output_plugins) or opts.get('output_description')):

        if opts.get('output_description'):
            output_args['Description']['output_filepath'] = (
                opts['output_description'])
        args = _replace_vars(output_args['Description'], vars)
        OutputPlugins.append(outputs.Description(**args))

    # 不具合調査向け。
    # イベントトリガをコンソールに出力。イベントトリガ時のスクリーンショット保存
    if (('DebugLog' in output_plugins) or opts.get('debug')):
        args = _replace_vars(output_args['DebugLog'], vars)
        OutputPlugins.append(outputs.DebugLog(**args))

    # 不具合調査向け。
    # ウインドウに対して v キー押下でデバッグ録画を開始する
    if 'DebugVideoWriter' in output_plugins:
        args = _replace_vars(output_args['DebugVideoWriter'], vars)
        OutputPlugins.append(outputs.DebugVideoWriter(**args))

    # PreviewDetected: 認識した画像をプレビュー上でマークする
    if 'PreviewDetected' in output_plugins:
        args = _replace_vars(output_args['PreviewDetected'], vars)
        OutputPlugins.append(outputs.PreviewDetected(**args))

    return OutputPlugins
Esempio n. 3
0
if __name__ == "__main__":
    IkaUtils.dprint(_('Hello!'))

    application = wx.App()
    input_plugin = VideoCapture()
    gui = IkaLogGUI()
    input_plugin.on_option_tab_create(gui.options.notebookOptions)
    gui.frame.Show()

    engine = gui.create_engine()
    engine.close_session_at_eof = True
    engine.set_capture(input_plugin)
    plugins = []

    # とりあえずデバッグ用にコンソールプラグイン
    plugins.append(outputs.Console())

    # 各パネルをプラグインしてイベントを受信する
    plugins.append(gui.preview)
    plugins.append(gui.last_result)
    plugins.append(gui.timeline)

    # 設定画面を持つ input plugin もイベントを受信する
    plugins.append(input_plugin)

    # UI 自体もイベントを受信
    plugins.append(gui)

    # 設定画面を持つ各種 Output Plugin
    # -> 設定画面の生成とプラグインリストへの登録
    for plugin in [
Esempio n. 4
0
def IkaUI_main():
    IkaUtils.dprint(_('Hello!'))

    application = wx.App()
    input_plugin = VideoCapture()
    gui = IkaLogGUI()
    input_plugin.on_option_tab_create(gui.options.notebookOptions)
    gui.frame.Show()

    engine = gui.create_engine()
    engine.close_session_at_eof = True
    engine.set_capture(input_plugin)
    plugins = []

    # とりあえずデバッグ用にコンソールプラグイン
    plugins.append(outputs.Console())

    # 各パネルをプラグインしてイベントを受信する
    plugins.append(gui.preview)
    plugins.append(gui.last_result)
    plugins.append(gui.timeline)

    # 設定画面を持つ input plugin もイベントを受信する
    plugins.append(input_plugin)

    # UI 自体もイベントを受信
    plugins.append(gui)

    # 設定画面を持つ各種 Output Plugin
    # -> 設定画面の生成とプラグインリストへの登録
    for plugin in [
            outputs.CSV(),
            # outputs.Fluentd(),
            outputs.JSON(),
            # outputs.Hue(),
            outputs.OBS(),
            outputs.Twitter(),
            outputs.Screenshot(),
            outputs.Boyomi(),
            outputs.Slack(),
            outputs.StatInk(),
            outputs.DebugVideoWriter(),
            outputs.WebSocketServer(),
    ]:
        print('Initializing %s' % plugin)
        plugin.on_option_tab_create(gui.options.notebookOptions)
        plugins.append(plugin)

    # 本当に困ったときのデバッグログ増加モード
    if 'IKALOG_DEBUG' in os.environ:
        plugins.append(outputs.DebugLog())

    # プラグインリストを登録
    engine.set_plugins(plugins)

    # IkaLog GUI 起動時にキャプチャが enable 状態かどうか
    gui.set_enable(True)

    # Loading config
    engine.call_plugins('on_config_reset', debug=True)
    gui.load_config(engine.context)
    engine.call_plugins('on_config_load_from_context', debug=True)

    gui.start_engine()
    application.MainLoop()

    IkaUtils.dprint(_('Bye!'))