• 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.

EN Wrong output of php

Status
Not open for further replies.

Kamikaze

Well-Known Member
Contributor
I try to download a song via php and add it to a playlist.
But I get a wrong uuid from script by adding the song

PHP:
//set_time_limit(0);
include("sinusbot.class.php");
include("config.php");
//include("getYTfile.php");
echo "<pre>";

$sinusbot = new SinusBot($ipport);
$sinusbot->login($user, $pass);

$instances    = $sinusbot->selectInstance($instanceIDS[$defaultInstance]); // Alle Instanzen
$status        = $sinusbot->getStatus($instanceIDS[$defaultInstance]);

$playlistname = "Test";
$yturl = "https://www.youtube.com/watch?v=TYCjNJszTmE"; // "[Chillout] Uppermost - Under Control"

// Downloading yt vid
$addjob = $sinusbot->addJob($yturl);

print_r($addjob);


If($addjob['success'] == 1 ) {
    echo "Download succesful..$addjob[uuid] <br>";
    $createPL = $sinusbot->createPlaylist($playlistname);
    sleep(5);
    If($createPL['success'] == 1 ) {
        echo "Created Playlist '$playlistname' succesful..<br>";
        $addTrackToPL = $sinusbot->addPlaylistTrack($addjob['uuid'], $createPL['uuid']);
        If($addTrackToPL['success'] == 1 ) {
            echo "Added Track succesful..<br>";
        } else {
            exit("Error adding Track to Playlist!");
        }
    } else {
        exit("Error creating Playlist!");
    }
} else {
    exit("Error downloading Track!");
}

PHP Output:
Code:
Array
(
    [success] => 1
    [uuid] => b3f06003-2d37-4821-9fc8-8f820dd7a8df
)
Download succesful..b3f06003-2d37-4821-9fc8-8f820dd7a8df
Created Playlist 'Test' succesful..
Error adding Track to Playlist!

But on webinterface the song has uuid: "2a27c7a5-242a-45ee-bba3-aeb37f7adb40"
 

mxschmitt

Moderator
Staff member
is awesome!
V.I.P.
is uber awesome!
Contributor
Insider
This Id is not the Id of the track itself. This is just an ID for the added Job to identify him. More information you will find in the API documentation.
 

Kamikaze

Well-Known Member
Contributor
This Id is not the Id of the track itself. This is just an ID for the added Job to identify him. More information you will find in the API documentation.
oh thanks.. didn't thought about that.

Is there a faster way to get the track-uuid from a finished job?
Actually I'm looping
PHP:
$sinusbot->getFiles();
till
PHP:
['filename'] == $youtubeurl
 
Status
Not open for further replies.
Top