mherger wrote: 
> > I was going to have a look at Tune In URL support.
> 
> Oh... that should already be mostly there. Or at least large parts of 
> it: the Bandcamp URL menu items would already do the lookup etc.
> 

Indeed, it just needs plumbing in:


Code:
--------------------
    From 28ca5c5255bd4a06b23a12bc2d30607e62763918 Mon Sep 17 00:00:00 2001
  From: Peter Oliver <[email protected]>
  Date: Thu, 2 Jul 2020 16:46:24 +0100
  Subject: [PATCH] Handle Bandcamp URLs with Tune In URL.
  
  ---
  Plugin.pm          |  7 ++++++-
  ProtocolHandler.pm | 17 +++++++++++++++++
  2 files changed, 23 insertions(+), 1 deletion(-)
  create mode 100644 ProtocolHandler.pm
  
  diff --git a/Plugin.pm b/Plugin.pm
  index 017121e..350b2f3 100644
  --- a/Plugin.pm
  +++ b/Plugin.pm
  @@ -25,6 +25,7 @@ my $log = Slim::Utils::Log->addLogCategory( {
  my $prefs = preferences('plugin.bandcamp');
  
  use constant PLUGIN_TAG       => 'bandcamp';
  +use constant PAGE_URL_REGEX => qr{^https?://(?:[a-z0-9]+\.)?bandcamp\.com/}i;
  use constant STREAM_URL_REGEX => 
qr/(?:bcbits|bandcamp)\.com\/(?:download\/track|stream\/[a-z0-9]+\/|stream_redirect\b)/i;
  use constant IMAGES_URL_REGEX => qr/f0\.bcbits\.com\/(?:img|z)\//;
  use constant CACHE_TTL        => 3600 * 12;
  @@ -128,6 +129,10 @@ sub initPlugin {
                },
        ) );
  
  +     Slim::Player::ProtocolHandlers->registerURLHandler(
  +             PAGE_URL_REGEX, 'Plugins::Bandcamp::ProtocolHandler'
  +     ) if Slim::Player::ProtocolHandlers->can('registerURLHandler');
  +
        # initialize recent plays: need to add them to the LRU cache ordered by 
timestamp
        my $recent_plays = $cache->get('recent_plays');
        map {
  @@ -1135,4 +1140,4 @@ sub _cleanup_multiline {
        return $text;
  }
  
  -1;
  \ No newline at end of file
  +1;
  diff --git a/ProtocolHandler.pm b/ProtocolHandler.pm
  new file mode 100644
  index 0000000..9089bd8
  --- /dev/null
  +++ b/ProtocolHandler.pm
  @@ -0,0 +1,17 @@
  +package Plugins::Bandcamp::ProtocolHandler;
  +
  +use strict;
  +use Plugins::Bandcamp::Plugin;
  +
  +sub explodePlaylist {
  +     my ($class, $client, $url, $cb) = @_;
  +
  +     Plugins::Bandcamp::Plugin::get_item_info_by_url(
  +             $client,
  +             sub { $cb->([map {$_->{'play'} // ()} @{$_[0]}]) },
  +             {},
  +             { 'url' => $url }
  +     );
  +}
  +
  +1;
  -- 
  2.26.2
  
  
--------------------


mherger wrote: 
> 
> The full source of the plugin is on your computer
> 

Sure, but I wanted to check there wasn't a development version somewhere
that I should be starting with.  Thanks.


------------------------------------------------------------------------
mavit's Profile: http://forums.slimdevices.com/member.php?userid=10203
View this thread: http://forums.slimdevices.com/showthread.php?t=108832

_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to