Re: [SlimDevices: Plugins] Using plugin to get Internet radio track data from web site

2017-02-01 Thread Paul Webster

mherger wrote: 
> >
> What platform are you running LMS on? It should be able to reach https 
> sources, unless it's missing IO::Socket::SSL. But that should easily be
> 
> installable on most platforms.
> 
It is a very old image on a Joggler ... so rather than experiment with
updating software within it I'll replace the image as a whole with
SqueezeplayOS and see if it works there.
If it does then I'll change the location of my repository and plugin zip
file to GitHub.



Paul Webster
http://dabdig.blogspot.com

Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
View this thread: http://forums.slimdevices.com/showthread.php?t=106810

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using plugin to get Internet radio track data from web site

2017-01-31 Thread Michael Herger

This is because "GitHub Pages created after June 15, 2016 and using
github.io domains are served over HTTPS." and an LMS that I tried had
problems accessing.
So - was that an issue with old LMS (it was a 7.7 build) or is it a more
general problem that could happen with more modern installations as
well?


What platform are you running LMS on? It should be able to reach https 
sources, unless it's missing IO::Socket::SSL. But that should easily be 
installable on most platforms.


--

Michael
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using plugin to get Internet radio track data from web site

2017-01-31 Thread Paul Webster

I've put the plugin on GitHub ... but hosting the repo.xml and the zip
file there seems to be a problem.
This is because "GitHub Pages created after June 15, 2016 and using
github.io domains are served over HTTPS." and an LMS that I tried had
problems accessing.
So - was that an issue with old LMS (it was a 7.7 build) or is it a more
general problem that could happen with more modern installations as
well?

I can host the repo xml and zip file somewhere else but would have
preferred to keep it all together.



Paul Webster
http://dabdig.blogspot.com

Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
View this thread: http://forums.slimdevices.com/showthread.php?t=106810

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using plugin to get Internet radio track data from web site

2017-01-30 Thread Paul Webster

Thanks for your pointer in this thread Michael.
I now have something that is working for me and one other person ...
would someone else like to try it before I share it more widely?

