2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +00:00

DLNARenderer: fix renew subscription warnings

git-svn-id: https://svn.fhem.de/fhem/trunk@15642 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
dominikkarall 2017-12-18 21:50:28 +00:00
parent 0b9ce9e805
commit 40a60f9f46
2 changed files with 24 additions and 4 deletions

View File

@ -1,5 +1,6 @@
# 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.
- bugfix: 98_DLNARenderer: fix renew subscription warnings
- feature: 98_BOSEST: support Audio Notification API for TTS - feature: 98_BOSEST: support Audio Notification API for TTS
no more minidlna installation needed no more minidlna installation needed
only supported for up to 100 characters only supported for up to 100 characters

View File

@ -2,6 +2,11 @@
# Author: dominik.karall@gmail.com # Author: dominik.karall@gmail.com
# $Id$ # $Id$
# #
# v2.0.6 - 20171209
# - FEATURE: support acceptedUDNs for UDN whitelisting (thx@MichaelT!)
# - BUGFIX: fix renew subscriptions errors on offline devices
# - BUGFIX: fix renew warnings, now only on log level 5 (thx@mumpitzstuff!)
#
# v2.0.5 - 20170430 # v2.0.5 - 20170430
# - BUGFIX: fix "readings not updated" # - BUGFIX: fix "readings not updated"
# #
@ -187,13 +192,14 @@ sub DLNARenderer_Define($$) {
if(@param < 3) { if(@param < 3) {
#main #main
$hash->{UDN} = 0; $hash->{UDN} = 0;
my $VERSION = "v2.0.5"; my $VERSION = "v2.0.6";
$hash->{VERSION} = $VERSION; $hash->{VERSION} = $VERSION;
Log3 $hash, 3, "DLNARenderer: DLNA Renderer $VERSION"; Log3 $hash, 3, "DLNARenderer: DLNA Renderer $VERSION";
DLNARenderer_setupControlpoint($hash); DLNARenderer_setupControlpoint($hash);
DLNARenderer_startDlnaRendererSearch($hash); DLNARenderer_startDlnaRendererSearch($hash);
readingsSingleUpdate($hash,"state","initialized",1); readingsSingleUpdate($hash,"state","initialized",1);
addToDevAttrList($hash->{NAME}, "ignoreUDNs"); addToDevAttrList($hash->{NAME}, "ignoreUDNs");
addToDevAttrList($hash->{NAME}, "acceptedUDNs");
addToDevAttrList($hash->{NAME}, "defaultRoom"); addToDevAttrList($hash->{NAME}, "defaultRoom");
return undef; return undef;
} }
@ -220,9 +226,6 @@ sub DLNARenderer_Define($$) {
addToDevAttrList($hash->{NAME}, "channel_09"); addToDevAttrList($hash->{NAME}, "channel_09");
addToDevAttrList($hash->{NAME}, "channel_10"); addToDevAttrList($hash->{NAME}, "channel_10");
InternalTimer(gettimeofday() + 200, 'DLNARenderer_renewSubscriptions', $hash, 0);
InternalTimer(gettimeofday() + 60, 'DLNARenderer_updateStereoMode', $hash, 0);
return undef; return undef;
} }
@ -1257,6 +1260,12 @@ sub DLNARenderer_renewSubscriptionBlocking {
my ($string) = @_; my ($string) = @_;
my ($name) = split("\\|", $string); my ($name) = split("\\|", $string);
my $hash = $main::defs{$name}; my $hash = $main::defs{$name};
$SIG{__WARN__} = sub {
my ($called_from) = caller(0);
my $wrn_text = shift;
Log3 $hash, 5, "DLNARenderer: ".$called_from.", ".$wrn_text;
};
#register callbacks #register callbacks
#urn:upnp-org:serviceId:AVTransport #urn:upnp-org:serviceId:AVTransport
@ -1290,6 +1299,10 @@ sub DLNARenderer_addedDevice {
#ignoreUDNs #ignoreUDNs
return undef if(AttrVal($hash->{NAME}, "ignoreUDNs", "") =~ /$udn/); return undef if(AttrVal($hash->{NAME}, "ignoreUDNs", "") =~ /$udn/);
#acceptedUDNs
my $acceptedUDNs = AttrVal($hash->{NAME}, "acceptedUDNs", "");
return undef if($acceptedUDNs ne "" && $acceptedUDNs !~ /$udn/);
my $foundDevice = 0; my $foundDevice = 0;
my @allDLNARenderers = DLNARenderer_getAllDLNARenderers($hash); my @allDLNARenderers = DLNARenderer_getAllDLNARenderers($hash);
@ -1371,6 +1384,9 @@ sub DLNARenderer_addedDevice {
} }
} }
$DLNARendererHash->{helper}{caskeidClients} = substr($DLNARendererHash->{helper}{caskeidClients}, 1) if($DLNARendererHash->{helper}{caskeidClients} ne ""); $DLNARendererHash->{helper}{caskeidClients} = substr($DLNARendererHash->{helper}{caskeidClients}, 1) if($DLNARendererHash->{helper}{caskeidClients} ne "");
InternalTimer(gettimeofday() + 200, 'DLNARenderer_renewSubscriptions', $DLNARendererHash, 0);
InternalTimer(gettimeofday() + 60, 'DLNARenderer_updateStereoMode', $DLNARendererHash, 0);
} }
} }
@ -1384,6 +1400,9 @@ sub DLNARenderer_removedDevice($$) {
readingsSingleUpdate($deviceHash, "presence", "offline", 1); readingsSingleUpdate($deviceHash, "presence", "offline", 1);
readingsSingleUpdate($deviceHash, "state", "offline", 1); readingsSingleUpdate($deviceHash, "state", "offline", 1);
RemoveInternalTimer($deviceHash, 'DLNARenderer_renewSubscriptions');
RemoveInternalTimer($deviceHash, 'DLNARenderer_updateStereoMode');
} }
############################### ###############################