Hi
Ekkehard.
Bei mir steht in dem Sonos modul in der Variablen „Details“ ein html string drin!
Dieser sieht beispielsweise im original so aus:
<table width="100%">
<tr>
<td>
<div style="text-align: right;">
<div><b>Thank God It's Over [Explicit]</b></div>
<div> </div>
<div>Stone Sour</div>
<div>Hydrograd [Explicit]</div>
<div> </div>
<div>0:01:33 / 0:03:36</div>
</div>
</td>
<td width="170px" valign="top">
<div style="width: 170px; height: 170px; perspective: 170px; right: 0px; margin-bottom: 10px;">
<img src="http://192.168.0.64:1400/getaa?s=1&u=x-sonosapi-hls-static%3acatalog%252ftracks%252fB07VW752D5%252f%3fsid%3d201%26flags%3d0%26sn%3d1" style="max-width: 170px; max-height: 170px; -webkit-box-reflect: below 0 -webkit-gradient(linear, left top, left bottom, from(transparent), color-stop(0.88, transparent), to(rgba(255, 255, 255, 0.5))); transform: rotateY(-10deg) translateZ(-35px);">
</div>
</td>
</tr>
</table>
Da mir aber größe und inhalt für meine minivorschau im footer meiner View zu viel/groß war habe ich das ganze wenig umgebaut und in eine neue stringvariable geschrieben. diese wird dann an die htmlbox angebunden.
hier mal das ergebnis:
So sieht es aus, wenn Sonos nicht spielt
und so wenn gerade etwas läuft
das Cover wird durch das sonos modul automatisch alle 5s aktualisiert.
und hier mein Script
<?php
$nowPlaying = GetValueString(13486);
$cover = GetValueString(12724);
// ------------------------------------------------------------- //
// KEIN STREAM
if (GetValueString(40209)=="") {
$seperator = strpos($nowPlaying, "|");
$artist = substr($nowPlaying, $seperator+2);
$title = substr($nowPlaying, 0, $seperator-1);
if($nowPlaying!=str_replace("http","",$nowPlaying)) {
$artist = "Werbung";
$title = "";
}
}
// ------------------------------------------------------------- //
// STREAM
else {
$stream = GetValueString(40209);
$seperator = strpos($nowPlaying, "-");
$artist = substr($nowPlaying,0, $seperator-1);
$title = substr($nowPlaying, $seperator+2);
}
// ------------------------------------------------------------- //
// ------------------------------------------------------------- //
// ------------------------------------------------------------- //
// ------------------------------------------------------------- //
// ANPASSUNG DER LÄNGE
if (strlen($artist) > 19){
$artist = substr($artist, 0,19);
$artist .="..";
}
if (strlen($title) > 17){
$title = substr($title, 0,17);
$title .="..";
}
// ------------------------------------------------------------- //
// Hat sich Artist/Title oder Cover geändert?
if ((strcmp($artist, GetValueString(35679)) !== 0)
or (strcmp($title, GetValueString(29230)) !== 0)
or (strcmp($cover, GetValueString(44493)) !== 0) )
{
$htmlText = '<table width="284px" height="100px" cellspacing="0" cellpadding="2" border="0px" style="margin-top:-5px;">
<tr>
<td width="184px" align="center" valign="top" style="padding-top:12px;"><b>' .$title. '</b><br>' .$artist. '</td>
<td width="100px" align="center" valign="middle">
<img src="' .$cover. '" style="max-width: 80px; max-height: 80px;">
</td>
</tr>
</table>';
SetValueString(35679,$artist);
SetValueString(29230,$title);
SetValueString(44493,$cover);
SetValueString(15043, $htmlText);
}