API PHP-Class for TeamSpeak 3 MusicBot (SinusBot)
Sie können den SinusBot (früher auch SoundBoard), ein Musikbot für den eigenen TeamSpeak 3 Server, auch über die eigene Webseite steuern und verwalten. Wir stellen eine API PHP-Class bereit, mit der sich auch die MusikBots von TS3index.com steuern lassen.
You can retrieve information with the PHP-Class. It is now possible to view the display of the current status and the current title of the track or stream on your own homepage via PHP.
Example
Connect to server
1 2 3 |
include("sinusbot.class.php"); $sinusbot = new SinusBot("http://srvXX.ts3index.com:8087", "BOTUUID"); // URL to webinterface and BOT-ID $sinusbot->login("admin", "*******"); // Login user and password from webinterface |
A list of all instances and echo from title and artist
1 2 3 4 5 6 7 8 9 |
$instances = $sinusbot->getInstances(); // All instances for ($i = 0; $i < count($instances); $i++) { $status = $sinusbot->getStatus($instances[$i]['uuid']); if ($status['playing']) { echo $instances[$i]["nick"].' spielt '.(($status["currentTrack"]["type"] == "url") ? $status["currentTrack"]["tempTitle"] : $status["currentTrack"]["title"]).' von '.(($status["currentTrack"]["type"] == "url") ? $status["currentTrack"]["tempArtist"] : $status["currentTrack"]["artist"]).'<br>'; } else { echo $instances[$i]["nick"].' ist gestoppt.<br>'; } } |
All files
1 2 3 4 5 |
$files = $sinusbot->getFiles(); // Query all files for ($i = 0; $i < count($files); $i++) { // List echo $files[$i]['uuid'].': '.$files[$i]['artist'].' - '.$files[$i]['title'].' ('.$files[$i]['album'].')<br>'; } |
Actions that can be executed
The parameter $instanceUUID is optional for every function having this parameter. However, if omitting it, you must have selected the instance via selectInstance() beforehand.
1 2 3 4 5 6 7 8 9 |
$sinusbot->selectInstance("INSTANCEUUID"); // select Instance $sinusbot->play("TRACK-UUID", "INSTANCEUUID"); // Play track by UUID $sinusbot->playPrevious("INSTANCEUUID"); // Play previous track $sinusbot->playNext("INSTANCEUUID"); // Play next track $sinusbot->playRepeat(1, "INSTANCEUUID"); // Repeat playlist etc. $sinusbot->playShuffle(1, "INSTANCEUUID"); // Shuffle playlist etc. $sinusbot->stop("INSTANCEUUID"); // Stop playing $sinusbot->setVolume(50, "INSTANCEUUID"); // Set volume |
Download/Upload an Track per URL (YouTube, MP3-Files, …)
1 |
$sinusbot->addJob("https://www.youtube.com/watch?v=xrWYL4sHpuM"); |
Edit instance settings/infos
1 2 3 4 |
$data = array(); $data["nick"] = "New Nickname"; $data["serverHost"] = "127.0.0.1"; $sinusbot->settings($data, "INSTANCEUUID"); |