[BandcampBridge] fix parameter 'tag' required status and fix the rest
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
parent
e9ff7b32f1
commit
3fed12af1d
1 changed files with 9 additions and 10 deletions
|
@ -8,18 +8,14 @@ class BandcampBridge extends BridgeAbstract{
|
||||||
public $parameters = array( array(
|
public $parameters = array( array(
|
||||||
'tag'=>array(
|
'tag'=>array(
|
||||||
'name'=>'tag',
|
'name'=>'tag',
|
||||||
'type'=>'text'
|
'type'=>'text',
|
||||||
|
'required'=>true
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$html = '';
|
$html = $this->getSimpleHTMLDOM($this->getURI())
|
||||||
if (isset($this->getInput('tag'))) {
|
or $this->returnServerError('No results for this query.');
|
||||||
$html = $this->getSimpleHTMLDOM('http://bandcamp.com/tag/'.urlencode($this->getInput('tag')).'?sort_field=date') or $this->returnServerError('No results for this query.');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$this->returnClientError('You must specify tag (/tag/...)');
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach($html->find('li.item') as $release) {
|
foreach($html->find('li.item') as $release) {
|
||||||
$script = $release->find('div.art', 0)->getAttribute('onclick');
|
$script = $release->find('div.art', 0)->getAttribute('onclick');
|
||||||
|
@ -36,9 +32,12 @@ class BandcampBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getURI(){
|
||||||
|
return $this->uri.'tag/'.urlencode($this->getInput('tag')).'?sort_field=date';
|
||||||
|
}
|
||||||
|
|
||||||
return (!empty($this->getInput('tag')) ? $this->getInput('tag') .' - ' : '') .'Bandcamp Tag';
|
public function getName(){
|
||||||
|
return $this->getInput('tag') .' - '.'Bandcamp Tag';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCacheDuration(){
|
public function getCacheDuration(){
|
||||||
|
|
Loading…
Reference in a new issue