From c92cc38e2498382cecaa305fd36f93450ed3a10a Mon Sep 17 00:00:00 2001 From: vbs2 <> Date: Fri, 22 Jan 2016 20:49:44 +0000 Subject: [PATCH] 70_XBMC: added reading stereoscopicmode and Id property git-svn-id: https://svn.fhem.de/fhem/trunk@10601 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/70_XBMC.pm | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/fhem/FHEM/70_XBMC.pm b/fhem/FHEM/70_XBMC.pm index 1ef490a6b..3d3b4c423 100644 --- a/fhem/FHEM/70_XBMC.pm +++ b/fhem/FHEM/70_XBMC.pm @@ -9,6 +9,7 @@ # ############################################## +# $Id$ package main; @@ -310,13 +311,16 @@ sub XBMC_Update($) $obj = { "method" => "GUI.GetProperties", "params" => { - "properties" => ["skin","fullscreen"] + "properties" => ["skin","fullscreen", "stereoscopicmode"] } }; XBMC_Call($hash,$obj,1); - - #-1 -> update all existing players - XBMC_PlayerUpdate($hash,-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); XBMC_UpdatePlayerItem($hash); } @@ -557,12 +561,6 @@ sub XBMC_PlayerOnPlay($$) $hash->{PendingEvents}{$id} = $event; 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($$) @@ -594,6 +592,11 @@ sub XBMC_ProcessNotification($$) } elsif($obj->{method} eq "Player.OnStop") { 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") { readingsSingleUpdate($hash,"playStatus",'paused',1); @@ -601,6 +604,7 @@ sub XBMC_ProcessNotification($$) elsif($obj->{method} eq "Player.OnPlay") { XBMC_ResetMediaReadings($hash); XBMC_PlayerOnPlay($hash, $obj); + XBMC_Update($hash); } elsif($obj->{method} =~ /(Playlist|AudioLibrary|VideoLibrary|System).On(.*)/) { readingsSingleUpdate($hash,lc($1),lc($2),1); @@ -763,6 +767,10 @@ sub XBMC_CreateReading($$$) { # we dont want to create a "streamdetails" reading $key = undef; } + elsif($key eq 'stereoscopicmode') { + $value = $value->{mode}; + } + if(ref($value) eq 'ARRAY') { $value = join(',',@$value); }