Max.Anzahl Player eintragen --> ID Squeeze Player eintragen 2. Konfiguration Playlisten für Radiosender ergänzen --> Max.Anzahl Radiosender eintragen --> Name Radiosender eintragen (Name Syntax wie im LMS eingetragen!) 3. Konfiguration Playlisten für Playlisten/Albums ergänzen --> Max.Anzahl Playlisten eintragen --> Name Playliste eintragen (Name Syntax wie im LMS eingetragen!) 4. Script 1x über Console starten. Es werden alle Komponenten automatsich angelegt. Bei Ergänzung oder Änderung der Listen für Radiossender und Playlisten oder bei Erweiterung durch weitere Player Script nach Änderung noch 1x über Console ausführen. */ if ($_IPS['SENDER'] == "Execute") // Nur über Console ausführbar { //###################################################### Beginn K o n f i g u r a t i o n #################################### // Konfiguration Player $player_anz = 3; // Max Anzahl der Player eintragen $playerID1 = 49379; $playerID2 = 42691; $playerID3 = 36326; // $playerID4 = xxxxx; // $playerID5 = xxxxx; // $playerID6 = xxxxx; // $playerID7 = xxxxx; // $playerID8 = xxxxx; // $playerID9 = xxxxx; // $playerID10 = xxxxx; // Konfiguration Playlisten für Radiosender ergänzen $radio_max = 5; // Anzahl der konfigurierten Plätze $radio0 = ' - - - '; $radio1 = 'Radio Kinder'; $radio2 = 'Radio Schlager'; $radio3 = 'Radio Regional'; $radio4 = 'Radio Hits'; $radio5 = 'Radio Weihnachten'; $radio6 = ''; $radio7 = ''; $radio8 = ''; $radio9 = ''; $radio10 = ''; // Konfiguration Playlisten für Playlisten/Albums ergänzen $play_max = 2; // Anzahl der konfigurierten Plätze $play0 = ' - - - '; $play1 = 'Karat'; $play2 = 'Eros Ramazzotti'; $play3 = 'Schlager Oldies'; $play4 = ''; $play5 = ''; $play6 = ''; $play7 = ''; $play8 = ''; $play9 = ''; $play10 = ''; //###################################################### E n d e K o n f i g u r a t i o n ########################################## //Anlegen eines Variablenprofils für Radiosender @IPS_DeleteVariableProfile("Auswahl_Radiosender"); //Löschen des vorhanden Profiles IPS_CreateVariableProfile("Auswahl_Radiosender", 1); //Profil Neu anlegen Typ Integer IPS_SetVariableProfileAssociation("Auswahl_Radiosender", 0, $radio0, "Speaker", -1); if ($radio_max >=1) { IPS_SetVariableProfileAssociation("Auswahl_Radiosender", 1, $radio1, "Speaker", -1);} if ($radio_max >=2) { IPS_SetVariableProfileAssociation("Auswahl_Radiosender", 2, $radio2, "Speaker", -1);} if ($radio_max >=3) { IPS_SetVariableProfileAssociation("Auswahl_Radiosender", 3, $radio3, "Speaker", -1);} if ($radio_max >=4) { IPS_SetVariableProfileAssociation("Auswahl_Radiosender", 4, $radio4, "Speaker", -1);} if ($radio_max >=5) { IPS_SetVariableProfileAssociation("Auswahl_Radiosender", 5, $radio5, "Speaker", -1);} if ($radio_max >=6) { IPS_SetVariableProfileAssociation("Auswahl_Radiosender", 6, $radio6, "Speaker", -1);} if ($radio_max >=7) { IPS_SetVariableProfileAssociation("Auswahl_Radiosender", 7, $radio7, "Speaker", -1);} if ($radio_max >=8) { IPS_SetVariableProfileAssociation("Auswahl_Radiosender", 8, $radio8, "Speaker", -1);} if ($radio_max >=9) { IPS_SetVariableProfileAssociation("Auswahl_Radiosender", 9, $radio9, "Speaker", -1);} if ($radio_max >=10) { IPS_SetVariableProfileAssociation("Auswahl_Radiosender", 10, $radio10, "Speaker", -1);} //Anlegen eines Variablenprofils für Playliste @IPS_DeleteVariableProfile("Auswahl_Playliste"); //Löschen des vorhanden Profiles IPS_CreateVariableProfile("Auswahl_Playliste", 1); //Profil Neu anlegen Typ Integer IPS_SetVariableProfileAssociation("Auswahl_Playliste", 0, $play0, "Speaker", -1); if ($play_max >=1) { IPS_SetVariableProfileAssociation("Auswahl_Playliste", 1, $play1, "Speaker", -1);} if ($play_max >=2) { IPS_SetVariableProfileAssociation("Auswahl_Playliste", 2, $play2, "Speaker", -1);} if ($play_max >=3) { IPS_SetVariableProfileAssociation("Auswahl_Playliste", 3, $play3, "Speaker", -1);} if ($play_max >=4) { IPS_SetVariableProfileAssociation("Auswahl_Playliste", 4, $play4, "Speaker", -1);} if ($play_max >=5) { IPS_SetVariableProfileAssociation("Auswahl_Playliste", 5, $play5, "Speaker", -1);} if ($play_max >=6) { IPS_SetVariableProfileAssociation("Auswahl_Playliste", 6, $play6, "Speaker", -1);} if ($play_max >=7) { IPS_SetVariableProfileAssociation("Auswahl_Playliste", 7, $play7, "Speaker", -1);} if ($play_max >=8) { IPS_SetVariableProfileAssociation("Auswahl_Playliste", 8, $play8, "Speaker", -1);} if ($play_max >=9) { IPS_SetVariableProfileAssociation("Auswahl_Playliste", 9, $play9, "Speaker", -1);} if ($play_max >=10) { IPS_SetVariableProfileAssociation("Auswahl_Playliste", 10, $play10, "Speaker", -1);} //Auswahllisten für aller Player anlegen $i = 0; for ($i; $i < $player_anz; $i++) { //Zuordnung Player ID if ($i == 1-1) {$playerID = $playerID1;} if ($i == 2-1) {$playerID = $playerID2;} if ($i == 3-1) {$playerID = $playerID3;} if ($i == 4-1) {$playerID = $playerID4;} if ($i == 5-1) {$playerID = $playerID5;} if ($i == 6-1) {$playerID = $playerID6;} if ($i == 7-1) {$playerID = $playerID7;} if ($i == 8-1) {$playerID = $playerID8;} if ($i == 9-1) {$playerID = $playerID9;} if ($i == 10-1) {$playerID = $playerID10;} //übergeordnete Instanz/Kategorie identifizieren //$name_player = IPS_GetName ($playerID); // Name Instanz $parentID = IPS_GetParent($playerID); // ID von übergelagerten Verzeichnis // Variablen anlegen $akt_radiosenderID = CreateVariableByName($parentID, "Aktuelle Radiosender", 1,"Auswahl_Radiosender",10); $akt_playlistID = CreateVariableByName($parentID, "Aktuelle Playliste", 1,"Auswahl_Playliste",11); // Variablenprofil bei Variable aktualisieren IPS_SetVariableCustomProfile ($akt_radiosenderID, 'Auswahl_Radiosender'); IPS_SetVariableCustomProfile ($akt_playlistID, 'Auswahl_Playliste'); //Script Auswahl Radiosender erzeugen $scriptinhalt = '= 1) { if ($radio1 <> "") { LSQ_LoadPlaylist($playerID, $radio1); // Lade Radiosender IPS_Sleep (1000); LSQ_Play($playerID); //play SetValue($akt_playlistID,0); // Playliste zurücksetzen } break; } case 2: if ($radio_max >= 2) { if ($radio2 <> "") { LSQ_LoadPlaylist($playerID, $radio2); // Lade Radiosender IPS_Sleep (1000); LSQ_Play($playerID); //play SetValue($akt_playlistID,0); // Playliste zurücksetzen } break; } case 3: if ($radio_max >= 3) { if ($radio3 <> "") { LSQ_LoadPlaylist($playerID, $radio3); // Lade Radiosender IPS_Sleep (1000); LSQ_Play($playerID); //play SetValue($akt_playlistID,0); // Playliste zurücksetzen } break; } case 4: if ($radio_max >= 4) { if ($radio4 <> "") { LSQ_LoadPlaylist($playerID, $radio4); // Lade Radiosender IPS_Sleep (1000); LSQ_Play($playerID); //play SetValue($akt_playlistID,0); // Playliste zurücksetzen } break; } case 5: if ($radio_max >= 5) { if ($radio5 <> "") { LSQ_LoadPlaylist($playerID, $radio5); // Lade Radiosender IPS_Sleep (1000); LSQ_Play($playerID); //play SetValue($akt_playlistID,0); // Playliste zurücksetzen } break; } case 6: if ($radio_max >= 6) { if ($radio6 <> "") { LSQ_LoadPlaylist($playerID, $radio6); // Lade Radiosender IPS_Sleep (1000); LSQ_Play($playerID); //play SetValue($akt_playlistID,0); // Playliste zurücksetzen } break; } case 7: if ($radio_max >= 7) { if ($radio7 <> "") { LSQ_LoadPlaylist($playerID, $radio7); // Lade Radiosender IPS_Sleep (1000); LSQ_Play($playerID); //play SetValue($akt_playlistID,0); // Playliste zurücksetzen } break; } case 8: if ($radio_max >= 8) { if ($radio8 <> "") { LSQ_LoadPlaylist($playerID, $radio8); // Lade Radiosender IPS_Sleep (1000); LSQ_Play($playerID); //play SetValue($akt_playlistID,0); // Playliste zurücksetzen } break; } case 9: if ($radio_max >= 9) { if ($radio9 <> "") { LSQ_LoadPlaylist($playerID, $radio9); // Lade Radiosender IPS_Sleep (1000); LSQ_Play($playerID); //play SetValue($akt_playlistID,0); // Playliste zurücksetzen } break; } case 10: if ($radio_max >= 10) { if ($radio10 <> "") { LSQ_LoadPlaylist($playerID, $radio10); // Lade Radiosender IPS_Sleep (1000); LSQ_Play($playerID); //play SetValue($akt_playlistID,0); // Playliste zurücksetzen } break; } } '; $scriptID = @IPS_GetScriptIDByName('Auswahl Radiosender', $akt_radiosenderID); //Abfrage ob Script schon exisitiert if ($scriptID === false) { CreateScriptByName('Auswahl Radiosender', $akt_radiosenderID, $scriptinhalt); //Script neu anlegen // Anlegen Ereignis bei Änderung der Variable Auswahl Playliste $scriptID = IPS_GetScriptIDByName ('Auswahl Radiosender', $akt_radiosenderID); // Script ID ermitteln $eventID = IPS_CreateEvent(0); //Ausgelöstes Ereignis IPS_SetEventTrigger($eventID, 1, $akt_radiosenderID); //Bei Änderung von Variable IPS_SetParent($eventID, $scriptID); //Ereignis zuordnen IPS_SetEventActive($eventID, true); //Ereignis aktivieren IPS_SetName ($eventID, 'Aktuallisierung Radiosender'); //Name Ereignis } else { IPS_SetScriptContent($scriptID, $scriptinhalt); // Script Inhalt überschreiben } //Script Auswahl Playlisten erzeugen $scriptinhalt = '= 1) { if ($play1 <> "") { LSQ_LoadPlaylist($playerID, $play1); // lade Playliste IPS_Sleep (1000); LSQ_Play($playerID); //play SetValue($akt_radiosenderID,0); // Radiosender liste zurücksetzen } break; } case 2: if ($play_max >= 2) { if ($play2 <> "") { LSQ_LoadPlaylist($playerID, $play2); // lade Playliste IPS_Sleep (1000); LSQ_Play($playerID); //play SetValue($akt_radiosenderID,0); // Radiosender liste zurücksetzen } break; } case 3: if ($play_max >= 3) { if ($play3 <> "") { LSQ_LoadPlaylist($playerID, $play3); // lade Playliste IPS_Sleep (1000); LSQ_Play($playerID); //play SetValue($akt_radiosenderID,0); // Radiosender liste zurücksetzen } break; } case 4: if ($play_max >= 4) { if ($play4 <> "") { LSQ_LoadPlaylist($playerID, $play4); // lade Playliste IPS_Sleep (1000); LSQ_Play($playerID); //play SetValue($akt_radiosenderID,0); // Radiosender liste zurücksetzen } break; } case 5: if ($play_max >= 5) { if ($play5 <> "") { LSQ_LoadPlaylist($playerID, $play5); // lade Playliste IPS_Sleep (1000); LSQ_Play($playerID); //play SetValue($akt_radiosenderID,0); // Radiosender liste zurücksetzen } break; } case 6: if ($play_max >= 6) { if ($play6 <> "") { LSQ_LoadPlaylist($playerID, $play6); // lade Playliste IPS_Sleep (1000); LSQ_Play($playerID); //play SetValue($akt_radiosenderID,0); // Radiosender liste zurücksetzen } break; } case 7: if ($play_max >= 7) { if ($play7 <> "") { LSQ_LoadPlaylist($playerID, $play7); // lade Playliste IPS_Sleep (1000); LSQ_Play($playerID); //play SetValue($akt_radiosenderID,0); // Radiosender liste zurücksetzen } break; } case 8: if ($play_max >= 8) { if ($play8 <> "") { LSQ_LoadPlaylist($playerID, $play8); // lade Playliste IPS_Sleep (1000); LSQ_Play($playerID); //play SetValue($akt_radiosenderID,0); // Radiosender liste zurücksetzen } break; } case 9: if ($play_max >= 9) { if ($play9 <> "") { LSQ_LoadPlaylist($playerID, $play9); // lade Playliste IPS_Sleep (1000); LSQ_Play($playerID); //play SetValue($akt_radiosenderID,0); // Radiosender liste zurücksetzen } break; } case 10: if ($play_max >= 10) { if ($play10 <> "") { LSQ_LoadPlaylist($playerID, $play10); // lade Playliste IPS_Sleep (1000); LSQ_Play($playerID); //play SetValue($akt_radiosenderID,0); // Radiosender liste zurücksetzen } break; } } '; $scriptID = @IPS_GetScriptIDByName('Auswahl Playliste', $akt_playlistID); //Abfrage ob Script schon exisitiert if ($scriptID === false) { CreateScriptByName('Auswahl Playliste', $akt_playlistID, $scriptinhalt); //Script neu anlegen // Anlegen Ereignis bei Änderung der Variable Auswahl Playliste $scriptID = IPS_GetScriptIDByName ('Auswahl Playliste', $akt_playlistID); // Script ID ermitteln $eventID = IPS_CreateEvent(0); //Ausgelöstes Ereignis IPS_SetEventTrigger($eventID, 1, $akt_playlistID); //Bei Änderung von Variable IPS_SetParent($eventID, $scriptID); //Ereignis zuordnen IPS_SetEventActive($eventID, true); //Ereignis aktivieren IPS_SetName ($eventID, 'Aktuallisierung Playlist'); //Name Ereignis } else { IPS_SetScriptContent($scriptID, $scriptinhalt); // Script Inhalt überschreiben } } // Ende Schleife Player Anzahl } // Ende Ausführung per Console //################################################################################################################# function CreateEventIDByName($id, $name, $type) { $eid = @IPS_GetEventIDByName($name, $id); if($eid===false) { $eid = IPS_CreateEvent($type); IPS_SetParent($eid, $id); IPS_SetName($eid, $name); } return $eid; } function CreateLinkByName($id, $name, $link, $pos) { global $IPS_SELF; $vid = @IPS_GetLinkIDByName($name, $id); if($vid === false) { $vid = IPS_CreateLink(); IPS_SetParent($vid, $id); IPS_SetName($vid, $name); IPS_SetInfo($vid, "this Link was created by script #$IPS_SELF"); IPS_SetPosition($vid,$pos); IPS_SetLinkTargetID($vid, $link); // Link verknüpfen } return $vid; } function CreateInstanzByName($id, $name, $type, $pos) { global $IPS_SELF; $vid = @IPS_GetInstanceIDByName($name, $id); if($vid === false) { $vid = IPS_CreateInstance($type); IPS_SetParent($vid, $id); IPS_SetName($vid, $name); IPS_SetInfo($vid, "this instanz was created by script #$IPS_SELF"); IPS_SetPosition($vid,$pos); } return $vid; } function CreateVariableByName($id, $name, $type, $profile = "", $pos) { global $IPS_SELF; $vid = @IPS_GetVariableIDByName($name, $id); if($vid === false) { $vid = IPS_CreateVariable($type); IPS_SetParent($vid, $id); IPS_SetName($vid, $name); IPS_SetInfo($vid, "this variable was created by script #$IPS_SELF"); if($profile !== "") { IPS_SetVariableCustomProfile($vid, $profile); } IPS_SetPosition($vid,$pos); } return $vid; } function CreateScriptByName($ScriptNAME, $ParentID, $ScriptTEXT) { global $IPS_SELF,$ScriptID; $ScriptID = @IPS_GetScriptIDByName($ScriptNAME, $ParentID); if ($ScriptID == 0){ $ScriptID = IPS_CreateScript(0); IPS_SetName($ScriptID, $ScriptNAME); IPS_SetParent($ScriptID, $ParentID); IPS_SetInfo($ScriptID, "This script was created by: #$IPS_SELF#"); $ScriptPath = $ScriptID.".ips.php"; //Skriptdatei IPS_SetScriptFile($ScriptID, $ScriptPath); IPS_SetHidden($ScriptID, true); IPS_SetScriptContent($ScriptID, $ScriptTEXT); } return $ScriptID; }