2016年12月23日金曜日

IkaLogの棒読みちゃん連携機能で、CeVIOを使った読み上げにチャレンジしてみました。

「CeVIO Creative Studio S」というソフトが30日間無料体験&棒読みちゃん連携ができるということで、IkaLogと組み合わせるとどんな感じになるか試してみました。
※ トークスターターですが、正式に さとうささら さんをお迎えしました! (2016年12月25日追記)

※ あまり需要が無いかもしれませんが、もったいない精神ということで。

こんな感じになりました。 ※へちょプレイ注意

さとうささら さん


すずきつづみ さん


棒読みちゃん





CeVIO Creative Studio S
バージョン5.1ベータテスト版があったので、こちらを導入しました。 


いじっていて気がついたのですが、CeVIOをインストールすると、そのまま棒読みちゃんから使えるようになるみたいです。
勘違いしていました。訂正します。 ( 2016年12月25日追記 )

棒読みちゃんCeVIO連携は、「棒読みちゃんスティッカム公式プラグイン」を利用させていただきました。




音声認識や音声合成系のソフトに興味がでて色々試しているのですが、想像以上によく出来ていて触っていて楽しいです。


2016年11月20日日曜日

最新のIkaLog CLI版で、棒読みちゃん・みくみくまうす連動で喋らせるイベントが追加されました。

最新のIkaLog CLI版で、棒読みちゃん・みくみくまうす連動で喋らせるイベントが追加されました。


いろいろざっくり過ぎて申し訳ありませんが、参考程度に。

IkaLog\tools\commentator.csvを編集すれば、セリフを簡単に書き換えられます。


書いておいてあれなのですが、既に対応するセリフは標準で追加されていました。
↓ こちらが正式なものです。
https://github.com/hasegaw/IkaLog/blob/master/tools/commentator.csv

調べてから書けばよかった、ごめんなさい。


今回追加されたのは、スペシャル満タン、自分のスペシャル利用、味方チームのスペシャル利用、インク切れです。

こんな感じで追加すれば大丈夫だと思います。

special_charged,スペシャル満タン,happy
my_special_weapon,自分のスペシャル利用,wktk
mate_special_weapon,味方のスペシャル利用,wktk
low_ink,インクぎれ,bikkuri



現在、みくみくまうすを別のPCで同時録画して、AviUtlで合成しようとやっています。
みくみくまうす側の設定を、ひょっとして127.0.0.1以外にしても有効にならないっぽい?のに気づくのにかなり遅くなって涙目です。

※ 何か設定方法があるのかも知れませんが、見つけられませんでした。
127.0.0.1のみが、安全だからかなぁと思っています。



2016年11月17日木曜日

IkaLog + 棒読みちゃん のセリフに スペシャル発動とインク切れを追加してみました

注意 (追記 2016年11月18日)
この記事は IkaLog CLI版 を対象にしていますが、現在のバージョンではセリフの追加が簡単になっていますので、参考程度にお読みください。

IkaLog+棒読みちゃんで、セリフをしゃべらせるイベントを増やす方法が何となく分かったので書いてみます。

  • 素人がソースを読んで勝手にいじって書いています。
  • 用語の間違いや勘違いをしてる事があるかもしれませんが、その辺りを含めてイカよろしくおねがいします。

やったこと

  • IkaLog + 棒読みちゃんで喋らせている内容は、IkaLog\ikalog\outputs\commentator.py というファイルに、イベントと対応するセリフを記入するようになっているっぽいです。
  • 見たところ、on_game_なんとか とあるのがイベントで、CommentatorDictionary()にセリフな感じです。
  • イベントは、stat.inkさん向けのデータを作ってる statink.py に書いてあるのが使えそうな気がしたので、on_game_special_weapon と on_game_low_ink をコピペしてみました。

ファイルの最後にイベントを追加し、対応するセリフも追加、他のセリフもいくつか変更してみました。

注意事項
個人的にガチマッチに行かないので、キルデスから塗りポイントにセリフを入れ替えました。
ガチマッチに行かれる方は、変更箇所をオリジナルに戻してください。 

※この部分を
'individual_kill_death': [
    {'text': 'こんかいのバトルで {score} ポイント もらえました', 'emotion': 'none'},
        ↓ に書き換えてください。
    {'text': '{kill}キル{death}デス', 'emotion': 'none'},
 ],


#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
#  IkaLog
#  ======
#  Copyright (C) 2015 ExceptionError
#  Copyright (C) 2015 Takeshi HASEGAWA
#  Copyright (C) 2015 AIZAWA Hina
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
#

import json
import random
import select
import socket
import sys
import traceback
import threading

from ikalog.constants import *
from ikalog.utils import *

class CommentatorDictionary(object):
    '''
    実況アプリ用辞書

    emotionは適当に決めてください:
    http://mikumikumouth.net/developer.html#emotion一覧
    '''

        # 個人的にガチマッチに行かないので、キルデスから塗りポイントにセリフを入れ替えました。
        # このままガチマッチに使うとスコアが0ポイントになってしまうと思うので、駄目な人はオリジナルに戻してください。

        # 'individual_kill_death': [
        #     {'text': '{kill}キル{death}デス', 'emotion': 'none'},
        # ],

    _config = {
        'initialize': [
            {'text': '読み上げテストです', 'emotion': 'salute'},
        ],
        'lobby_matching': [
            {'text': 'しばらく待ちましょう', 'emotion': 'response'},
        ],
        'lobby_matched': [
            {'text': 'メンバーが揃いました', 'emotion': 'hakushu'},
        ],
        'start': [
            {
                'text': '{map}で{rule}が始まります',
                'emotion': 'greeting',
            },
        ],
        'go_sign': [
            {'text': 'しあいかいし! みんな よろしくね', 'emotion': 'meirei'},
        ],
        'killed': [
            {'text': '撃破したわ', 'emotion': 'warai'},
            {'text': 'やったわ!', 'emotion': 'wktk'},
        ],
        'dead': [
            {'text': 'こうどうふのお', 'emotion': 'no'},
            {'text': 'しまった!', 'emotion': 'cry'},
            {'text': 'やあぁらあぁれえぇたあぁ', 'emotion': 'bikkuri'},
        ],
        'death_reason_identified': [
            {'text': '{reason} で やられた!', 'emotion': 'none'}
        ],
        'death_reason_oob': [
            {'text': 'はぁいはい ど;おせそどこですよぉ', 'emotion': 'bikkuri'},
        ],
        'finish': [
            {'text': 'しあいしゅうりょお!', 'emotion': 'greeting'},
        ],
        'individual_result_win': [
            {'text': 'かちました! チームのみんな ありがとう', 'emotion': 'happy'},
            {'text': 'かてました! チームのみんな ありがとう', 'emotion': 'shy'},
        ],
        'individual_result_lose': [
            {'text': 'まけちゃった…', 'emotion': 'no'},
            {'text': "ざんねんです む'ねんです", 'emotion': 'cry'},
        ],
        'individual_result_unknown': [
            {'text': 'よくわからない', 'emotion': 'question'},
            {'text': 'どういうこと?', 'emotion': 'tsukkomi'},
        ],
        'individual_kill_death': [
            {'text': 'こんかいのバトルで {score} ポイント もらえました', 'emotion': 'none'},
        ],
        'session_end': [
            {'text': 'おつかれさまでした', 'emotion': 'byebye'},
        ],
        'session_abort': [
            {'text': 'ゲームを見失いました', 'emotion': 'byebye'},
        ],
        'ranked_we_lead': [
            {'text': 'カウントリードした', 'emotion': 'hakushu'},
            {'text': 'このまま行けば勝てるぞ', 'emotion': 'wktk'},
        ],
        'ranked_they_lead': [
            {'text': 'カウントリードされた', 'emotion': 'cry'},
            {'text': 'このままでは負けるぞ', 'emotion': 'no'},
        ],
        'splatzone_we_got': [
            {'text': 'エリア確保した', 'emotion': 'hakushu'},
            {'text': 'エリア確保!', 'emotion': 'wktk'},
        ],
        'splatzone_we_lost': [
            {'text': 'カウントストップされた', 'emotion': 'bikkuri'},
            {'text': 'エリアを失った', 'emotion': 'notsay'},
        ],
        'splatzone_they_got': [
            {'text': 'エリア確保された', 'emotion': 'bikkuri'},
            {'text': 'エリアを取られた', 'emotion': 'notsay'},
        ],
        'splatzone_they_lost': [
            {'text': 'カウントストップした', 'emotion': 'warai'},
            {'text': '食い止めた!', 'emotion': 'happy'},
        ],
        'tower_we_got': [
            {'text': 'ヤグラゲット', 'emotion': 'hakushu'},
            {'text': 'ヤグラわ我らのもの', 'emotion': 'response'},
            {'text': 'ソイヤ!', 'emotion': 'wktk'},
        ],
        'tower_we_lost': [
            {'text': 'ヤグラがやられた', 'emotion': 'bikkuri'},
            {'text': 'ヤグラを失った', 'emotion': 'notsay'},
        ],
        'tower_they_got': [
            {'text': 'ヤグラをとられた', 'emotion': 'cry'},
        ],
        'tower_they_lost': [
            {'text': 'ヤグラをとめた', 'emotion': 'hakushu'},
            {'text': 'ヤグラをストップした', 'emotion': 'warai'},
            {'text': '食い止めた!', 'emotion': 'happy'},
        ],
        'rainmaker_we_got': [
            {'text': 'ほこゲット', 'emotion': 'hakushu'},
            {'text': 'ホコわ我らのもの', 'emotion': 'wktk'},
        ],
        'rainmaker_we_lost': [
            {'text': 'ホコがやられた', 'emotion': 'bikkuri'},
            {'text': 'ホコを失った', 'emotion': 'notsay'},
        ],
        'rainmaker_they_got': [
            {'text': 'ホコをとられた', 'emotion': 'cry'},
        ],
        'rainmaker_they_lost': [
            {'text': 'ホコをとめた', 'emotion': 'hakushu'},
            {'text': 'ホコをストップした', 'emotion': 'warai'},
            {'text': '食い止めた!', 'emotion': 'happy'},
        ],
        'my_special_weapon': [
            {'text': 'でっかいからって ;いぃ;いきにならないでよ', 'emotion': 'happy'},
        ],
        'low_ink': [
            {'text': 'インクっ', 'emotion': 'bikkuri'},
        ],
    }

    
    def __init__(self, config):
        for key in self._config.keys():
            if key in config:
                self._config[key] = config[key]

    def data(self, key):
        return random.choice(self._config.get(key, [''])).copy()

    def get_config(self):
        return self._config


