Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 5 of 5
  1. #1
    Senior Member
    Join Date
    Aug 2014
    Location
    UK
    Posts
    386

    Linking into Spotty from BBC Sounds

    The API I'm using for my BBC Sounds plugin has access to the specific spotify track URL for the track that is currently playing in this format :
    Code:
     {
              "type": "commercial-music-service",
              "id": "commercial-music-service-spotify",
              "label": "Spotify",
              "uri": "https://open.spotify.com/track/6IOWaTG6MUfR4824H2XOjJ"
      }
    I plan to make use of that by adding a context menu using registerinfoprovider to enable the user to go to a menu item enabling them to access the track from Spotty while they are still listening to the station/programme.
    I guess I can transform that uri into a spotify://track:xxxxx format url and easily create a Spotty playable menu item.

    However, is there a better way I can interact into spotty to have a nicely formatted menu item with artwork in the right album context etc?

  2. #2
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,530
    TBH. I'm not sure what the cleanest way to do this would be. You can easily call Spotty's trackinfo menu handler to get what you want from inside your trackinfo handler. But if I ever decide to change that code, your plugin would need an update, too. This admittedly is very unlikely going to happen, because it has to stay compatible with the menu handler. But I'd still recommend you make sure Spotty is installed before you do this:

    Code:
    sub trackInfoMenu {
    	my ( $client, $url, $track, $remoteMeta ) = @_;
    
    	my $items = [];
    
    	if ( Slim::Utils::PluginManager->isEnabled('Plugins::Spotty::Plugin') ) {
    		require Plugins::Spotty::OPML;
    		push @$items, Plugins::Spotty::OPML::trackInfoMenu(@_);
    	}
    
    	# ...now add your own items etc.
    }
    That's rough and un-tested. But I hope you get the idea.
    Michael

    "It doesn't work - what shall I do?" - "Please check your server.log and/or scanner.log file!"
    (LMS: Settings/Information)

  3. #3
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    3,905
    Some of the radio stations that I made plugins for do have Spotify or Deezer ids ... so I could also do this.

    I have thought for a while that a generic song info call could be useful when playing internet radio - to return cover art or artist image and potentially more when the streaming station has not been able to provide it.

    The idea would be to call something in LMS (think of it as MAI) with Artist, Title, [Album], [Year], [set of streaming service ids].

    This would be a help for streaming stations that do not provide cover art.
    In theory it could be done automatically (optionally) by LMS when it knows it is playing a song but was not given cover art.

    For UK users when TuneIn has partially stopped providing services this could be very useful.
    Paul Webster
    http://dabdig.blogspot.com
    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, Supla Finland, ABC Australia, CBC/Radio-Canada and RTE Ireland

  4. #4
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,530
    Quote Originally Posted by Paul Webster View Post
    I have thought for a while that a generic song info call could be useful when playing internet radio - to return cover art or artist image and potentially more when the streaming station has not been able to provide it.
    You should look into getMetadataFor():

    Code:
    my $handler = Slim::Player::ProtocolHandlers->handlerForURL($url);
    if ( $handler && $handler->can('getMetadataFor') ) {
    	my $remoteMeta = $handler->getMetadataFor( $client, $url );
    ...
    Michael

    "It doesn't work - what shall I do?" - "Please check your server.log and/or scanner.log file!"
    (LMS: Settings/Information)

  5. #5
    Senior Member
    Join Date
    Aug 2014
    Location
    UK
    Posts
    386
    Quote Originally Posted by mherger View Post
    TBH. I'm not sure what the cleanest way to do this would be. You can easily call Spotty's trackinfo menu handler to get what you want from inside your trackinfo handler. But if I ever decide to change that code, your plugin would need an update, too. This admittedly is very unlikely going to happen, because it has to stay compatible with the menu handler. But I'd still recommend you make sure Spotty is installed before you do this:


    That's rough and un-tested. But I hope you get the idea.
    Many thanks for the info. That does work when I pass in the spotify url, I'm not sure that having the full spotty track info isn't actually too confusing for the user, I'll have a think what's the best way of adding in the spotty track options

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •