Skip to content

Commit 85a305a

Browse files
committed
fixed bugs and simplified Classes
1 parent 76be3f5 commit 85a305a

File tree

3 files changed

+9
-22
lines changed

3 files changed

+9
-22
lines changed

src/API.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function getPlaylists()
8585
$playlists = $this->request('/bot/playlists');
8686
$out = [];
8787
foreach ($playlists as $playlist) {
88-
array_push($out, new Playlist($this->token, $this->url, $this->timeout, $playlist));
88+
array_push($out, new Playlist($this->token, $this->url, $this->timeout, $playlist["uuid"]));
8989
}
9090
return $out;
9191
}
@@ -398,7 +398,7 @@ public function getInstances()
398398
$instances = $this->request('/bot/instances');
399399
$out = [];
400400
foreach ($instances as $instance) {
401-
array_push($out, new Instance($this->token, $this->url, $this->timeout, $instance));
401+
array_push($out, new Instance($this->token, $this->url, $this->timeout, $instance["uuid"]));
402402
}
403403
return $out;
404404
}

src/Instance.class.php

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ class Instance extends RestClient
2323
*/
2424
public $uuid = null;
2525
/**
26-
* Instance holds the Instance array
27-
* @var array
28-
*/
29-
public $instance = null;
30-
/**
3126
* __construct
3227
*
3328
* @param string $token SinusBot auth token
@@ -36,13 +31,12 @@ class Instance extends RestClient
3631
* @param array $instance SinusBot Instance array.
3732
* @return void
3833
*/
39-
public function __construct($token, $url, $timeout, $instance)
34+
public function __construct($token, $url, $timeout, $uuid)
4035
{
4136
$this->token = $token;
4237
$this->url = $url;
4338
$this->timeout = $timeout;
44-
$this->instance = $instance;
45-
$this->uuid = $instance["uuid"];
39+
$this->uuid = $uuid;
4640
}
4741
/**
4842
* isPlaying returns true when the instance is playing something
@@ -78,7 +72,7 @@ public function delete()
7872

7973

8074
/**
81-
* spawn starts the instance
75+
* spawn spawns the instance
8276
*
8377
* @return array status
8478
*/
@@ -391,8 +385,7 @@ public function playPrevious()
391385
return $this->request('/bot/i/'.$this->uuid.'/playPrevious', 'POST', '');
392386
}
393387

394-
395-
/**
388+
/**
396389
* playNext will play the next track
397390
*
398391
* @return array status
@@ -426,7 +419,7 @@ public function playShuffle($shuffleState = 1)
426419

427420

428421
/**
429-
* stop stops the instance
422+
* stop stops the playback
430423
*
431424
* @return array status
432425
*/

src/Playlist.class.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@
1818
class Playlist extends RestClient
1919
{
2020
/**
21-
* Playlist holds the Playlist array
22-
* @var array
23-
*/
24-
public $playlist = null;
25-
/**
2621
* UUID holds the Playlist UUID
2722
* @var array
2823
*/
@@ -36,13 +31,12 @@ class Playlist extends RestClient
3631
* @param array $playlist SinusBot Playlist array.
3732
* @return void
3833
*/
39-
public function __construct($token, $url, $timeout, $playlist)
34+
public function __construct($token, $url, $timeout, $uuid)
4035
{
4136
$this->token = $token;
4237
$this->url = $url;
4338
$this->timeout = $timeout;
44-
$this->playlist = $playlist;
45-
$this->uuid = $playlist["uuid"];
39+
$this->uuid = $uuid;
4640
}
4741

4842
/**

0 commit comments

Comments
 (0)