class Commentator(object):
    '''
    実況者基底クラス
    '''
    custom_read = {
        '52gal': 'ごーにーガロン',
        '52gal_deco': 'ごーにーガロンデコ',
        '96gal': 'きゅーろくガロン',
        '96gal_deco': 'きゅーろくガロンデコ',
        'nzap85': 'エヌザップ85',
        'nzap89': 'エヌザップ89',
        'bamboo14mk1': 'ひとよん式竹筒じゅう・こう',
        'bamboo14mk2': 'ひとよん式竹筒じゅう・おつ',
        'bamboo14mk3': 'ひとよん式竹筒じゅう・へい',
        'liter3k': 'リッター3ケー',
        'liter3k_custom': 'リッター3ケーカスタム',
        'liter3k_scope': '3ケースコープ',
        'liter3k_scope_custom': '3ケースコープカスタム',
        'promodeler_rg': 'プロモデラーアールジー',
        'promodeler_mg': 'プロモデラーエムジー',
        'squiclean_a': 'スクイックリンアルファ',
        'squiclean_b': 'スクイックリンベータ',
        'squiclean_g': 'スクイックリンガンマ',
        'rapid_elite': 'ラピッドブラスターエリート',
        'rapid_elite_deco': 'ラピッドブラスターエリートデコ',
        'unknown': '未知の武器',
    }

    def __init__(self, dictionary={}):
        self._enabled = True
        self._dict = CommentatorDictionary(dictionary)

    def set_config(self, config):
        dictionary = config.get(self.config_key(), {})
        self._dict = CommentatorDictionary(dictionary)

    def get_config(self, config):
        commentator = self._dict.get_config()
        config[self.config_key()] = commentator
        return config

    def _read(self, message):
        if (not self._enabled):
            return

        try:
            self._do_read(message)
        except ConnectionRefusedError:
            error = '「{message}」を読み上げることができませんでした'.format(message=message['text'])
            IkaUtils.dprint(error)

    def _do_read(self, message):
        return

    def _get_message(self, key):
        return self._dict.data(key)

    def _read_event(self, key):
        self._read(self._get_message(key))

    def on_lobby_matching(self, context):
        self._read_event('lobby_matching')

    def on_lobby_matched(self, context):
        self._read_event('lobby_matched')

    def on_game_start(self, context):
        map_text = IkaUtils.map2text(context['game']['map'], unknown='スプラトゥーン')
        rule_text = IkaUtils.rule2text(context['game']['rule'], unknown='ゲーム')
        data = self._get_message('start')
        data['text'] = data['text'].format(map=map_text, rule=rule_text)
        self._read(data)

    def on_game_go_sign(self, context):
        self._read_event('go_sign')

    def on_game_killed(self, context, params):
        self._read_event('killed')

    def on_game_dead(self, context):
        self._read_event('dead')

    def on_game_death_reason_identified(self, context):
        reason = context['game']['last_death_reason']
        if reason in oob_reasons:
            data = self._get_message('death_reason_oob')
        else:
            label = self._death_reason_label(reason)
            data = self._get_message('death_reason_identified')
            data['text'] = data['text'].format(reason=label)
        self._read(data)

    def _death_reason_label(self, reason):
        if reason in self.custom_read:
            return self.custom_read[reason]
        return IkaUtils.death_reason2text(
            reason, self.custom_read['unknown'], 'ja')

    def on_game_finish(self, context):
        self._read_event('finish')

    def on_game_individual_result(self, context):
        map = IkaUtils.map2text(context['game']['map'])
        rule = IkaUtils.rule2text(context['game']['rule'])
        won = IkaUtils.getWinLoseText(
            context['game']['won'],
            win_text=self._get_message('individual_result_win'),
            lose_text=self._get_message('individual_result_lose'),
            unknown_text=self._get_message('individual_result_unknown')
        )
        self._read(won)
        me = IkaUtils.getMyEntryFromContext(context)
        kill = me['kills']
        death = me['deaths']

        score = 0
        if not me['score'] is None:
            score = me['score']

        data = self._get_message('individual_kill_death')
        data['text'] = data['text'].format(kill=kill, death=death, score=score)
            
        self._read(data)

    def on_game_session_end(self, context):
        self._read_event('session_end')

    def on_game_session_abort(self, context):
        self._read_event('session_abort')

    def on_game_ranked_we_lead(self, context):
        self._read_event('ranked_we_lead')

    def on_game_ranked_they_lead(self, context):
        self._read_event('ranked_they_lead')

    def on_game_splatzone_we_got(self, context):
        self._read_event('splatzone_we_got')

    def on_game_splatzone_we_lost(self, context):
        self._read_event('splatzone_we_lost')

    def on_game_splatzone_they_got(self, context):
        self._read_event('splatzone_they_got')

    def on_game_splatzone_they_lost(self, context):
        self._read_event('splatzone_they_lost')

    def on_game_rainmaker_we_got(self, context):
        self._read_event('rainmaker_we_got')

    def on_game_rainmaker_we_lost(self, context):
        self._read_event('rainmaker_we_lost')

    def on_game_rainmaker_they_got(self, context):
        self._read_event('rainmaker_they_got')

    def on_game_rainmaker_they_lost(self, context):
        self._read_event('rainmaker_they_lost')

    def on_game_tower_we_got(self, context):
        self._read_event('tower_we_got')

    def on_game_tower_we_lost(self, context):
        self._read_event('tower_we_lost')

    def on_game_tower_they_got(self, context):
        self._read_event('tower_they_got')

    def on_game_tower_they_lost(self, context):
        self._read_event('tower_they_lost')

    #
    # スペシャル判定を追加 statink.py から引用
    def _get_offset_msec(self, context):
        if (context['engine'].get('msec') and
            context['game'].get('start_offset_msec')):
            return (context['engine']['msec'] -
                    context['game']['start_offset_msec'])
        return None

    #
    def on_game_special_weapon(self, context):
        special_weapon = context['game'].get('special_weapon', None)
        if not (special_weapon in special_weapons.keys()):
            IkaUtils.dprint('%s: special_weapon %s is invalid.' %
                            (self, special_weapon))
            return

        event_msec = self._get_offset_msec(context)
        if event_msec:
            #自分のスペシャルか判定
            if context['game'].get('special_weapon_is_mine', False):
                self._read_event('my_special_weapon')

    def on_game_low_ink(self, context):
        self._read_event('low_ink')




