70_XBMC: added reading stereoscopicmode and Id property

git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@10601 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
vbs2
2016-01-22 20:49:44 +00:00
parent 8a27594886
commit 2001f24f24

View File

@@ -9,6 +9,7 @@
# #
############################################## ##############################################
# $Id$
package main; package main;
@@ -310,12 +311,15 @@ sub XBMC_Update($)
$obj = { $obj = {
"method" => "GUI.GetProperties", "method" => "GUI.GetProperties",
"params" => { "params" => {
"properties" => ["skin","fullscreen"] "properties" => ["skin","fullscreen", "stereoscopicmode"]
} }
}; };
XBMC_Call($hash,$obj,1); XBMC_Call($hash,$obj,1);
#-1 -> update all existing players # the playerId in the message is not reliable
# xbmc is not able to assign the correct player so the playerid might be wrong
# http://forum.kodi.tv/showthread.php?tid=174872
# so we ask for the acutally running players by passing -1
XBMC_PlayerUpdate($hash, -1); XBMC_PlayerUpdate($hash, -1);
XBMC_UpdatePlayerItem($hash); XBMC_UpdatePlayerItem($hash);
@@ -557,12 +561,6 @@ sub XBMC_PlayerOnPlay($$)
$hash->{PendingEvents}{$id} = $event; $hash->{PendingEvents}{$id} = $event;
XBMC_Call($hash, $req,1); XBMC_Call($hash, $req,1);
} }
# the playerId in the message is not reliable
# xbmc is not able to assign the correct player so the playerid might be wrong
# http://forum.kodi.tv/showthread.php?tid=174872
# so we ask for the acutally running players by passing -1
XBMC_PlayerUpdate($hash, -1);
} }
sub XBMC_ProcessNotification($$) sub XBMC_ProcessNotification($$)
@@ -594,6 +592,11 @@ sub XBMC_ProcessNotification($$)
} }
elsif($obj->{method} eq "Player.OnStop") { elsif($obj->{method} eq "Player.OnStop") {
readingsSingleUpdate($hash,"playStatus",'stopped',1); readingsSingleUpdate($hash,"playStatus",'stopped',1);
#HACK: We want to fetch GUI.Properties here to update for example stereoscopicmode.
# When doing this here we still get the in-movie stereo mode. So we define a timer
# to invoke the update in some (tm) seconds
InternalTimer(time() + 2, "XBMC_Check", $hash, 0);
} }
elsif($obj->{method} eq "Player.OnPause") { elsif($obj->{method} eq "Player.OnPause") {
readingsSingleUpdate($hash,"playStatus",'paused',1); readingsSingleUpdate($hash,"playStatus",'paused',1);
@@ -601,6 +604,7 @@ sub XBMC_ProcessNotification($$)
elsif($obj->{method} eq "Player.OnPlay") { elsif($obj->{method} eq "Player.OnPlay") {
XBMC_ResetMediaReadings($hash); XBMC_ResetMediaReadings($hash);
XBMC_PlayerOnPlay($hash, $obj); XBMC_PlayerOnPlay($hash, $obj);
XBMC_Update($hash);
} }
elsif($obj->{method} =~ /(Playlist|AudioLibrary|VideoLibrary|System).On(.*)/) { elsif($obj->{method} =~ /(Playlist|AudioLibrary|VideoLibrary|System).On(.*)/) {
readingsSingleUpdate($hash,lc($1),lc($2),1); readingsSingleUpdate($hash,lc($1),lc($2),1);
@@ -763,6 +767,10 @@ sub XBMC_CreateReading($$$) {
# we dont want to create a "streamdetails" reading # we dont want to create a "streamdetails" reading
$key = undef; $key = undef;
} }
elsif($key eq 'stereoscopicmode') {
$value = $value->{mode};
}
if(ref($value) eq 'ARRAY') { if(ref($value) eq 'ARRAY') {
$value = join(',',@$value); $value = join(',',@$value);
} }