37_plex.pm: fix mediatype for playback commands
git-svn-id: https://svn.fhem.de/fhem/trunk@11501 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -962,7 +962,12 @@ plex_Set($$@)
|
||||
|
||||
}
|
||||
|
||||
plex_sendApiCmd( $hash, "http://$ip:$entry->{port}/player/playback/$cmd?type=video", "playback" );
|
||||
my $type = $params[0];
|
||||
$type = $hash->{currentMediaType} if( !$type );
|
||||
$type = "type=$type" if( $type );
|
||||
$type = "" if( !$type );
|
||||
|
||||
plex_sendApiCmd( $hash, "http://$ip:$entry->{port}/player/playback/$cmd?$type", "playback" );
|
||||
return undef;
|
||||
|
||||
} elsif( $cmd eq 'seekTo' ) {
|
||||
@@ -970,7 +975,12 @@ plex_Set($$@)
|
||||
return "usage: $cmd <value>" if( !defined($params[0]) );
|
||||
$params[0] =~ s/[^\d]//g;
|
||||
|
||||
plex_sendApiCmd( $hash, "http://$ip:$entry->{port}/player/playback/seekTo?type=video&offset=$params[0]", "parameters" );
|
||||
my $type = $params[1];
|
||||
$type = $hash->{currentMediaType} if( !$type );
|
||||
$type = "type=$type" if( $type );
|
||||
$type = "" if( !$type );
|
||||
|
||||
plex_sendApiCmd( $hash, "http://$ip:$entry->{port}/player/playback/seekTo?$type&offset=$params[0]", "parameters" );
|
||||
return undef;
|
||||
|
||||
} elsif( $cmd eq 'volume' || $cmd eq 'shuffle' || $cmd eq 'repeat' ) {
|
||||
@@ -981,7 +991,12 @@ plex_Set($$@)
|
||||
return "usage: $cmd [0/1/2]" if( $cmd eq 'repeat' && ($params[0] < 0 || $params[0] > 2) );
|
||||
return "usage: $cmd [0-100]" if( $cmd eq 'volume' && ($params[0] < 0 || $params[0] > 100) );
|
||||
|
||||
plex_sendApiCmd( $hash, "http://$ip:$entry->{port}/player/playback/setParameters?type=video&$cmd=$params[0]", "parameters" );
|
||||
my $type = $params[1];
|
||||
$type = $hash->{currentMediaType} if( !$type );
|
||||
$type = "type=$type" if( $type );
|
||||
$type = "" if( !$type );
|
||||
|
||||
plex_sendApiCmd( $hash, "http://$ip:$entry->{port}/player/playback/setParameters?$type&$cmd=$params[0]", "parameters" );
|
||||
return undef;
|
||||
|
||||
} elsif( $cmd eq 'home' || $cmd eq 'music' ) {
|
||||
@@ -2181,6 +2196,7 @@ plex_disappeared($$$)
|
||||
|
||||
if( my $chash = $modules{plex}{defptr}{$machineIdentifier} ) {
|
||||
delete $chash->{controllable};
|
||||
delete $chash->{currentMediaType};
|
||||
|
||||
readingsBeginUpdate($chash);
|
||||
readingsBulkUpdate($chash, 'presence', 'absent' );
|
||||
@@ -2285,6 +2301,12 @@ plex_parseTimeline($$$)
|
||||
if( $state =~ '\w*:(\w*) \w*:(\w*) .*:(\w*)' ) {
|
||||
$state = $1 if( $1 eq $2 && $2 eq $3 );
|
||||
}
|
||||
|
||||
if( $state =~ '(\w*):\w*' ) {
|
||||
$chash->{currentMediaType} = $1;
|
||||
} else {
|
||||
delete $chash->{currentMediaType};
|
||||
}
|
||||
plex_readingsBulkUpdateIfChanged($chash, 'state', $state );
|
||||
readingsEndUpdate($chash, 1);
|
||||
}
|
||||
@@ -3284,16 +3306,16 @@ Log 1, "!!!!!!!!!!";
|
||||
</li>
|
||||
<li>resume [<server>] <item>]<br>
|
||||
</li>
|
||||
<li>pause</li>
|
||||
<li>stop</li>
|
||||
<li>skipNext</li>
|
||||
<li>skipPrevious</li>
|
||||
<li>stepBack</li>
|
||||
<li>stepForward</li>
|
||||
<li>seekTo <value></li>
|
||||
<li>volume <value></li>
|
||||
<li>shuffle 0|1</li>
|
||||
<li>repeat 0|1|2</li>
|
||||
<li>pause [<type>]</li>
|
||||
<li>stop [<type>]</li>
|
||||
<li>skipNext [<type>]</li>
|
||||
<li>skipPrevious [<type>]</li>
|
||||
<li>stepBack [<type>]</li>
|
||||
<li>stepForward [<type>]</li>
|
||||
<li>seekTo <value> [<type>]</li>
|
||||
<li>volume <value> [<type>]</li>
|
||||
<li>shuffle 0|1 [<type>]</li>
|
||||
<li>repeat 0|1|2 [<type>]</li>
|
||||
<li>mirror [<server>] <item><br>
|
||||
show preplay screen for <item></li>
|
||||
<li>home</li>
|
||||
@@ -3343,8 +3365,8 @@ Log 1, "!!!!!!!!!!";
|
||||
...</pre><br>
|
||||
|
||||
<b><code>get <plex> ls /library/metadata/133999/children</code></b>
|
||||
<pre>...</pre><br>
|
||||
<br>if used from fhemweb album art ist displayed and keys and other items are klickable.<br>
|
||||
<pre> ...</pre><br>
|
||||
<br>if used from fhemweb album art can be displayed and keys and other items are klickable.<br><br>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user