• If you need help or want to discuss things, you now can also join us on our Discord Server!
  • A first preview of the unlimited version of SinusBot can be found in the Upcoming Changes thread. A version for Windows will follow, but we don't have a release date, yet.

Solved API artist not sent

Status
Not open for further replies.

Dooley_labs

Donor
is awesome!
Insider
Operating System: Linux
SinusBot Version: 0.9.21-87a90ce
TS3 Version: 3.0.19.4

Problem Description
I'm using the API to output the artist of a song to my webpage, however, it does not work anymore. It works with streams from the radio menu, though. Seems like it may be a bug. Below is the code I'm using to get the artist's name:

I'm looking into it on my side to see if there is a typo or deprecation in my code, but there does not appear to be.
All assistance is greatly appreciated!

Code:
<?php
error_reporting('E_ERROR');
include("sinusbot.class.php");
include("config.php");
$sinusbot = new SinusBot($ipport);
$sinusbot->login($user, $passwd);
$status = $sinusbot->getStatus($inst);
$track = (($status["currentTrack"]["type"] == "url") ? $status["currentTrack"]["tempTitle"] : $status["currentTrack"]["title"]);
$artist = $status["currentTrack"]["tempArtist"];
$name = $track;
$track = preg_replace('^ ^', '+', $track);

if(!empty($artist)) {
echo $name."<br /><div id='artist'>".$artist."</div>";
} else {
echo $name."<br />&nbsp;";
}
 

Dooley_labs

Donor
is awesome!
Insider
I found my bug, though if I could find an updated version of sinusbot.class.php, that'd be helpful.

My bug is solved in the code below:

Code:
<?php
error_reporting('E_ERROR');
include("sinusbot.class.php");
include("config.php");
$sinusbot = new SinusBot($ipport);
$sinusbot->login($user, $passwd);
$status = $sinusbot->getStatus($inst);
$track = (($status["currentTrack"]["type"] == "url") ? $status["currentTrack"]["tempTitle"] : $status["currentTrack"]["title"]);
$artist = (($status["currentTrack"]["type"] == "url") ? $status["currentTrack"]["tempArtist"] : $status["currentTrack"]["artist"]);
$name = $track;
$track = preg_replace('^ ^', '+', $track);

if(!empty($artist)) {
echo $name."<br /><div id='artist'>".$artist."</div>";
} else {
echo $name."<br />&nbsp;";
}
 
Status
Not open for further replies.
Top