2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-22 20:24:36 +00:00

70_KODI: added readings currentaudiostream

git-svn-id: https://svn.fhem.de/fhem/trunk@25576 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
vbs 2022-01-28 11:23:53 +00:00
parent 8b67e9c63b
commit 907379fcd0

View File

@ -385,7 +385,7 @@ sub KODI_PlayerUpdate($$)
my $obj = { my $obj = {
"method" => "Player.GetProperties", "method" => "Player.GetProperties",
"params" => { "params" => {
"properties" => ["time","totaltime", "repeat", "shuffled", "speed" ] "properties" => ["time","totaltime", "repeat", "shuffled", "speed", "currentaudiostream" ]
#"canseek", "canchangespeed", "canmove", "canzoom", "canrotate", "canshuffle", "canrepeat" #"canseek", "canchangespeed", "canmove", "canzoom", "canrotate", "canshuffle", "canrepeat"
} }
}; };
@ -516,6 +516,13 @@ sub KODI_ResetMediaReadings($)
readingsBulkUpdate($hash, "songid", "" ); readingsBulkUpdate($hash, "songid", "" );
readingsBulkUpdate($hash, "currentTrack", "" ); readingsBulkUpdate($hash, "currentTrack", "" );
readingsBulkUpdate($hash, "currentAudioStream_bitrate", "" );
readingsBulkUpdate($hash, "currentAudioStream_channels", "" );
readingsBulkUpdate($hash, "currentAudioStream_codec", "" );
readingsBulkUpdate($hash, "currentAudioStream_index", "" );
readingsBulkUpdate($hash, "currentAudioStream_language", "" );
readingsBulkUpdate($hash, "currentAudioStream_name", "" );
readingsEndUpdate($hash, 1); readingsEndUpdate($hash, 1);
# delete streamdetails readings # delete streamdetails readings
@ -889,6 +896,12 @@ sub KODI_CreateReading($$$) {
$key = 'shuffle'; $key = 'shuffle';
$value = ($value ? 'on' : 'off'); $value = ($value ? 'on' : 'off');
} }
elsif($key eq 'currentaudiostream') {
#{"id":3296,"jsonrpc":"2.0","result":{"currentaudiostream":{"bitrate":0,"channels":6,"codec":"eac3","index":1,"language":"eng","name":"E-AC3 5.1 @ 768 kbps [Atmos] - DD+ 6 channels"},"partymode":false,"repeat":"off","shuffled":false,"speed":1,"time":{"hours":0,"milliseconds":297,"minutes":2,"seconds":37},"totaltime":{"hours":2,"milliseconds":622,"minutes":23,"seconds":11}}}
foreach my $tag (keys %{$value}) {
readingsBulkUpdate($hash, "currentAudioStream_$tag", $value->{$tag});
}
}
elsif($key eq 'muted') { elsif($key eq 'muted') {
$key = 'mute'; $key = 'mute';
$value = ($value ? 'on' : 'off'); $value = ($value ? 'on' : 'off');
@ -1927,6 +1940,7 @@ sub KODI_HTTP_Request($$@)
<li><b>audiolibrary</b> - Possible values: cleanfinished, cleanstarted, remove, scanfinished, scanstarted, update</li> <li><b>audiolibrary</b> - Possible values: cleanfinished, cleanstarted, remove, scanfinished, scanstarted, update</li>
<li><b>currentAlbum</b> - album of the current song/musicvideo</li> <li><b>currentAlbum</b> - album of the current song/musicvideo</li>
<li><b>currentArtist</b> - artist of the current song/musicvideo</li> <li><b>currentArtist</b> - artist of the current song/musicvideo</li>
<li><b>currentAudioStream_*</b> - informations about currently active audio stream</li>
<li><b>currentMedia</b> - file/URL of the media item being played</li> <li><b>currentMedia</b> - file/URL of the media item being played</li>
<li><b>currentTitle</b> - title of the current media item</li> <li><b>currentTitle</b> - title of the current media item</li>
<li><b>currentTrack</b> - track of the current song/musicvideo</li> <li><b>currentTrack</b> - track of the current song/musicvideo</li>