Subject: | Please support other services than last.fm |
Hi Peter,
I wanted to play with libre.fm, and noticed that Audio::Scrobbler has
last.fm hardcoded.
It would be nice to be able to use other scrobbling services too. Find
attached a quick patch that works with libre.fm's http://turtle.libre.fm
(and still with last.fm and without supplying a service).
(Please note that I haven't looked at bin/scrobbler-helper which might
need a new "-S <service>" switch or something.)
Cheers,
gregor
Subject: | services.patch |
--- a/lib/Audio/Scrobbler.pm
+++ b/lib/Audio/Scrobbler.pm
@@ -95,7 +95,8 @@
=item * handshake ()
Perfors a handshake with the AudioScrobbler API via a request to
-http://post.audioscrobbler.com/.
+http://post.audioscrobbler.com/ or a different service like libre.fm
+(http://turtle.libre.fm).
This method requires that the following configuration parameters be set:
@@ -115,6 +116,17 @@
=back
+Optional parameter:
+
+=over 4
+
+=item * service
+
+The URL of the AudioScrobbler service to use, defaults to http://post.audioscrobbler.com/.
+http://turtle.libre.fm or other libre.fm instances should also work.
+
+=back
+
If the handshake is successful, the method returns a true value, and
the L<submit> method may be invoked. Otherwise, an appropriate error
message may be retrieved via the L<err> method.
@@ -150,7 +162,8 @@
$self->{'nexturl'} = 'http://furrfu.furrblah/furrquux';
return 1;
}
- $req = new HTTP::Request('GET', "http://post.audioscrobbler.com/?$s");
+ my $service = ( $self->{'cfg'}{'service'} ? $self->{'cfg'}{'service'} : "http://post.audioscrobbler.com" );
+ $req = new HTTP::Request('GET', "$service/?$s");
if (!$req) {
$self->err('Could not create the handshake request object');
return undef;