Display artist, track, cover and, optionally, album name for FIP
(http://www.fipradio.fr) stations - FIP (including regional varients),
FIP autour du ... Rock, Jazz, Groove, Monde, plus Tout Nouveau and
Evenement (Reggae at time of writing).



Paul Webster
http://dabdig.blogspot.com

Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
View this thread: http://forums.slimdevices.com/showthread.php?t=106810

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using plugin to get Internet radio track data from web site

2017-01-29 Thread Paul Webster

Yes - am caching the meta data from the station (15 seconds but might
extend it because of this) and also what I think the client already
thinks is playing so that I don't push it too often.



Paul Webster
http://dabdig.blogspot.com

Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
View this thread: http://forums.slimdevices.com/showthread.php?t=106810

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using plugin to get Internet radio track data from web site

2017-01-29 Thread Michael Herger

One thing though - I use registerProvider and my provider routing is
called once a second when the player is an SB2.
Is this expected behaviour?


Not 100% sure, but yes, probably expected behaviour. The SB2 is stupid, 
and LMS is feeding its display. Very well possible that some code is 
polling the plugin whenever the server is preparing a display update. 
Make sure you cache data in memory to reduce the load.


--

Michael
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using plugin to get Internet radio track data from web site

2017-01-29 Thread Paul Webster

I've got things working when there is more than one player that is
playing the same station by not synced in LMS.

One thing though - I use registerProvider and my provider routing is
called once a second when the player is an SB2.
Is this expected behaviour?

(For my Squeezelite devices it is much less frequent and is, broadly, in
line with my timers expiring)


Sent from my iPad using Tapatalk



Paul Webster
http://dabdig.blogspot.com

Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
View this thread: http://forums.slimdevices.com/showthread.php?t=106810

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using plugin to get Internet radio track data from web site

2017-01-26 Thread Paul Webster

mherger wrote: 
> > Code:
> > 
> > Slim::Control::Request::notifyFromArray( $client, [ 'newmetadata'
> ] );
> 
> You might need to do this for all the clients currently playing that 
> station. Are they synced? Then you'd have to deal with $client->master.
> 
> Otherwise you could/should keep track of all clients streaming that 
> station, and send the notification to all of them.
> 

Not synced in this case - but keeping track of them all was one of my
earlier thoughts.
I don't see other plugins doing that though - but very few of the ones
that I looked through have to use timers.

Anyway - I'll try to do that. I presume that I could just keep a list of
the $client references and then iterate on meta change.



Paul Webster
http://dabdig.blogspot.com

Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
View this thread: http://forums.slimdevices.com/showthread.php?t=106810

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using plugin to get Internet radio track data from web site

2017-01-26 Thread Paul Webster

mherger wrote: 
> > Is there a recommended way to check that my plugin still "owns" the
> > client?
> 
> Keep track of the URL playing. If it has changed when your timer 
> triggers, then don't do anything.
> 

Thanks - that was the route I was going down and I found similar code in
Slim/Plugin/RemoteLibrary/ProtocolHandler.pm

My version in my timer return code is now something like this - and it
works

Code:

sub timerReturn {
my ( $client, $url ) = @_;
  
my $station = ( $url );
  
my $song = $client->playingSong();
my $playingURL = "";
if ( $song && $song->streamUrl ) { $playingURL = $song->streamUrl}
  
if ($playingURL ne $url){
# Given stream URL not the same now as we had before implies 
listener has changed station
main::DEBUGLOG && $log->is_debug && $log->debug("$station - 
timerReturn - stream changed to $playingURL");
# However, it might be an alternative that leads to the same 
station (redirects) or another in the family so check
$station = ( $playingURL );
} else {
# If streamUrl not found then something is odd - so report it 
to help determine issue
if (!$song || !$song->streamUrl || !$song->streamUrl ne ""){
# Odd?
main::DEBUGLOG && $log->is_debug && 
$log->debug("$station - timerReturn - streamUrl issue $playingURL");
}
}

if ($station ne "") {#One of mine so check for isPlaying and action it 
...} else { # not mine - log it }
  



Odd thing is that none of the debug lines come out if switching from
streaming to playing local music - so I assume that the core code does a
killTimers in that situation.



Paul Webster
http://dabdig.blogspot.com

Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
View this thread: http://forums.slimdevices.com/showthread.php?t=106810

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using plugin to get Internet radio track data from web site

2017-01-25 Thread Michael Herger

Code:

Slim::Control::Request::notifyFromArray( $client, [ 'newmetadata' ] );


You might need to do this for all the clients currently playing that 
station. Are they synced? Then you'd have to deal with $client->master. 
Otherwise you could/should keep track of all clients streaming that 
station, and send the notification to all of them.



--

Michael
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using plugin to get Internet radio track data from web site

2017-01-25 Thread Michael Herger

Is there a recommended way to check that my plugin still "owns" the
client?


Keep track of the URL playing. If it has changed when your timer 
triggers, then don't do anything.



Alternative approach could be a registration to be called on
stop/pause/switch-away then I could killtimers - but I have not found a
registration like that.


subscribe takes commands as arguments. You might want to listen to 
"playlist play/stop/pause" etc.


--

Michael
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using plugin to get Internet radio track data from web site

2017-01-25 Thread Paul Webster

and another one ... sorry ... but one issue with using timers is that
they can return after the listener has changed stations.
So the "traditional" check of client->isPlaying is not enough ... since
the client object represents the player and it is now playing a
different station.

Is there a recommended way to check that my plugin still "owns" the
client?
Alternative approach could be a registration to be called on
stop/pause/switch-away then I could killtimers - but I have not found a
registration like that.



Paul Webster
http://dabdig.blogspot.com

Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
View this thread: http://forums.slimdevices.com/showthread.php?t=106810

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using plugin to get Internet radio track data from web site

2017-01-25 Thread Paul Webster

I've tried calling

Code:

Slim::Control::Request::notifyFromArray( $client, [ 'newmetadata' ] );


from a couple of places - including on return from the provider that
registers via

Code:

Slim::Formats::RemoteMetadata->registerProvider


but still not updating the other devices (first one does).

Have filled the code with debug trace statements - but to make the debug
better ... can you point me to where to find the device name?
I tried

Code:


  $dumped =  Dumper $client->master->pluginData;
  main::DEBUGLOG && $log->is_debug && $log->debug($dumped);
  


to see what is in there but didn't spot it.



Paul Webster
http://dabdig.blogspot.com

Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
View this thread: http://forums.slimdevices.com/showthread.php?t=106810

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using plugin to get Internet radio track data from web site

2017-01-25 Thread Michael Herger

However, and odd thing is that LMS web Ui shows the correct Now Playing
info for both client 1 and client 2 even though client 2 physical device
sticks with the first set that I sent on its stream starting.


Do you send the new metadata notification? The difference between the 
web UI and the players is that the web UI would poll the server for 
changes every few seconds. The players rely on the notification (push 
rather than poll).


--

Michael
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using plugin to get Internet radio track data from web site

2017-01-24 Thread Paul Webster

I'm doing something like that - especially as the code started from your
DRS plugin.
I'll put more tracing in to see what is called but I think what happens
is that when 2nd client starts I get a call and I see that there is
already a poll timer running for the station so I don't set up a new
timer for this client.
All subsequent timer expires are only for client 1 so I never push
anything new to client 2.

However, and odd thing is that LMS web Ui shows the correct Now Playing
info for both client 1 and client 2 even though client 2 physical device
sticks with the first set that I sent on its stream starting.



Paul Webster
http://dabdig.blogspot.com

Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
View this thread: http://forums.slimdevices.com/showthread.php?t=106810

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using plugin to get Internet radio track data from web site

2017-01-24 Thread Michael Herger

However, the problem that this leads me to is when there is more than
one device playing the same station (but the devices are not Synched)
then I discard call-backs for one of the devices (because I know that I
already have a timer set for later for the station) ... which means that
when my other timer does expire then only one device is updated.
I guess I could run around all of the devices to see if any are playing
the same station and push the same update to them - but is there a
better way?


What I usually do is store the data in a cache, independent from the 
client. And I store a flag somewhere telling me whether a lookup is 
being processed. If I get a second request while the first is still 
processing, I'd tell the second one to try again later. Or I send it 
back without any new data, letting it update when I send the newmetadata 
notification. Would that work?


--

Michael
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using plugin to get Internet radio track data from web site

2017-01-23 Thread Paul Webster

I tried remote_title and remotetitle (2nd is mentioned in some code
elsewhere) but didn't work - at least when data returned via

Code:


  $song->pluginData( wmaMeta => $info );
  Slim::Control::Request::notifyFromArray( $client, [ 'newmetadata' ] );
  



Anyway - not too important. I could put in a Settings option to disable
sending of Album info so that the station name appears.

One more, and hopefully last, issue ...

I have been trying to optimise things to reduce call-backs and fetching
from the source web site - so I collect data based on the station (using
basically the same "meta" object as in Michael's DRS plugin.

However, the problem that this leads me to is when there is more than
one device playing the same station (but the devices are not Synched)
then I discard call-backs for one of the devices (because I know that I
already have a timer set for later for the station) ... which means that
when my other timer does expire then only one device is updated.
I guess I could run around all of the devices to see if any are playing
the same station and push the same update to them - but is there a
better way?



Paul Webster
http://dabdig.blogspot.com

Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
View this thread: http://forums.slimdevices.com/showthread.php?t=106810

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using plugin to get Internet radio track data from web site

2017-01-23 Thread Michael Herger

Another question ... when playing a stream via its URL (as opposed to
playing it by name in TuneIn or a favourite) the stream URL is shown (on
a Touch-like display) just below the title/artist.
When playing a station by name then it is the station name that is
shown.


Try returning a remote_title in your metadata. If there's no album name 
for a remote stream, but that remote_title, then I think it will be shown.


But TBH: I only find that value being used. I haven't found where it's 
ever set in LMS...


--

Michael
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using plugin to get Internet radio track data from web site

2017-01-20 Thread Paul Webster

Another question ... when playing a stream via its URL (as opposed to
playing it by name in TuneIn or a favourite) the stream URL is shown (on
a Touch-like display) just below the title/artist.
When playing a station by name then it is the station name that is
shown.

Can I return an attribute that will result in my station name being
shown rather than the URL - but without messing up the URL that is being
used to play the station?
Currently returning icon (station logo), artist, title, cover.
I have seen that if I return "album" then it replaces the radio station
name ... but can I have both?



Paul Webster
http://dabdig.blogspot.com

Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
View this thread: http://forums.slimdevices.com/showthread.php?t=106810

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using plugin to get Internet radio track data from web site

2017-01-20 Thread Paul Webster

Without really knowing why ... this is now working.
Next step is to make it a bit more tolerant of faults in the source and
to work out why things don't work so well when 2 different unsynched
Squeezeboxes are playing the same  station (I think in my suppression of
actions when getting too many callbacks I have lost updates to one of
the devices).



Paul Webster
http://dabdig.blogspot.com

Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
View this thread: http://forums.slimdevices.com/showthread.php?t=106810

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using plugin to get Internet radio track data from web site

2017-01-18 Thread Paul Webster

I couldn't get that to work either.

So went back to basics - and found that
Slim::Formats::RemoteMetadata->registerProvider - which, when called
takes the "info" structure as a return, is working.
It is odd though.
I get around 6 calls in the same second or so - then the same set of
calls about once every 10 minutes.
In my case the source ICY metadata never changes so that is not the
trigger,
If I could get the 10 minutes to be 15-30 seconds then all would be well
and I would not need the self-timer to work (which I have currently
commented out).



Paul Webster
http://dabdig.blogspot.com

Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
View this thread: http://forums.slimdevices.com/showthread.php?t=106810

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using plugin to get Internet radio track data from web site

2017-01-17 Thread Michael Herger

Code:


  $client->master->pluginData( metadata => $info );

  Slim::Control::Request::notifyFromArray( $client, [ 'newmetadata' ] );
  Slim::Control::Request::notifyFromArray( $client, [ 'playlist', 'newsong', 
$info->{title} ] );




I'm doing the following (in aforementioned DRS plugin) before sending 
the newmetadata notification:


$client->playingSong->pluginData( wmaMeta => {
icon   => $imageUrl,
cover  => $imageUrl,
artist => $info->{artist},
title  => $info->{title},
} );

Make this $client->master... if needed (I do this in the beginning).
--

Michael
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using plugin to get Internet radio track data from web site

2017-01-17 Thread Paul Webster

I have the periodic polling now working - and am getting the data back
from the radio station web site (annoyingly it is about a minute behind
- and have not checked to see if that is LMS caching, someone else
caching, or remote site being out of sync).
However, my updated metadata is not appearing on player screen.

I have taken code from elsewhere and it may well be relying on something
that I have not set-up correctly.
But ... would you expect that track info to update when this is done?


Code:


  $client->master->pluginData( metadata => $info );

  Slim::Control::Request::notifyFromArray( $client, [ 'newmetadata' ] );
  Slim::Control::Request::notifyFromArray( $client, [ 'playlist', 'newsong', 
$info->{title} ] );
  



where $info has something like this:
$info->{artist} = 'The Beatles';
$info->{title} = 'A Hard Day's Night';

and "client" is what is passed around as first parameter in lots of
calls ... (this bit I am dubious about!)



Paul Webster
http://dabdig.blogspot.com

Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
View this thread: http://forums.slimdevices.com/showthread.php?t=106810

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using plugin to get Internet radio track data from web site

2017-01-17 Thread Paul Webster

Thanks both.



Paul Webster
http://dabdig.blogspot.com

Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
View this thread: http://forums.slimdevices.com/showthread.php?t=106810

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using plugin to get Internet radio track data from web site

2017-01-16 Thread Michael Herger

I can see how to get the data from the broadcaster's web site but can
someone give me some pointers for how to get the plugin called
periodically?


Look into Slim::Formats::RemoteMetadata. Register a data provider which 
will be called as soon as your station is being called. Then run some 
polling code (Slim::Utils::Timer) to update the data as long as you're 
streaming that station.


You might need to check yourself whether you're still streaming that 
station, and stop timers accordingly.


--

Michael
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using plugin to get Internet radio track data from web site

2017-01-16 Thread bpa

Paul Webster wrote: 
> I can see how to get the data from the broadcaster's web site but can
> someone give me some pointers for how to get the plugin called
> periodically?

The BBCiPLayer plugin gets metdataa from two different sites by polling
regularly look at the BBCOnAir.pm file for most of the work.



bpa's Profile: http://forums.slimdevices.com/member.php?userid=1806
View this thread: http://forums.slimdevices.com/showthread.php?t=106810

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


[SlimDevices: Plugins] Using plugin to get Internet radio track data from web site

2017-01-16 Thread Paul Webster

Hello,.

I'm looking into writing a plugin to provider track meta data because
the ICY metadata is empty.
I can see how to get the data from the broadcaster's web site but can
someone give me some pointers for how to get the plugin called
periodically?
I can't do it on stream metadata change because the data within the
stream does not change.

Ideally should be reconfigurable interval because the broadcaster web
info shows when the next track is due ... so I could say "call me back
in X seconds".

I have looked at the Orange Liveradio plugin and Michael's DRS one but
they seem to rely on the metadata in the stream changing.



Paul Webster
http://dabdig.blogspot.com

Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
View this thread: http://forums.slimdevices.com/showthread.php?t=106810

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins