Skip to content

Commit

Permalink
[BandcampBridge] Add support for labels (#2286)
Browse files Browse the repository at this point in the history
  • Loading branch information
VerifiedJoseph authored Oct 29, 2021
1 parent 3764348 commit fd54042
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions bridges/BandcampBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,30 @@ class BandcampBridge extends BridgeAbstract {
'defaultValue' => 5
)
),
'By label' => array(
'label' => array(
'name' => 'label',
'type' => 'text',
'title' => 'label name as seen in the label page URL',
'required' => true
),
'type' => array(
'name' => 'Articles are',
'type' => 'list',
'values' => array(
'Releases' => 'releases',
'Releases, new one when track list changes' => 'changes',
'Individual tracks' => 'tracks'
),
'defaultValue' => 'changes'
),
'limit' => array(
'name' => 'limit',
'type' => 'number',
'title' => 'Number of releases to return',
'defaultValue' => 5
)
),
'By album' => array(
'band' => array(
'name' => 'band',
Expand Down Expand Up @@ -122,6 +146,7 @@ public function collectData(){
}
break;
case 'By band':
case 'By label':
case 'By album':
$html = getSimpleHTMLDOMCached($this->getURI(), 86400);

Expand All @@ -139,6 +164,7 @@ public function collectData(){
$tralbums = array();
switch($this->queriedContext) {
case 'By band':
case 'By label':
$query_data = array(
'band_id' => $band_id
);
Expand Down Expand Up @@ -289,6 +315,13 @@ public function getURI(){
. '?sort_field=date';
}
break;
case 'By label':
if(!is_null($this->getInput('label'))) {
return 'https://'
. $this->getInput('label')
. '.bandcamp.com/music';
}
break;
case 'By band':
if(!is_null($this->getInput('band'))) {
return 'https://'
Expand Down Expand Up @@ -323,6 +356,13 @@ public function getName(){
return $this->getInput('band') . ' - Bandcamp Band';
}
break;
case 'By label':
if(isset($this->feedName)) {
return $this->feedName . ' - Bandcamp Label';
} elseif(!is_null($this->getInput('label'))) {
return $this->getInput('label') . ' - Bandcamp Label';
}
break;
case 'By album':
if(isset($this->feedName)) {
return $this->feedName . ' - Bandcamp Album';
Expand Down

0 comments on commit fd54042

Please sign in to comment.