KODI API で現在再生中の時間などを取得する

お気に入りのシーンを MovieJukeBox に登録し、それを一覧化する。一覧上のお気に入りシーンをクリックすると、KODI(XBMC) でそのシーンから再生されるということ実現したい。
ここでは、KODI で現在再生中の時間を取得する。一時停止状態でも再生中でも取得できる。
使用するメソッドは「Player.GetProperties」
現在再生中の時間を取得する
http://192.168.11.5:8080/jsonrpc?request={"jsonrpc":"2.0","id":1,"method":"Player.GetProperties","params":{"playerid":1,"properties":["time"]}}
上記で取得したJSON
{"id":1,"jsonrpc":"2.0","result":{"time":{"hours":1,"milliseconds":104,"minutes":30,"seconds":47}}}


現在再生中の時間等、オーディオ情報を取得する
http://192.168.11.5:8080/jsonrpc?request={"jsonrpc":"2.0","id":1,"method":"Player.GetProperties","params":{"playerid":1,"properties":["time","type","playlistid","audiostreams","subtitles","totaltime"]}}
上記で取得したJSON
{"id":1,"jsonrpc":"2.0","result":{"audiostreams":[{"bitrate":3970052,"channels":6,"codec":"dtshd_ma","index":0,"language":"eng","name":"DTS-HD MA 5.1"},{"bitrate":768000,"channels":6,"codec":"dca","index":1,"language":"ita","name":"DTS 5.1"},{"bitrate":768000,"channels":6,"codec":"dca","index":2,"language":"","name":"DTS 5.1"},{"bitrate":448000,"channels":6,"codec":"ac3","index":3,"language":"tha","name":"AC3 5.1"},{"bitrate":224000,"channels":2,"codec":"ac3","index":4,"language":"eng","name":"AC3 Stereo"},{"bitrate":224000,"channels":2,"codec":"ac3","index":5,"language":"eng","name":"AC3 Stereo"},{"bitrate":448000,"channels":6,"codec":"ac3","index":6,"language":"eng","name":"AC3 5.1"},{"bitrate":448000,"channels":6,"codec":"ac3","index":7,"language":"eng","name":"AC3 5.1"}],"playlistid":1,"subtitles":[{"index":0,"language":"","name":""},{"index":1,"language":"eng","name":""},{"index":2,"language":"ita","name":""},{"index":3,"language":"zho","name":""},{"index":4,"language":"tgl","name":""},{"index":5,"language":"ind","name":""},{"index":6,"language":"kor","name":""},{"index":7,"language":"zho","name":""},{"index":8,"language":"tha","name":""},{"index":9,"language":"","name":""},{"index":10,"language":"ita","name":""},{"index":11,"language":"","name":""},{"index":12,"language":"kor","name":""},{"index":13,"language":"ita","name":""},{"index":14,"language":"","name":""},{"index":15,"language":"kor","name":""}],"time":{"hours":1,"milliseconds":321,"minutes":40,"seconds":39},"totaltime":{"hours":1,"milliseconds":615,"minutes":56,"seconds":37},"type":"video"}}

関連するドキュメント
JSON-RPC API/v6 - Kodi Player.Property.Name
http://kodi.wiki/view/JSON-RPC_API/v6#Player.Property.Name
JSON-RPC API/v6 - Kodi Player.GetProperties
http://kodi.wiki/view/JSON-RPC_API/v6#Player.GetProperties

取得した時間をお気に入りシーン一覧としてDBに登録する感じかな。音響としていいシーンとか登録してサラウンドを楽しむ感じ。
再生は KODI の API V6(JSON-RPC)を使用して KODI をリモートコントロールする を参照。
残る作業は、お気に入りシーン登録画面とお気に入りシーン再生画面をASP.NETで作成することかな。

コメント

このブログの人気の投稿

エアコン室外機のフロンガス銅管を覆うカバーを交換しました

ダブルクォーテーションで括られたCSVカ​ンマ区切りテキストファイルを SQL Server で Bulk Insert する方法

IKEAの鏡を壁に取り付ける