こんな感じになりました。

相変わらずへたっぴプレイなのですが…



みくみくまうす連動も動きました。


















動画配信は、これを元にクロマキー合成するそうです。

みくみくまうすの連動のみで、みくみくまうすが棒読みちゃんを制御してくれるみたいです。
最初、2つとも有効にしてたのですが、同じ読み上げを2回するので???ってなりました。

本当に遅ればせながら棒読みちゃんを試してみたのですが、想像以上にしっかり喋るので驚きました。
声の感じをいじったり、セリフを考えたりするのも楽しいです。
VOICEROIDというのがあるみたいですが、そど子の中の人である声優の井澤詩織さんのバージョンをリリースして欲しいです。


最後になりましたが、IkaLogさん stat.inkさん 棒読みちゃんさん みくみくまうすさん ありがとうございます。

2016年8月20日土曜日

AutoITの環境に依存しなくて済むように ControlAmarecTV.au3 を exe ファイルに変換する方法

はじめに

  • IkaLogさんとstat.inkさんを応援しています。
  • 手元で実際に試したことを書いているだけです。
  • 趣味のレベルでやってるだけなので難しいことは分かりません。
  • もっと良い感じのがあれば教えていただけると助かります。
  • インストール先など、個々の環境に依存する事は脳内補完してください。

ざっくりとですが、イカよろしくお願いします。


どうする?

  • .au3の関連付けが外れたのか設定出来てないのかで動いてなさそうな感じがありそうな雰囲気がするトラブルをみかけたので。

なにする?

  • .au3のファイルをexeに変換します。 AutoITに依存しないで exe単体で動くようになるっぽい!

・.au3を exeに変換するツールは標準でインストールされています。たぶん。


C:\Program Files (x86)\AutoIt3\Aut2Exe\Aut2exe.exe












・こんな感じのウインドが出ます。
・Browseボタンを押して、exeにしたい ControlAmarecTV.au3 を指定します。




・自動的にexeファイルのパス枠が埋まると思うので、 Convertボタンを押します。





















・exeファイル化されているか確認











・IkaLogの設定を exeファイルの物に書き換えて保存すれば、あたし的にはOKです!















これで駄目なら何か他の原因があるんだと思います。

念のため書きますが、ControlAmarecTV.au3 の内部パラメーターなど変更した後は、再度exeにしないと駄目です。

※ こちらを参考にさせていただきました。

http://open-shelf.appspot.com/AutoIt3.3.6.1j/html/intro/compiler.htm


2016年8月4日木曜日

古いネットブックに入れた xubuntu on cloudready 環境で IkaLog.py を動かしてみた

はじめに

  • この構成の需要は無いと思いますのでざっくりと。
  • 気にしながら調べて書いてはいるのですが、用語や使い方を間違っているかもしれません。

やったこと

  • 古いネットブックに、 cloudready という chromebook os 互換のものをインストールして、 crouton という仕組みを使って xubuntu14.04 を導入してみました。
  • 前回のスクリプトのテストでは、IkaLogに動画ファイルを読ませてバトルデータを作ったので、ひょっとして、xubuntu on cloudready でも、この方法ならIkaLogが動くんじゃないかと思いつきました。
  • 本当は、 IkaWatcher を試したかったのですが、カーネルがcifsに対応してない的なメッセージが出て、Windowsの共有フォルダをマウントするのが駄目そうな感じだったので諦めました。
  • 今回は、キャプチャーカードの代わりに 720p 8Mbps 230MBくらいのバトル動画を USBメモリ経由で読み込ませています。

ネットブックのスペック
Intel(R) Atom(TM) CPU N270@ 1.60GHz
Memory 2.11GB

IkaLogの導入

  • xubuntuにIkaLogを導入する手順は、IkaLogさんのGitHubにある ・開発環境の構築(Linux) を見ながら、書いてあるコマンドをそのままコピペでOKでした。
  • yaki_ika.pyを動かしてみて気がついたのですが、pip install 中の umsgpack は、 u-msgpack-python に入れ替えたほうが良い感じかもです。

IkaConfig.pyの書き換え



# OUTPUT_PLUGINS.append('StatInk') ←コメントを外す
    'dry_run': False, ← 'dry_run': True,に書き換える

※'dry_run': True,に設定するのは、『stat.inkさん向けのデータを作るが送信しない』動作になるので、テストの時は True 必須だと思います。


// track_oooo系のオプションを True にしないと、スペシャルが溜まった・使った情報なんかを記録してくれないので、必要であれば True にする。
// (2016年9月10日追記)

    'track_special_gauge': True,
    'track_special_weapon': True,
    'track_splatzone': True,
    'track_objective': True,
    'track_inklings': True,


動かしてみた




画質が悪くて音声なしな上にヘタッピバトルなので、見ていて楽しく無いと思います。
00:50 IkaLog起動
07:40 バトル終了
辺りまで飛ばしてください。

データを見たら、スペシャル関連の動きが拾えて無い感じががが…
track_oooo オプションを False にしてたら駄目ですよね…

2倍くらい時間かかってるし、ちょっと残念な結果になりました。


※ cloudready と xubuntu のインストールは、こちらを参考にさせていただきました。

古いノートPCをChromebookとして復活させてくれるアプリ『CloudReady』
ChromebookにXubuntuをインストールする方法
ちょっと知りたいIT活用の備忘録
https://www.neverware.com/#introtext-3
crouton: Chromium OS Universal Chroot Environment

2016年7月31日日曜日

IkaLog CUI版を活用して、詳細なバトルデータをゲットしてみたメモ

やっていること


  • IkaLogさんでバトルが終わる辺りで作られて、stat.inkさんが受けて処理しているであろうデータをローカルに保存できるようにする。
  • そのファイルから、画像とjsonを分離し保存しつつ、バトルのタイムラインをテキストに出力するスクリプトを公開します。

はじめに


  • この方法は、わたし自身がIkaLogのコードを読んで勝手に独自で行っているものです。この記事を元にして、IkaLogさんやstat.inkさんに問い合わせるような事は、絶対にしないでください。
  • 素人がやってみたら出来たかも?くらいのレベルなので、いろいろ間違っているかも知れません。難しいことはよくわからないけど、とりあえず動いてるっぽい!
  • 1行ですがIkaLogのコード書き換えがあるのと、ドライブのルートに/tmpフォルダを作成する必要があります。
  • 今まで動いていたモノが動かなくなったり、とても困った事になる可能性があります。もし、そうなっても責任は持てないので、ご自身の判断で理解者のみ行ってください。

それでは、イカよろしくお願いいたします。

調べてみたきっかけ

Twitterで、「スペシャルの溜まった回数と抱え落ちした回数を取りたい」という意見をみかけました。
(詳しく調べてないのですが、csvにもjsonにも出力されてなさそう?です。)

stat.inkさんを使わせて頂いているのですが、バトルのタイムライン図があって、スペシャルが満タンとか、スーパーセンサーとか沢山のアイコンが出ています。

前々から、どうやって詳しいデータを受けているんだろうと不思議に思っていたので、IkaLogのソースを読んでみました。

詳細なバトルデータファイルを保存できるようにしてみる

  • IkaLog\ikalog\outputs\statink.py をエディタで開きます。
  • self.debug_writePayloadToFile = False の行を見つけて self.debug_writePayloadToFile = True に書き換えて保存してください。
  • IkaLogが動作するドライブのrootに tmpフォルダを作成します。
  • ※ C:ドライブなら、 c:\tmp みたいな感じです。
  • 実際にバトルでIkaLogを使って遊ぶと、/tmpフォルダ内に statink_20160730_2133.msgpack みたいな3MBくらいのファイルが保存されます。
  • そのままでは使えないと思いますので、分離するツールを作ってみました。

(メインのmsgpackを分離する部分が数行のコピペで動いたので、凄くラッキーでした。)

GitHub: https://github.com/sodoko-ika/yaki_ika

git clone https://github.com/sodoko-ika/yaki_ika.git で取得できます。

IkaLog CUI版が動作する環境だと動くハズです。

python yaki_ika.py

