Audioscrobbling silently failing (and MusicBrainz ID)

Need help? Post your questions here.

Moderator: moderators

Audioscrobbling silently failing (and MusicBrainz ID)

Postby haraldme » Mon Apr 16, 2007 7:34 pm

Hi, I'm having some trouble getting the AudioScrobbling support in 3.0 working.

My subsonic.log shows plenty of entries "Successfully scrobbled song 'Son of a Preacher Man' for user haraldme at Last.fm.", and network packet sniffing appears to confirm that the AudioScrobbler submission POST was successful -- yet still my last.fm page keeps saying "No recent track to display." :(

My first guess for the cause of this is that my tracks appear to be submitted to AudioScrobbler with zero track length (l[0]=0). Could this be an artifact of my setup doing transcoding from FLAC to Ogg Vorbis (e.g. maybe the track length isn't known until the entire stream has been played)? If so, wouldn't it be better to submit with "l[0]=", i.e. to tell that Subsonic doesn't know the track's length?

If the zero size isn't the problem, my second guess would be that this is caused by some kind of protocol violation from Subsonic's side, e.g. as detailed in the protocol spec:

The three main reasons that submissions are OK'd but not entered are:

* Bad UTF-8
* Bad tagging (we now completely drop any entries which look crap, e.g. 01-artist_blah)
* Spam filter (sanity checks like claiming to have played 10 songs in 10 seconds -- not possible)


I also noticed that the POST data produced by Subsonic doesn't include any MusicBrainz ID even though my FLAC-to-Ogg-transcoded streams do include proper MUSICBRAINZ_TRACKID comments. Is support for AudioScrobbling MusizBrainz IDs planned?

BTW, I'm running this on an Ubuntu Linux 7.04 Beta box, under Sun Java 5; both Java and Tomcat 5.5 installed from Ubuntu packages. Let me know if you'd like to have a look at the packet sniffing data or my FLAC/Ogg tags/comments.
haraldme
 
Posts: 3
Joined: Mon Apr 16, 2007 6:52 pm

Postby sindre_mehus » Tue Apr 17, 2007 12:39 am

Hi Harald and thanks for your thorough report.

Yeah, I agree that zero track length is likely candidate to be the problem. I'll try to reproduce it and come up with a fix. I'd appreciate it if you send me the POST-request from your packet sniffing data.

Also, I'll see if I'm able to pull out the MusizBrainz ID, but I think that will be difficult since Subsonic does not (yet) support reading/writing FLAC tags (and using tags from the transcoded Ogg stream is not an option).

Thanks 8)
Sindre
User avatar
sindre_mehus
 
Posts: 1955
Joined: Tue Nov 29, 2005 6:19 pm
Location: Oslo, Norway

Postby haraldme » Tue Apr 17, 2007 8:20 am

sindre_mehus wrote:Yeah, I agree that zero track length is likely candidate to be the problem. I'll try to reproduce it and come up with a fix. I'd appreciate it if you send me the POST-request from your packet sniffing data.


Sure, here it is:
Code: Select all
POST /protocol_1.1 HTTP/1.1
User-Agent: Jakarta Commons-HttpClient/3.0.1
Host: 87.117.229.205
Content-Length: 169
Content-Type: application/x-www-form-urlencoded

a%5B0%5D=Various&b%5B0%5D=Pulp+Fiction&i%5B0%5D=2007-04-16+19%3A10%3A12&t%5B0%5D=Son+of+a+Preacher+Man&u=haraldme&m%5B0%5D=&s=cf1e42be8f625455e3038163eec2b54e&l%5B0%5D=0


(I'm guessing that you're not that interested in the server reply, but just let me know if you'd like that as well.)

sindre_mehus wrote:Also, I'll see if I'm able to pull out the MusizBrainz ID, but I think that will be difficult since Subsonic does not (yet) support reading/writing FLAC tags (and using tags from the transcoded Ogg stream is not an option).


Ok, I understand. I'll keep my fingers crossed, then. ;)

Cheers, Harald[/code]
haraldme
 
Posts: 3
Joined: Mon Apr 16, 2007 6:52 pm

Patch: Fix AudioScrobbler when track duration is unknown

Postby haraldme » Thu Apr 19, 2007 12:41 am

Hi,

I went ahead and had a look at the problem I had with audioscrobbling FLAC-to-Ogg-transcoded files. I think I've got a fix, but as I don't know how to build SubSonic from source, I've been unable to test this.

Please find my patch at the end of this post (this forum doesn't appear to have any support for attaching files to posts, so I'm hoping this inline patch won't be mangled by any automatic line breaking or such. Is there any policy on how patches should be communcated?).

(I've also started implemention of a metadata parser class for FLAC files, but that's still far from ready; if anyone wants to beat me to it, please go ahead.)

Regards, Harald

Code: Select all
=== modified file 'subsonic-main/src/main/java/net/sourceforge/subsonic/service/AudioScrobblerService.java'
--- subsonic-main/src/main/java/net/sourceforge/subsonic/service/AudioScrobblerService.java     2007-04-10 01:54:42 +0000
+++ subsonic-main/src/main/java/net/sourceforge/subsonic/service/AudioScrobblerService.java     2007-04-18 22:57:42 +0000
@@ -79,7 +79,7 @@
         }

         UserSettings userSettings = settingsService.getUserSettings(username);
-        if (!userSettings.isLastFmEnabled() || userSettings.getLastFmUsername() == null || userSettings.getLastFmUsername() == null) {
+        if (!userSettings.isLastFmEnabled() || userSettings.getLastFmUsername() == null || userSettings.getLastFmPassword() == null) {
             return null;
         }

@@ -97,7 +97,7 @@
         reg.artist = metaData.getArtist();
         reg.album = metaData.getAlbum();
         reg.title = metaData.getTitle();
-        reg.duration = metaData.getDuration() == null ? 0 : metaData.getDuration();
+        reg.duration = metaData.getDuration();
         reg.time = new Date(now);

         return reg;
@@ -149,7 +149,7 @@
         params.put("t[0]", registrationData.title);
         params.put("b[0]", registrationData.album);
         params.put("m[0]", "");
-        params.put("l[0]", String.valueOf(registrationData.duration));
+        params.put("l[0]", registrationData.duration == null ? "" : registrationData.duration.toString();
         params.put("i[0]", time);

         lines = executePostRequest(url, params);
@@ -264,7 +264,7 @@
         private String artist;
         private String album;
         private String title;
-        private int duration;
+        private Integer duration;
         private Date time;
     }
}
\ No newline at end of file

haraldme
 
Posts: 3
Joined: Mon Apr 16, 2007 6:52 pm

Postby sindre_mehus » Thu Apr 19, 2007 12:36 pm

Hi again, and thanks for getting your fingers dirty!

First of all, I can confirm that it is the zero track length that is the problem. After I submitted a track with l[0]=0 I visited my last.fm page, which displayed the following warning:

Some tracks you submitted have not been added to your profile for the following reason:
Submitted length out of bounds.


Unfortunately, sending an empty string (as per your patch), or omitting the l[0] parameter altogether, resulted in a similar warning:

Some tracks you submitted have not been added to your profile for the following reason:
The track is too short to be submitted.


So what do you think, should we discard the audioscrobbler registration, or should we just fake a value (say 3 minutes) if the actual length is unknown?

Sindre

PS: Glad to hear that you've started on a FLAC tag parser!
User avatar
sindre_mehus
 
Posts: 1955
Joined: Tue Nov 29, 2005 6:19 pm
Location: Oslo, Norway


Return to Help

Who is online

Users browsing this forum: No registered users and 10 guests