From b574334e739e17469a445ee929d7d6e9554fb812 Mon Sep 17 00:00:00 2001 From: Anadrark Date: Fri, 20 Dec 2013 05:57:51 +0100 Subject: [PATCH 1/5] Create BandcampBridge MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pour avoir les dernières sorties bandcamp en filtrant par tag. --- bridges/BandcampBridge | 45 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 bridges/BandcampBridge diff --git a/bridges/BandcampBridge b/bridges/BandcampBridge new file mode 100644 index 00000000..b2782944 --- /dev/null +++ b/bridges/BandcampBridge @@ -0,0 +1,45 @@ +request = $param['tag']; + $html = file_get_html('http://bandcamp.com/tag/'.urlencode($this->request).'?sort_field=date') or $this->returnError('No results for this query.', 404); + } + else { + $this->returnError('You must specify tag (/tag/...)', 400); + } + + foreach($html->find('li.item') as $release) { + $item = new \Item(); + $item->name = $release->find('div.itemsubtext',0)->plaintext . ' - ' . $release->find('div.itemtext',0)->plaintext; + $item->title = $release->find('div.itemsubtext',0)->plaintext . ' - ' . $release->find('div.itemtext',0)->plaintext; + $item->content = '
' . $release->find('div.itemsubtext',0)->plaintext . ' - ' . $release->find('div.itemtext',0)->plaintext; + $item->id = $release->find('a',0)->getAttribute('href'); + $item->uri = $release->find('a',0)->getAttribute('href'); + $this->items[] = $item; + } + } + + public function getName(){ + return (!empty($this->request) ? $this->request .' - ' : '') .'Bandcamp Tag'; + } + + public function getURI(){ + return 'http://bandcamp.com'; + } + + public function getCacheDuration(){ + return 300; // 5 minutes + } +} From 8618866a74f0fda178791627b7b6c00cd9975845 Mon Sep 17 00:00:00 2001 From: Anadrark Date: Fri, 20 Dec 2013 05:58:30 +0100 Subject: [PATCH 2/5] Rename BandcampBridge to BandcampBridge.php --- bridges/{BandcampBridge => BandcampBridge.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename bridges/{BandcampBridge => BandcampBridge.php} (100%) diff --git a/bridges/BandcampBridge b/bridges/BandcampBridge.php similarity index 100% rename from bridges/BandcampBridge rename to bridges/BandcampBridge.php From f27dc1204264591598e3b16386afb4c5cc7895e1 Mon Sep 17 00:00:00 2001 From: Anadrark Date: Fri, 20 Dec 2013 05:59:47 +0100 Subject: [PATCH 3/5] Update BandcampBridge.php --- bridges/BandcampBridge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridges/BandcampBridge.php b/bridges/BandcampBridge.php index b2782944..bb102c25 100644 --- a/bridges/BandcampBridge.php +++ b/bridges/BandcampBridge.php @@ -12,7 +12,7 @@ class BandcampBridge extends BridgeAbstract{ public function collectData(array $param){ $html = ''; - if (isset($param['tag'])) { /* keyword search mode */ + if (isset($param['tag'])) { $this->request = $param['tag']; $html = file_get_html('http://bandcamp.com/tag/'.urlencode($this->request).'?sort_field=date') or $this->returnError('No results for this query.', 404); } From 56236acde47e1f1e7ed323a4688d6bc1b176af60 Mon Sep 17 00:00:00 2001 From: Anadrark Date: Fri, 20 Dec 2013 06:00:50 +0100 Subject: [PATCH 4/5] Update BandcampBridge.php --- bridges/BandcampBridge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridges/BandcampBridge.php b/bridges/BandcampBridge.php index bb102c25..98eaf9f7 100644 --- a/bridges/BandcampBridge.php +++ b/bridges/BandcampBridge.php @@ -40,6 +40,6 @@ class BandcampBridge extends BridgeAbstract{ } public function getCacheDuration(){ - return 300; // 5 minutes + return 600; // 10 minutes } } From e9c94dbedb36d6ffe3e7680e5f4fab1e9f4ee326 Mon Sep 17 00:00:00 2001 From: Anadrark Date: Fri, 20 Dec 2013 06:07:27 +0100 Subject: [PATCH 5/5] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e922f586..31be2636 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ Supported sites/pages * `Identi.ca` : Identica user timeline (Should be compatible with other Pump.io instances). * `YouTube` : YouTube user channel feed. * `Cryptome` : Returns the most recent documents from Cryptome.org. + * `Bandcamp` : Returns last release from bandcamp for a tag Output format