70_XBMC: added attribute "disable", added reading "tvshowid"
git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@9661 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||||
# Do not insert empty lines here, update check depends on it.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- feature: 70_XBMC: -added disable attribute
|
||||||
|
-added reading tvshowid
|
||||||
- feature: new module 00_SIGNALduino.pm and 90_SIGNALduino_un: added
|
- feature: new module 00_SIGNALduino.pm and 90_SIGNALduino_un: added
|
||||||
SIGNALduino module and firmware
|
SIGNALduino module and firmware
|
||||||
- feature: new module 14_Hideki.pm: added module for sensors with hideki
|
- feature: new module 14_Hideki.pm: added module for sensors with hideki
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ sub XBMC_Initialize($$)
|
|||||||
$hash->{ReadFn} = "XBMC_Read";
|
$hash->{ReadFn} = "XBMC_Read";
|
||||||
$hash->{ReadyFn} = "XBMC_Ready";
|
$hash->{ReadyFn} = "XBMC_Ready";
|
||||||
$hash->{UndefFn} = "XBMC_Undefine";
|
$hash->{UndefFn} = "XBMC_Undefine";
|
||||||
$hash->{AttrList} = "fork:enable,disable compatibilityMode:xbmc,plex offMode:quit,hibernate,shutdown,standby updateInterval " . $readingFnAttributes;
|
$hash->{AttrFn} = "XBMC_Attr";
|
||||||
|
$hash->{AttrList} = "fork:enable,disable compatibilityMode:xbmc,plex offMode:quit,hibernate,shutdown,standby updateInterval disable:1,0 " . $readingFnAttributes;
|
||||||
|
|
||||||
$data{RC_makenotify}{XBMC} = "XBMC_RCmakenotify";
|
$data{RC_makenotify}{XBMC} = "XBMC_RCmakenotify";
|
||||||
$data{RC_layout}{XBMC_RClayout} = "XBMC_RClayout";
|
$data{RC_layout}{XBMC_RClayout} = "XBMC_RClayout";
|
||||||
@@ -75,6 +76,28 @@ sub XBMC_Define($$)
|
|||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub XBMC_Attr($$$$)
|
||||||
|
{
|
||||||
|
my ($cmd, $name, $attr, $value) = @_;
|
||||||
|
my $hash = $defs{$name};
|
||||||
|
|
||||||
|
if($attr eq "disable") {
|
||||||
|
if($cmd eq "set" && ($value || !defined($value))) {
|
||||||
|
XBMC_Disconnect($hash);
|
||||||
|
$hash->{STATE} = "Disabled";
|
||||||
|
} else {
|
||||||
|
if (AttrVal($hash->{NAME}, 'disable', 0)) {
|
||||||
|
$hash->{STATE} = "Initialized";
|
||||||
|
|
||||||
|
my $dev = $hash->{DeviceName};
|
||||||
|
$readyfnlist{"$name.$dev"} = $hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
# Force a connection attempt to XBMC as soon as possible
|
# Force a connection attempt to XBMC as soon as possible
|
||||||
# (e.g. you know you just started it and want to connect immediately without waiting up to 60 s)
|
# (e.g. you know you just started it and want to connect immediately without waiting up to 60 s)
|
||||||
sub XBMC_Connect($)
|
sub XBMC_Connect($)
|
||||||
@@ -99,13 +122,29 @@ sub XBMC_Connect($)
|
|||||||
} else {
|
} else {
|
||||||
$hash->{NEXT_OPEN} = 0; # force NEXT_OPEN used in DevIO
|
$hash->{NEXT_OPEN} = 0; # force NEXT_OPEN used in DevIO
|
||||||
}
|
}
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# kills child process trying to connect (if existing)
|
||||||
|
sub XBMC_KillConnectionChild($)
|
||||||
|
{
|
||||||
|
my ($hash) = @_;
|
||||||
|
|
||||||
|
return if !$hash->{CHILDPID};
|
||||||
|
|
||||||
|
kill 'KILL', $hash->{CHILDPID};
|
||||||
|
undef $hash->{CHILDPID};
|
||||||
|
}
|
||||||
|
|
||||||
sub XBMC_Ready($)
|
sub XBMC_Ready($)
|
||||||
{
|
{
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
|
|
||||||
|
if (AttrVal($hash->{NAME}, 'disable', 0)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if($hash->{Protocol} eq 'tcp') {
|
if($hash->{Protocol} eq 'tcp') {
|
||||||
if(AttrVal($hash->{NAME},'fork','disable') eq 'enable') {
|
if(AttrVal($hash->{NAME},'fork','disable') eq 'enable') {
|
||||||
if($hash->{CHILDPID} && !(kill 0, $hash->{CHILDPID})) {
|
if($hash->{CHILDPID} && !(kill 0, $hash->{CHILDPID})) {
|
||||||
@@ -153,10 +192,19 @@ sub XBMC_Undefine($$)
|
|||||||
|
|
||||||
RemoveInternalTimer($hash);
|
RemoveInternalTimer($hash);
|
||||||
|
|
||||||
|
XBMC_Disconnect($hash);
|
||||||
|
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub XBMC_Disconnect($)
|
||||||
|
{
|
||||||
|
my ($hash) = @_;
|
||||||
if($hash->{Protocol} eq 'tcp') {
|
if($hash->{Protocol} eq 'tcp') {
|
||||||
DevIo_CloseDev($hash);
|
DevIo_CloseDev($hash);
|
||||||
}
|
}
|
||||||
return undef;
|
|
||||||
|
XBMC_KillConnectionChild($hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub XBMC_Init($)
|
sub XBMC_Init($)
|
||||||
@@ -293,7 +341,7 @@ sub XBMC_PlayerGetItem($$)
|
|||||||
"method" => "Player.GetItem",
|
"method" => "Player.GetItem",
|
||||||
"params" => {
|
"params" => {
|
||||||
"properties" => ["artist", "album", "thumbnail", "file", "title",
|
"properties" => ["artist", "album", "thumbnail", "file", "title",
|
||||||
"track", "year", "streamdetails"]
|
"track", "year", "streamdetails", "tvshowid"]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if($playerid >= 0) {
|
if($playerid >= 0) {
|
||||||
@@ -387,7 +435,7 @@ sub XBMC_ResetMediaReadings($)
|
|||||||
# delete streamdetails readings
|
# delete streamdetails readings
|
||||||
# NOTE: we actually delete the readings (unlike the other readings)
|
# NOTE: we actually delete the readings (unlike the other readings)
|
||||||
# because they are stream count dependent
|
# because they are stream count dependent
|
||||||
fhem("deletereading $hash->{NAME} sd_.*");
|
fhem("deletereading $hash->{NAME} sd_.*", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub XBMC_ResetPlayerReadings($)
|
sub XBMC_ResetPlayerReadings($)
|
||||||
@@ -1588,8 +1636,10 @@ sub XBMC_HTTP_Request($$@)
|
|||||||
If XBMC does not run all the time it used to be the case that FHEM blocks because it cannot reach XBMC (only happened
|
If XBMC does not run all the time it used to be the case that FHEM blocks because it cannot reach XBMC (only happened
|
||||||
if TCP was used). If you encounter problems like FHEM not responding for a few seconds then you should set <code>attr <XBMC_device> fork enable</code>
|
if TCP was used). If you encounter problems like FHEM not responding for a few seconds then you should set <code>attr <XBMC_device> fork enable</code>
|
||||||
which will move the search for XBMC into a separate process.</li>
|
which will move the search for XBMC into a separate process.</li>
|
||||||
<li>updateInterval<br>
|
<li>updateInterval<br>
|
||||||
The interval which is used to check if Kodi is still alive (by sending a JSON ping) and also it is used to update current player item.</li>
|
The interval which is used to check if Kodi is still alive (by sending a JSON ping) and also it is used to update current player item.</li>
|
||||||
|
<li>disable<br>
|
||||||
|
Disables the device. All connections will be closed immediately.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user