From 68922b62e22c24ad09fa74d666c7aff8fb1393c7 Mon Sep 17 00:00:00 2001 From: Joseph Date: Fri, 29 Oct 2021 20:43:20 +0000 Subject: [PATCH] [BandcampBridge] Add support for labels (#2286) --- bridges/BandcampBridge.php | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/bridges/BandcampBridge.php b/bridges/BandcampBridge.php index 321e1f04cd1..9a46eabd819 100644 --- a/bridges/BandcampBridge.php +++ b/bridges/BandcampBridge.php @@ -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', @@ -122,6 +146,7 @@ public function collectData(){ } break; case 'By band': + case 'By label': case 'By album': $html = getSimpleHTMLDOMCached($this->getURI(), 86400); @@ -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 ); @@ -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://' @@ -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';