とすると、img, jsonに分離されたファイルが保存されます。
※json内の画像データは、サイズが大きいのでファイル名に置換しています。

タイムラインを表示したりテキストに保存していますが、邪魔なようであればコメントアウトしてお使いください。

処理後のファイルは /tmp→./tmpへ移動しています。
ファイルのエラー処理を何もしていないので、各保存フォルダの位置に注意してください。


jsonファイルから取れる情報ですが、生存しているイカリング数の変動や優勢劣勢、装備ギア、参加メンバーの情報、その他いろいろなものが詰まっています。

stat.inkさんは、この情報を1ページにまとめて表示する仕組みを作ってるの、本当に凄いと思いました。

最後になりましたが、参考にさせていただいた記事を書いてくださった皆様、ありがとうございます。

https://github.com/hasegaw/IkaLog/wiki
https://github.com/fetus-hina/stat.ink
https://github.com/vsergeev/u-msgpack-python
http://qiita.com/ligerbolt/items/aeaa88980030fba940b6


暑さにやられて、いろいろ雑な書き方になっているような気がするので、ボチボチと修正していきます。

おまけ

このバトル( https://stat.ink/u/sodoko_ika/1716418 )に対応する jsonファイルです。

{
    "agent": "IkaLog",
    "agent_game_version": "2.8.0",
    "agent_game_version_date": "2016-06-08_04",
    "agent_variables": {
        "input_class": "DirectShow",
        "primary_language": "ja"
    },
    "agent_version": "f906b5a (Windows)",
    "cash_after": 739477,
    "death": 3,
    "death_reasons": {
        "megaphone": 1,
        "splatscope_wakame": 2
    },
    "end_at": 1469883360,
    "events": [
        {
            "at": 0.1,
            "his_team": [
                true,
                true,
                true,
                true
            ],
            "my_team": [
                true,
                true,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 0.1,
            "game_status": "neutral",
            "type": "game_status"
        },
        {
            "at": 0.9,
            "point": 4,
            "type": "point"
        },
        {
            "at": 1.5,
            "point": 6,
            "type": "point"
        },
        {
            "at": 2.0,
            "point": 10,
            "type": "point"
        },
        {
            "at": 2.7,
            "point": 17,
            "type": "point"
        },
        {
            "at": 3.1,
            "point": 20,
            "type": "point"
        },
        {
            "at": 3.4,
            "point": 24,
            "type": "point"
        },
        {
            "at": 3.6,
            "point": 26,
            "type": "point"
        },
        {
            "at": 4.0,
            "point": 31,
            "type": "point"
        },
        {
            "at": 4.2,
            "point": 33,
            "type": "point"
        },
        {
            "at": 4.6,
            "point": 36,
            "type": "point"
        },
        {
            "at": 5.3,
            "point": 38,
            "type": "point"
        },
        {
            "at": 5.8,
            "point": 39,
            "type": "point"
        },
        {
            "at": 6.0,
            "point": 40,
            "type": "point"
        },
        {
            "at": 6.3,
            "point": 42,
            "type": "point"
        },
        {
            "at": 6.8,
            "point": 48,
            "type": "point"
        },
        {
            "at": 7.1,
            "point": 52,
            "type": "point"
        },
        {
            "at": 7.8,
            "point": 56,
            "type": "point"
        },
        {
            "at": 8.2,
            "point": 59,
            "type": "point"
        },
        {
            "at": 8.5,
            "point": 60,
            "type": "point"
        },
        {
            "at": 9.1,
            "point": 62,
            "type": "point"
        },
        {
            "at": 9.4,
            "point": 64,
            "type": "point"
        },
        {
            "at": 9.8,
            "point": 66,
            "type": "point"
        },
        {
            "at": 10.7,
            "point": 68,
            "type": "point"
        },
        {
            "at": 12.4,
            "his_team": [
                true,
                true,
                false,
                true
            ],
            "my_team": [
                true,
                true,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 12.7,
            "point": 70,
            "type": "point"
        },
        {
            "at": 13.4,
            "point": 74,
            "type": "point"
        },
        {
            "at": 13.7,
            "point": 76,
            "type": "point"
        },
        {
            "at": 14.9,
            "point": 88,
            "type": "point"
        },
        {
            "at": 17.0,
            "point": 89,
            "type": "point"
        },
        {
            "at": 18.5,
            "point": 92,
            "type": "point"
        },
        {
            "at": 19.0,
            "point": 98,
            "type": "point"
        },
        {
            "at": 19.5,
            "point": 104,
            "type": "point"
        },
        {
            "at": 20.0,
            "point": 110,
            "type": "point"
        },
        {
            "at": 20.1,
            "his_team": [
                true,
                true,
                false,
                false
            ],
            "my_team": [
                true,
                true,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 20.4,
            "point": 114,
            "type": "point"
        },
        {
            "at": 20.5,
            "his_team": [
                true,
                true,
                true,
                false
            ],
            "my_team": [
                true,
                true,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 20.7,
            "point": 118,
            "type": "point"
        },
        {
            "at": 21.0,
            "point": 121,
            "type": "point"
        },
        {
            "at": 21.0,
            "game_status": "advantage",
            "type": "game_status"
        },
        {
            "at": 21.3,
            "game_status": "neutral",
            "type": "game_status"
        },
        {
            "at": 21.6,
            "game_status": "advantage",
            "type": "game_status"
        },
        {
            "at": 22.1,
            "point": 122,
            "type": "point"
        },
        {
            "at": 23.1,
            "point": 129,
            "type": "point"
        },
        {
            "at": 23.4,
            "point": 131,
            "type": "point"
        },
        {
            "at": 26.0,
            "his_team": [
                true,
                true,
                true,
                false
            ],
            "my_team": [
                true,
                false,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 26.1,
            "point": 133,
            "type": "point"
        },
        {
            "at": 26.6,
            "point": 137,
            "type": "point"
        },
        {
            "at": 27.0,
            "point": 142,
            "type": "point"
        },
        {
            "at": 27.2,
            "his_team": [
                true,
                true,
                true,
                true
            ],
            "my_team": [
                true,
                false,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 27.8,
            "point": 150,
            "type": "point"
        },
        {
            "at": 28.3,
            "point": 152,
            "type": "point"
        },
        {
            "at": 28.4,
            "his_team": [
                true,
                true,
                true,
                true
            ],
            "my_team": [
                false,
                false,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 30.6,
            "his_team": [
                true,
                true,
                true,
                true
            ],
            "my_team": [
                false,
                false,
                false,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 28.8,
            "reason": "megaphone",
            "type": "dead"
        },
        {
            "at": 31.2,
            "game_status": "neutral",
            "type": "game_status"
        },
        {
            "at": 33.8,
            "his_team": [
                true,
                true,
                true,
                true
            ],
            "my_team": [
                false,
                true,
                false,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 34.2,
            "game_status": "disadvantage",
            "type": "game_status"
        },
        {
            "at": 36.7,
            "his_team": [
                true,
                true,
                true,
                true
            ],
            "my_team": [
                true,
                true,
                false,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 38.7,
            "his_team": [
                true,
                true,
                true,
                true
            ],
            "my_team": [
                true,
                true,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 39.7,
            "point": 154,
            "type": "point"
        },
        {
            "at": 40.0,
            "point": 156,
            "type": "point"
        },
        {
            "at": 40.8,
            "point": 163,
            "type": "point"
        },
        {
            "at": 41.0,
            "point": 165,
            "type": "point"
        },
        {
            "at": 41.3,
            "point": 167,
            "type": "point"
        },
        {
            "at": 42.5,
            "his_team": [
                true,
                true,
                true,
                true
            ],
            "my_team": [
                true,
                true,
                true,
                false
            ],
            "type": "alive_inklings"
        },
        {
            "at": 43.9,
            "point": 170,
            "type": "point"
        },
        {
            "at": 43.9,
            "me": false,
            "special_weapon": "tornado",
            "type": "special_weapon"
        },
        {
            "at": 44.7,
            "point": 180,
            "type": "point"
        },
        {
            "at": 45.1,
            "point": 184,
            "type": "point"
        },
        {
            "at": 46.0,
            "point": 195,
            "type": "point"
        },
        {
            "at": 46.9,
            "point": 196,
            "type": "point"
        },
        {
            "at": 46.9,
            "his_team": [
                false,
                true,
                true,
                true
            ],
            "my_team": [
                true,
                true,
                true,
                false
            ],
            "type": "alive_inklings"
        },
        {
            "at": 47.8,
            "point": 197,
            "type": "point"
        },
        {
            "at": 48.1,
            "point": 200,
            "type": "point"
        },
        {
            "at": 48.1,
            "his_team": [
                false,
                false,
                true,
                true
            ],
            "my_team": [
                true,
                true,
                true,
                false
            ],
            "type": "alive_inklings"
        },
        {
            "at": 48.3,
            "type": "killed"
        },
        {
            "at": 48.4,
            "point": 202,
            "type": "point"
        },
        {
            "at": 48.8,
            "point": 207,
            "type": "point"
        },
        {
            "at": 49.1,
            "point": 211,
            "type": "point"
        },
        {
            "at": 49.4,
            "point": 215,
            "type": "point"
        },
        {
            "at": 49.6,
            "point": 217,
            "type": "point"
        },
        {
            "at": 49.9,
            "point": 221,
            "type": "point"
        },
        {
            "at": 50.2,
            "point": 225,
            "type": "point"
        },
        {
            "at": 50.6,
            "point": 229,
            "type": "point"
        },
        {
            "at": 50.8,
            "point": 231,
            "type": "point"
        },
        {
            "at": 50.8,
            "his_team": [
                false,
                false,
                true,
                true
            ],
            "my_team": [
                true,
                false,
                true,
                false
            ],
            "type": "alive_inklings"
        },
        {
            "at": 51.0,
            "his_team": [
                false,
                false,
                true,
                true
            ],
            "my_team": [
                true,
                false,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 51.2,
            "his_team": [
                false,
                false,
                false,
                true
            ],
            "my_team": [
                true,
                false,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 51.3,
            "type": "killed"
        },
        {
            "at": 52.1,
            "point": 245,
            "type": "point"
        },
        {
            "at": 52.8,
            "point": 253,
            "type": "point"
        },
        {
            "at": 53.2,
            "point": 257,
            "type": "point"
        },
        {
            "at": 53.4,
            "point": 260,
            "type": "point"
        },
        {
            "at": 53.9,
            "type": "special_charged"
        },
        {
            "at": 54.0,
            "point": 261,
            "type": "point"
        },
        {
            "at": 54.2,
            "point": 262,
            "type": "point"
        },
        {
            "at": 54.6,
            "point": 263,
            "type": "point"
        },
        {
            "at": 54.7,
            "his_team": [
                true,
                false,
                false,
                true
            ],
            "my_team": [
                true,
                false,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 54.8,
            "point": 264,
            "type": "point"
        },
        {
            "at": 55.2,
            "point": 265,
            "type": "point"
        },
        {
            "at": 56.3,
            "his_team": [
                true,
                true,
                false,
                true
            ],
            "my_team": [
                true,
                false,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 56.8,
            "point": 268,
            "type": "point"
        },
        {
            "at": 57.1,
            "point": 270,
            "type": "point"
        },
        {
            "at": 57.3,
            "point": 272,
            "type": "point"
        },
        {
            "at": 57.7,
            "point": 276,
            "type": "point"
        },
        {
            "at": 58.6,
            "his_team": [
                true,
                true,
                false,
                true
            ],
            "my_team": [
                true,
                true,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 58.8,
            "point": 277,
            "type": "point"
        },
        {
            "at": 59.2,
            "point": 278,
            "type": "point"
        },
        {
            "at": 59.4,
            "his_team": [
                true,
                true,
                true,
                true
            ],
            "my_team": [
                true,
                true,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 59.7,
            "point": 283,
            "type": "point"
        },
        {
            "at": 59.9,
            "me": true,
            "special_weapon": "supersensor",
            "type": "special_weapon"
        },
        {
            "at": 60.9,
            "point": 284,
            "type": "point"
        },
        {
            "at": 61.2,
            "point": 286,
            "type": "point"
        },
        {
            "at": 61.4,
            "point": 287,
            "type": "point"
        },
        {
            "at": 61.8,
            "point": 291,
            "type": "point"
        },
        {
            "at": 62.7,
            "point": 293,
            "type": "point"
        },
        {
            "at": 63.0,
            "point": 297,
            "type": "point"
        },
        {
            "at": 63.7,
            "point": 304,
            "type": "point"
        },
        {
            "at": 64.0,
            "point": 308,
            "type": "point"
        },
        {
            "at": 64.4,
            "point": 312,
            "type": "point"
        },
        {
            "at": 64.7,
            "point": 316,
            "type": "point"
        },
        {
            "at": 65.1,
            "point": 321,
            "type": "point"
        },
        {
            "at": 65.6,
            "point": 326,
            "type": "point"
        },
        {
            "at": 65.9,
            "point": 328,
            "type": "point"
        },
        {
            "at": 66.5,
            "point": 334,
            "type": "point"
        },
        {
            "at": 66.9,
            "point": 338,
            "type": "point"
        },
        {
            "at": 67.1,
            "point": 340,
            "type": "point"
        },
        {
            "at": 67.4,
            "point": 344,
            "type": "point"
        },
        {
            "at": 67.7,
            "point": 346,
            "type": "point"
        },
        {
            "at": 69.4,
            "point": 347,
            "type": "point"
        },
        {
            "at": 69.9,
            "point": 353,
            "type": "point"
        },
        {
            "at": 70.3,
            "his_team": [
                true,
                false,
                true,
                true
            ],
            "my_team": [
                true,
                true,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 70.4,
            "type": "killed"
        },
        {
            "at": 71.1,
            "point": 366,
            "type": "point"
        },
        {
            "at": 71.4,
            "point": 370,
            "type": "point"
        },
        {
            "at": 71.8,
            "point": 374,
            "type": "point"
        },
        {
            "at": 71.8,
            "game_status": "neutral",
            "type": "game_status"
        },
        {
            "at": 72.1,
            "point": 378,
            "type": "point"
        },
        {
            "at": 72.4,
            "point": 382,
            "type": "point"
        },
        {
            "at": 72.9,
            "point": 388,
            "type": "point"
        },
        {
            "at": 73.2,
            "game_status": "disadvantage",
            "type": "game_status"
        },
        {
            "at": 73.2,
            "game_status": "neutral",
            "type": "game_status"
        },
        {
            "at": 73.4,
            "point": 393,
            "type": "point"
        },
        {
            "at": 73.7,
            "game_status": "disadvantage",
            "type": "game_status"
        },
        {
            "at": 74.3,
            "game_status": "neutral",
            "type": "game_status"
        },
        {
            "at": 74.9,
            "point": 394,
            "type": "point"
        },
        {
            "at": 75.2,
            "point": 395,
            "type": "point"
        },
        {
            "at": 75.6,
            "point": 396,
            "type": "point"
        },
        {
            "at": 76.0,
            "point": 398,
            "type": "point"
        },
        {
            "at": 76.5,
            "point": 400,
            "type": "point"
        },
        {
            "at": 77.8,
            "point": 404,
            "type": "point"
        },
        {
            "at": 78.5,
            "his_team": [
                true,
                true,
                true,
                true
            ],
            "my_team": [
                true,
                true,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 78.6,
            "point": 413,
            "type": "point"
        },
        {
            "at": 80.6,
            "me": false,
            "special_weapon": "supersensor",
            "type": "special_weapon"
        },
        {
            "at": 81.6,
            "his_team": [
                true,
                true,
                false,
                true
            ],
            "my_team": [
                true,
                true,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 81.7,
            "point": 415,
            "type": "point"
        },
        {
            "at": 82.0,
            "point": 419,
            "type": "point"
        },
        {
            "at": 82.3,
            "point": 422,
            "type": "point"
        },
        {
            "at": 82.9,
            "point": 428,
            "type": "point"
        },
        {
            "at": 83.2,
            "point": 431,
            "type": "point"
        },
        {
            "at": 83.6,
            "his_team": [
                true,
                true,
                false,
                true
            ],
            "my_team": [
                true,
                true,
                true,
                false
            ],
            "type": "alive_inklings"
        },
        {
            "at": 83.9,
            "point": 433,
            "type": "point"
        },
        {
            "at": 84.2,
            "point": 437,
            "type": "point"
        },
        {
            "at": 84.3,
            "type": "low_ink"
        },
        {
            "at": 84.5,
            "point": 440,
            "type": "point"
        },
        {
            "at": 85.8,
            "point": 441,
            "type": "point"
        },
        {
            "at": 86.4,
            "point": 443,
            "type": "point"
        },
        {
            "at": 86.7,
            "his_team": [
                true,
                true,
                false,
                true
            ],
            "my_team": [
                true,
                false,
                true,
                false
            ],
            "type": "alive_inklings"
        },
        {
            "at": 88.9,
            "point": 444,
            "type": "point"
        },
        {
            "at": 89.5,
            "point": 449,
            "type": "point"
        },
        {
            "at": 89.8,
            "his_team": [
                true,
                true,
                true,
                true
            ],
            "my_team": [
                true,
                false,
                true,
                false
            ],
            "type": "alive_inklings"
        },
        {
            "at": 89.9,
            "point": 451,
            "type": "point"
        },
        {
            "at": 90.4,
            "point": 455,
            "type": "point"
        },
        {
            "at": 90.7,
            "point": 459,
            "type": "point"
        },
        {
            "at": 91.0,
            "point": 462,
            "type": "point"
        },
        {
            "at": 92.2,
            "his_team": [
                true,
                true,
                true,
                true
            ],
            "my_team": [
                true,
                false,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 92.5,
            "his_team": [
                true,
                true,
                true,
                true
            ],
            "my_team": [
                true,
                false,
                false,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 92.7,
            "game_status": "disadvantage",
            "type": "game_status"
        },
        {
            "at": 94.5,
            "his_team": [
                true,
                true,
                true,
                true
            ],
            "my_team": [
                true,
                true,
                false,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 94.8,
            "point": 463,
            "type": "point"
        },
        {
            "at": 95.1,
            "his_team": [
                true,
                true,
                true,
                true
            ],
            "my_team": [
                false,
                true,
                false,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 95.4,
            "reason": "splatscope_wakame",
            "type": "dead"
        },
        {
            "at": 100.7,
            "his_team": [
                true,
                true,
                true,
                true
            ],
            "my_team": [
                false,
                true,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 103.3,
            "his_team": [
                true,
                true,
                true,
                true
            ],
            "my_team": [
                true,
                true,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 105.9,
            "point": 465,
            "type": "point"
        },
        {
            "at": 106.3,
            "point": 467,
            "type": "point"
        },
        {
            "at": 106.6,
            "point": 469,
            "type": "point"
        },
        {
            "at": 106.8,
            "point": 471,
            "type": "point"
        },
        {
            "at": 107.2,
            "point": 473,
            "type": "point"
        },
        {
            "at": 107.5,
            "point": 475,
            "type": "point"
        },
        {
            "at": 107.7,
            "point": 476,
            "type": "point"
        },
        {
            "at": 108.3,
            "point": 480,
            "type": "point"
        },
        {
            "at": 108.6,
            "point": 484,
            "type": "point"
        },
        {
            "at": 108.8,
            "his_team": [
                true,
                true,
                false,
                true
            ],
            "my_team": [
                true,
                true,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 109.0,
            "type": "killed"
        },
        {
            "at": 110.0,
            "point": 500,
            "type": "point"
        },
        {
            "at": 110.4,
            "point": 504,
            "type": "point"
        },
        {
            "at": 110.6,
            "point": 507,
            "type": "point"
        },
        {
            "at": 111.3,
            "point": 509,
            "type": "point"
        },
        {
            "at": 111.6,
            "point": 510,
            "type": "point"
        },
        {
            "at": 111.9,
            "point": 511,
            "type": "point"
        },
        {
            "at": 112.6,
            "point": 512,
            "type": "point"
        },
        {
            "at": 112.8,
            "point": 514,
            "type": "point"
        },
        {
            "at": 113.2,
            "point": 517,
            "type": "point"
        },
        {
            "at": 113.5,
            "point": 519,
            "type": "point"
        },
        {
            "at": 113.7,
            "point": 522,
            "type": "point"
        },
        {
            "at": 114.4,
            "point": 526,
            "type": "point"
        },
        {
            "at": 114.8,
            "point": 528,
            "type": "point"
        },
        {
            "at": 115.2,
            "point": 530,
            "type": "point"
        },
        {
            "at": 117.0,
            "his_team": [
                true,
                true,
                true,
                true
            ],
            "my_team": [
                true,
                true,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 119.0,
            "point": 533,
            "type": "point"
        },
        {
            "at": 119.3,
            "point": 534,
            "type": "point"
        },
        {
            "at": 119.9,
            "point": 536,
            "type": "point"
        },
        {
            "at": 121.2,
            "point": 537,
            "type": "point"
        },
        {
            "at": 121.5,
            "point": 540,
            "type": "point"
        },
        {
            "at": 123.3,
            "me": false,
            "special_weapon": "tornado",
            "type": "special_weapon"
        },
        {
            "at": 123.8,
            "his_team": [
                true,
                true,
                true,
                true
            ],
            "my_team": [
                true,
                true,
                true,
                false
            ],
            "type": "alive_inklings"
        },
        {
            "at": 124.2,
            "point": 543,
            "type": "point"
        },
        {
            "at": 124.6,
            "point": 545,
            "type": "point"
        },
        {
            "at": 125.7,
            "type": "special_charged"
        },
        {
            "at": 126.0,
            "his_team": [
                true,
                true,
                false,
                true
            ],
            "my_team": [
                true,
                true,
                true,
                false
            ],
            "type": "alive_inklings"
        },
        {
            "at": 126.3,
            "point": 557,
            "type": "point"
        },
        {
            "at": 129.7,
            "point": 558,
            "type": "point"
        },
        {
            "at": 130.0,
            "his_team": [
                true,
                true,
                false,
                true
            ],
            "my_team": [
                false,
                true,
                true,
                false
            ],
            "type": "alive_inklings"
        },
        {
            "at": 130.4,
            "point": 566,
            "type": "point"
        },
        {
            "at": 130.8,
            "point": 570,
            "type": "point"
        },
        {
            "at": 131.1,
            "point": 574,
            "type": "point"
        },
        {
            "at": 131.6,
            "his_team": [
                true,
                true,
                false,
                false
            ],
            "my_team": [
                false,
                true,
                true,
                false
            ],
            "type": "alive_inklings"
        },
        {
            "at": 131.7,
            "point": 580,
            "type": "point"
        },
        {
            "at": 130.3,
            "reason": "splatscope_wakame",
            "type": "dead"
        },
        {
            "at": 132.4,
            "his_team": [
                true,
                true,
                false,
                false
            ],
            "my_team": [
                false,
                true,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 134.3,
            "his_team": [
                true,
                true,
                true,
                false
            ],
            "my_team": [
                false,
                true,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 134.8,
            "his_team": [
                true,
                true,
                true,
                false
            ],
            "my_team": [
                false,
                false,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 136.7,
            "his_team": [
                false,
                true,
                true,
                false
            ],
            "my_team": [
                false,
                false,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 138.2,
            "his_team": [
                false,
                true,
                true,
                false
            ],
            "my_team": [
                true,
                false,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 138.6,
            "his_team": [
                false,
                true,
                true,
                true
            ],
            "my_team": [
                true,
                false,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 141.4,
            "point": 585,
            "type": "point"
        },
        {
            "at": 141.6,
            "his_team": [
                false,
                false,
                true,
                true
            ],
            "my_team": [
                true,
                false,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 141.6,
            "type": "killed"
        },
        {
            "at": 141.8,
            "point": 589,
            "type": "point"
        },
        {
            "at": 142.3,
            "point": 595,
            "type": "point"
        },
        {
            "at": 142.5,
            "his_team": [
                false,
                false,
                true,
                true
            ],
            "my_team": [
                true,
                true,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 142.6,
            "point": 599,
            "type": "point"
        },
        {
            "at": 143.0,
            "point": 603,
            "type": "point"
        },
        {
            "at": 143.0,
            "game_status": "neutral",
            "type": "game_status"
        },
        {
            "at": 143.3,
            "point": 607,
            "type": "point"
        },
        {
            "at": 143.4,
            "his_team": [
                false,
                false,
                true,
                false
            ],
            "my_team": [
                true,
                true,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 143.5,
            "type": "killed"
        },
        {
            "at": 143.6,
            "point": 611,
            "type": "point"
        },
        {
            "at": 143.6,
            "game_status": "disadvantage",
            "type": "game_status"
        },
        {
            "at": 143.7,
            "game_status": "neutral",
            "type": "game_status"
        },
        {
            "at": 144.4,
            "point": 620,
            "type": "point"
        },
        {
            "at": 144.5,
            "his_team": [
                true,
                false,
                true,
                false
            ],
            "my_team": [
                true,
                true,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 144.7,
            "point": 623,
            "type": "point"
        },
        {
            "at": 144.9,
            "point": 624,
            "type": "point"
        },
        {
            "at": 145.2,
            "point": 625,
            "type": "point"
        },
        {
            "at": 145.5,
            "point": 626,
            "type": "point"
        },
        {
            "at": 145.9,
            "point": 629,
            "type": "point"
        },
        {
            "at": 146.1,
            "point": 631,
            "type": "point"
        },
        {
            "at": 146.7,
            "point": 634,
            "type": "point"
        },
        {
            "at": 147.0,
            "point": 635,
            "type": "point"
        },
        {
            "at": 147.4,
            "game_status": "advantage",
            "type": "game_status"
        },
        {
            "at": 147.7,
            "his_team": [
                true,
                false,
                true,
                false
            ],
            "my_team": [
                true,
                true,
                false,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 147.8,
            "game_status": "neutral",
            "type": "game_status"
        },
        {
            "at": 148.5,
            "point": 637,
            "type": "point"
        },
        {
            "at": 149.7,
            "his_team": [
                true,
                true,
                true,
                false
            ],
            "my_team": [
                true,
                true,
                false,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 149.8,
            "game_status": "advantage",
            "type": "game_status"
        },
        {
            "at": 150.0,
            "game_status": "neutral",
            "type": "game_status"
        },
        {
            "at": 150.4,
            "his_team": [
                true,
                true,
                true,
                true
            ],
            "my_team": [
                true,
                true,
                false,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 151.5,
            "point": 638,
            "type": "point"
        },
        {
            "at": 151.8,
            "point": 640,
            "type": "point"
        },
        {
            "at": 152.0,
            "point": 641,
            "type": "point"
        },
        {
            "at": 152.3,
            "point": 644,
            "type": "point"
        },
        {
            "at": 152.7,
            "point": 648,
            "type": "point"
        },
        {
            "at": 153.1,
            "type": "special_charged"
        },
        {
            "at": 154.4,
            "me": true,
            "special_weapon": "supersensor",
            "type": "special_weapon"
        },
        {
            "at": 154.4,
            "point": 667,
            "type": "point"
        },
        {
            "at": 154.6,
            "point": 670,
            "type": "point"
        },
        {
            "at": 155.0,
            "point": 671,
            "type": "point"
        },
        {
            "at": 155.3,
            "point": 673,
            "type": "point"
        },
        {
            "at": 155.8,
            "point": 674,
            "type": "point"
        },
        {
            "at": 155.9,
            "his_team": [
                true,
                true,
                true,
                true
            ],
            "my_team": [
                true,
                true,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 156.2,
            "point": 675,
            "type": "point"
        },
        {
            "at": 156.5,
            "point": 677,
            "type": "point"
        },
        {
            "at": 156.8,
            "point": 680,
            "type": "point"
        },
        {
            "at": 157.3,
            "point": 682,
            "type": "point"
        },
        {
            "at": 157.4,
            "his_team": [
                true,
                true,
                false,
                true
            ],
            "my_team": [
                true,
                true,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 157.5,
            "type": "killed"
        },
        {
            "at": 157.6,
            "point": 685,
            "type": "point"
        },
        {
            "at": 158.0,
            "point": 689,
            "type": "point"
        },
        {
            "at": 158.5,
            "point": 690,
            "type": "point"
        },
        {
            "at": 158.8,
            "point": 691,
            "type": "point"
        },
        {
            "at": 160.1,
            "point": 692,
            "type": "point"
        },
        {
            "at": 160.3,
            "point": 694,
            "type": "point"
        },
        {
            "at": 160.7,
            "point": 698,
            "type": "point"
        },
        {
            "at": 160.8,
            "game_status": "advantage",
            "type": "game_status"
        },
        {
            "at": 161.0,
            "point": 699,
            "type": "point"
        },
        {
            "at": 161.3,
            "point": 701,
            "type": "point"
        },
        {
            "at": 161.7,
            "point": 705,
            "type": "point"
        },
        {
            "at": 163.6,
            "point": 708,
            "type": "point"
        },
        {
            "at": 164.1,
            "point": 710,
            "type": "point"
        },
        {
            "at": 164.6,
            "point": 716,
            "type": "point"
        },
        {
            "at": 165.4,
            "point": 720,
            "type": "point"
        },
        {
            "at": 165.5,
            "his_team": [
                true,
                true,
                true,
                true
            ],
            "my_team": [
                true,
                true,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 165.7,
            "point": 723,
            "type": "point"
        },
        {
            "at": 167.1,
            "point": 727,
            "type": "point"
        },
        {
            "at": 167.5,
            "point": 731,
            "type": "point"
        },
        {
            "at": 167.8,
            "point": 734,
            "type": "point"
        },
        {
            "at": 168.0,
            "point": 736,
            "type": "point"
        },
        {
            "at": 168.5,
            "point": 741,
            "type": "point"
        },
        {
            "at": 168.8,
            "point": 745,
            "type": "point"
        },
        {
            "at": 169.3,
            "point": 751,
            "type": "point"
        },
        {
            "at": 169.3,
            "me": false,
            "special_weapon": "supersensor",
            "type": "special_weapon"
        },
        {
            "at": 169.9,
            "point": 757,
            "type": "point"
        },
        {
            "at": 170.5,
            "point": 763,
            "type": "point"
        },
        {
            "at": 170.7,
            "point": 765,
            "type": "point"
        },
        {
            "at": 171.3,
            "point": 767,
            "type": "point"
        },
        {
            "at": 171.7,
            "point": 770,
            "type": "point"
        },
        {
            "at": 172.0,
            "point": 773,
            "type": "point"
        },
        {
            "at": 172.5,
            "point": 778,
            "type": "point"
        },
        {
            "at": 172.6,
            "his_team": [
                true,
                true,
                true,
                false
            ],
            "my_team": [
                true,
                true,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 172.8,
            "point": 781,
            "type": "point"
        },
        {
            "at": 173.2,
            "point": 782,
            "type": "point"
        },
        {
            "at": 174.3,
            "me": false,
            "special_weapon": "tornado",
            "type": "special_weapon"
        },
        {
            "at": 175.0,
            "point": 785,
            "type": "point"
        },
        {
            "at": 175.7,
            "point": 790,
            "type": "point"
        },
        {
            "at": 176.3,
            "point": 794,
            "type": "point"
        },
        {
            "at": 176.8,
            "point": 796,
            "type": "point"
        },
        {
            "at": 177.3,
            "point": 798,
            "type": "point"
        },
        {
            "at": 178.1,
            "point": 805,
            "type": "point"
        },
        {
            "at": 178.9,
            "point": 807,
            "type": "point"
        },
        {
            "at": 179.3,
            "point": 810,
            "type": "point"
        },
        {
            "at": 179.6,
            "his_team": [
                true,
                true,
                true,
                false
            ],
            "my_team": [
                true,
                false,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 179.7,
            "point": 812,
            "type": "point"
        },
        {
            "at": 179.8,
            "his_team": [
                true,
                true,
                false,
                true
            ],
            "my_team": [
                true,
                false,
                true,
                true
            ],
            "type": "alive_inklings"
        },
        {
            "at": 179.8,
            "point": 74,
            "type": "special%"
        },
        {
            "at": 182.3,
            "type": "finish"
        },
        {
            "at": 182.3,
            "point": 812,
            "type": "point"
        }
    ],
    "gears": {
        "clothing": {
            "primary_ability": "ink_recovery_up",
            "secondary_abilities": [
                "ink_saver_main",
                "defense_up",
                "ink_saver_main"
            ]
        },
        "headgear": {
            "primary_ability": "swim_speed_up",
            "secondary_abilities": [
                "defense_up",
                "quick_respawn",
                null
            ]
        },
        "shoes": {
            "primary_ability": "ink_resistance_up",
            "secondary_abilities": [
                "ink_recovery_up",
                "swim_speed_up",
                "ink_recovery_up"
            ]
        }
    },
    "his_team_color": {
        "hue": 336,
        "rgb": [
            180,
            40,
            98
        ]
    },
    "image_gear": "./img/20160730-2152_image_gear.png",
    "image_judge": "./img/20160730-2152_image_judge.png",
    "image_result": "./img/20160730-2152_image_result.png",
    "kill": 7,
    "level": 50,
    "lobby": "standard",
    "map": "bbass",
    "max_kill_combo": 1,
    "max_kill_streak": 3,
    "my_point": 1812,
    "my_team_color": {
        "hue": 116,
        "rgb": [
            49,
            137,
            44
        ]
    },
    "players": [
        {
            "death": 5,
            "is_me": "no",
            "kill": 4,
            "level": 16,
            "point": 1922,
            "rank_in_team": 1,
            "team": "my",
            "weapon": "promodeler_rg"
        },
        {
            "death": 3,
            "is_me": "yes",
            "kill": 7,
            "level": 50,
            "point": 1812,
            "rank_in_team": 2,
            "team": "my",
            "weapon": "dualsweeper"
        },
        {
            "death": 3,
            "is_me": "no",
            "kill": 1,
            "level": 31,
            "point": 1624,
            "rank_in_team": 3,
            "team": "my",
            "weapon": "hissen_hue"
        },
        {
            "death": 3,
            "is_me": "no",
            "kill": 4,
            "level": 49,
            "point": 1530,
            "rank_in_team": 4,
            "team": "my",
            "weapon": "wakaba"
        },
        {
            "death": 2,
            "is_me": "no",
            "kill": 9,
            "level": 46,
            "point": 851,
            "rank_in_team": 1,
            "team": "his",
            "weapon": "splatscope_wakame"
        },
        {
            "death": 3,
            "is_me": "no",
            "kill": 0,
            "level": 47,
            "point": 702,
            "rank_in_team": 2,
            "team": "his",
            "weapon": "sharp"
        },
        {
            "death": 7,
            "is_me": "no",
            "kill": 2,
            "level": 50,
            "point": 552,
            "rank_in_team": 3,
            "team": "his",
            "weapon": "promodeler_mg"
        },
        {
            "death": 4,
            "is_me": "no",
            "kill": 3,
            "level": 6,
            "point": 502,
            "rank_in_team": 4,
            "team": "his",
            "weapon": "wakaba"
        }
    ],
    "rank_in_team": 2,
    "result": "win",
    "rule": "nawabari",
    "start_at": 1469883178,
    "uuid": "",
    "weapon": "dualsweeper"
}


2016年6月9日木曜日

IkaLogのWebSocketサーバ機能と連動して ナワバリバトルのタイムラインっぽいテキストを出力するスクリプトを作ったので公開してみます。(ダウニーガチャも記録できるよ!)

はじめに 

作成者はPythonを始めたばかりで、Google先生の教えのままコピペで作ったものです。
需要があるのか分からないのですが、まずは公開してみようと思います。
コンピュータ関係の職業ではないので、配布の仕方や用語の使い方、コードの書き方に変な所が沢山あるかもしれませんが許してください。
(ここを読んで勉強しろ的な事を教えていただけると本当にありがたいです)
その辺りとこの辺りを含めて、イカよろしくお願いいたします。

・ソースコードの管理を勉強も兼ねて、このスクリプトコードの公開場所は、GitHubへ移行しました。

https://github.com/sodoko-ika/yotchan_ika (2016年6月17日追記)


・IkaLogさんに追加されたブキ(ブキチセレクション2)をコピペさせていただきました。(2016年6月9日追記)


・起動時にメッセージを表示するようにしました。(2016年6月9日追記)


IkaLogさんに追加されたブキ(ブキチセレクション1)をコピペさせていただきました。(2016年4月16日追記)


・ダウニーガチャの結果を記録をする機能を追加してみました。(2016年4月7日追記)

ガチャを引くと downie_lottery.csv というファイルが作成され、追加モードで記録されていきます。

csv形式で、 '日時',  'ブランド名',  'ギアレベル',  'スロット1',  'スロット2',  'スロット3' の並びになっています。
※こんな感じです。
2016/04/06 22:09:23,アロメ,1,インク回復力アップ,スペシャル時間延長,スペシャル増加量アップ
2016/04/06 22:09:53,アロメ,1,インク回復力アップ,スーパージャンプ時間短縮,防御力アップ
2016/04/06 22:10:18,アロメ,1,スペシャル減少量ダウン,インク効率アップ(サブ),スペシャル増加量アップ
2016/04/06 22:10:42,アロメ,1,インク効率アップ(メイン),スペシャル時間延長,インク回復力アップ
2016/04/06 22:11:07,アロメ,1,攻撃力アップ,スペシャル増加量アップ,ヒト移動速度アップ
2016/04/06 22:11:30,アロメ,1,インク回復力アップ,インク回復力アップ,攻撃力アップ


その他、
・場外判定が3種類あるので対応してみました。
・ブキ・やられ名などの辞書を、 IkaLog さんのをまるっと使わせていただきました。
これでブキチセレクションが来ても、そのままコピペで対応可能です。

このスクリプトについて

IkaLogのWebSocketサーバ機能と連動して ナワバリバトルのタイムライン的なテキストを出力するスクリプトです。

(画質が悪かったので差し替えました。 最初の動画はこちらです

出力されたテキストファイルの中身を、YouTubeの動画説明欄にそのままコピペして保存すれば、時間のリンクが作成された形で閲覧できるハズです。
(動画をアップした本人は、動画説明欄をクリックすると自動的に編集モードになると思うので注意してください。)

既にYouTubeで公開されている HiroK Splatoonさまの真似をしたかったのですが、チーム構成や使用ギアの情報が取れてないし、ナワバリバトルで発生するイベントは地味だしで、劣化版になってしまいました…

今のところ、ナワバリバトルの処理しかありません。(ひたすらレギュラーマッチということで…)
ダウニーガチャの記録を目指して作り始めたのですが、ダウニーの所にあまり行かないのでどうしようかと思案中です。
(YouTubeにアップされている動画で試したのですが、画質が劣化しているのか認識してくれませんでした…)

動作に必要なもの

Python 3.4などIkaLog CUI版に合わせた環境で作りました。
Python 3.4で動作確認をしています。
このスクリプトを動作させるのには下記のpipが必要だと思います。
pip install ws4py
pip install tornado

使い方 

・WebSocketサーバ機能が動作するように設定されたIkaLogを起動後、マッチング開始までのタイミングでこのスクリプトを起動してください。
・ステージ紹介~ジャッジくん登場までの間の流れが記録されて、バトルごとに ./20160228-0101.txt みたいな感じのファイルが出来るハズです。
・IkaLogを終了させると、このスクリプトの動作も終わるハズです。
・作成したファイルの削除機能は無いので、使用済みのファイルは手動で削除をお願いします。

動作テストの方法 

1.WebSocketサーバ機能が動作するように設定されたWinIkaLogを準備してください。
2.WinIkaLogのWebSocketサーバの設定に合わせて、このスクリプトのIPアドレスとポート番号を変更してください。
3.WinIkaLogを起動後、このスクリプトを起動してください。
4.おさんぽモードで、マサバ海峡大橋のような落下して自滅可能なステージを選択して、さんぽ開始後に場外へ落ちてください。
5.IkaLogのコマンドプロンプトに 'やられた!' と表示されて、このスクリプトから '処理に必要な情報が取得できていません.()' というメッセージが表示されればOKです。
ポート番号9090で駄目だった時は、IkaLogの設定含めて他の番号(例えば 8080とか)を試すとかすると通るかもしれません。



一応、お約束が必要かと思ったので

実用に耐えて使っていただけるレベルかとても自信はありませんが、ガチマッチ対応などの改変はご自由になさってください。
特殊な事はしていないハズなので大丈夫とは思うのですが、このスクリプトが原因で他の何かが動かなくなったりファイルが消えたり機材が故障しても責任は持てないです。
スクリプトの内容をご確認のうえ、ご自身の判断で利用してください。


最後になりましたが、参考にさせていただいた記事を書いてくださった皆様、ありがとうございます。

https://github.com/hasegaw/IkaLog/wiki
https://github.com/fetus-hina/stat.ink
http://d.hatena.ne.jp/seinzumtode/20141009/1412816599
http://www.typingtarzan.com/entry/2015/06/24/061008
http://www.yamamo10.jp/yamamoto/comp/Python/variable/index.php
http://www.pythonweb.jp/tutorial/list/index6.html
http://uxmilk.jp/8693