forked from blallo/rss-bridge
[SoundcloudBridge] remove useless code
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
parent
292f0f85ad
commit
05001f6b2e
1 changed files with 18 additions and 17 deletions
|
@ -1,9 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
class SoundCloudBridge extends BridgeAbstract{
|
class SoundCloudBridge extends BridgeAbstract{
|
||||||
|
|
||||||
private $request;
|
|
||||||
public $name;
|
|
||||||
|
|
||||||
public function loadMetadatas() {
|
public function loadMetadatas() {
|
||||||
|
|
||||||
$this->maintainer = "kranack";
|
$this->maintainer = "kranack";
|
||||||
|
@ -25,31 +22,35 @@ class SoundCloudBridge extends BridgeAbstract{
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
$param=$this->parameters[$this->queriedContext];
|
||||||
|
|
||||||
if (isset($param['u']['value']) && !empty($param['u']['value']))
|
$res = json_decode($this->getContents(
|
||||||
{
|
'https://api.soundcloud.com/resolve?url=http://www.soundcloud.com/'
|
||||||
$this->request = $param['u']['value'];
|
. urlencode($param['u']['value'])
|
||||||
|
.'&client_id=' . self::CLIENT_ID
|
||||||
$res = json_decode($this->getContents('https://api.soundcloud.com/resolve?url=http://www.soundcloud.com/'. urlencode($this->request) .'&client_id=' . self::CLIENT_ID)) or $this->returnServerError('No results for this query');
|
)) or $this->returnServerError('No results for this query');
|
||||||
$tracks = json_decode($this->getContents('https://api.soundcloud.com/users/'. urlencode($res->id) .'/tracks?client_id=' . self::CLIENT_ID)) or $this->returnServerError('No results for this user');
|
$tracks = json_decode($this->getContents(
|
||||||
}
|
'https://api.soundcloud.com/users/'
|
||||||
else
|
. urlencode($res->id)
|
||||||
{
|
.'/tracks?client_id=' . self::CLIENT_ID
|
||||||
$this->returnClientError('You must specify username');
|
)) or $this->returnServerError('No results for this user');
|
||||||
}
|
|
||||||
|
|
||||||
for ($i=0; $i < 10; $i++) {
|
for ($i=0; $i < 10; $i++) {
|
||||||
$item = array();
|
$item = array();
|
||||||
$item['author'] = $tracks[$i]->user->username .' - '. $tracks[$i]->title;
|
$item['author'] = $tracks[$i]->user->username .' - '. $tracks[$i]->title;
|
||||||
$item['title'] = $tracks[$i]->user->username .' - '. $tracks[$i]->title;
|
$item['title'] = $tracks[$i]->user->username .' - '. $tracks[$i]->title;
|
||||||
$item['content'] = '<audio src="'. $tracks[$i]->uri .'/stream?client_id='. self::CLIENT_ID .'">';
|
$item['content'] = '<audio src="'. $tracks[$i]->uri .'/stream?client_id='. self::CLIENT_ID .'">';
|
||||||
$item['id'] = 'https://soundcloud.com/'. urlencode($this->request) .'/'. urlencode($tracks[$i]->permalink);
|
$item['id'] = 'https://soundcloud.com/'
|
||||||
$item['uri'] = 'https://soundcloud.com/'. urlencode($this->request) .'/'. urlencode($tracks[$i]->permalink);
|
. urlencode($param['u']['value']) .'/'
|
||||||
|
. urlencode($tracks[$i]->permalink);
|
||||||
|
$item['uri'] = 'https://soundcloud.com/'
|
||||||
|
. urlencode($param['u']['value']) .'/'
|
||||||
|
. urlencode($tracks[$i]->permalink);
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public function getName(){
|
public function getName(){
|
||||||
return (!empty($this->name) ? $this->name .' - ' : '') . (!empty($this->request) ? $this->request : '');
|
$param=$this->parameters[$this->queriedContext];
|
||||||
|
return $this->name .' - '. $param['u']['value'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCacheDuration(){
|
public function getCacheDuration(){
|
||||||
|
|
Loading…
Reference in a new issue