This is the bug/patch tracker for Rockbox. Click here for more information.
Quick links: Bugs · Patches · Rockbox frontpage
FS#5166 - Audioscrobbler / last.fm log
|
DetailsPatch to implement spec at http://www.audioscrobbler.net/wiki/Portable_Player_Logging
TODO: check for valid metadata before adding check on platforms without RTC |
This task depends upon
Closed by Linus Nielsen Feltzing (linusnielsen)
Thursday, 19 October 2006, 11:43 GMT+2
Reason for closing: Accepted
Additional comments about closing: Thanks, Robert!
Thursday, 19 October 2006, 11:43 GMT+2
Reason for closing: Accepted
Additional comments about closing: Thanks, Robert!
http://www.rockbox.org/tracker/task/2564
Removed support for targets without a RTC (since this has been removed from the spec - it might be added later)
S vs L is still guesswork - need to add a function to the playback engine to return the mp3entry.elapsed value for the last track - at the moment this /could/ be added to Archos Recorders (if the code isn't too big?) - so would need to add this to both HW and SW engines
I didn't see the other patch - I tried doing something similar to that before (writing a custom log format, and with a C++ CLI app to upload the results) but the current scrobbler spam system tended to eat the results when a desktop PC was also being used.
but i doubt this will be changed ... but will hope to :)
I think it's going to be at least a month before the support is added to the new AS beta client.
Untested on HWCODEC platforms - it compiles cleanly, but is too big for flash - no idea if it actually works on Archos.
Working here on SWCODEC (5g)
First of all: It works like a charm (with latest build)! :)
I listend to the following tracks:
Boards Of Canada - Geogaddi - Track 1 - 0:59 - listened to until end
Boards Of Canada - Geogaddi - Track 2 - 5:21 - listened to until end
Boards Of Canada - Geogaddi - Track 3 - 0:37 - listened to until end
Boards Of Canada - Geogaddi - Track 4 - 3:35 - skipped at 1:20
Boards Of Canada - Geogaddi - Track 5 - 1:15 - skipped at 1:01
Boards Of Canada - Geogaddi - Track 6 - 6:12 - listened to until end
Boards Of Canada - Geogaddi - Track 7 - 1:22 - shutoff at 1:02
The logfile:
#AUDIOSCROBBLER/1.0
#TZ/UNKNOWN
#CLIENT/Rockbox x5 1.0
Biosphere Substrata Poa Alpina 2 250 S 1147537029
Boards Of Canada Geogaddi Music Is Math 2 321 L 1147538190
Boards Of Canada Geogaddi Beware The Friendly Stranger 3 37 L 1147538511
Boards Of Canada Geogaddi Gyroscope 4 215 S 1147538549
Boards Of Canada Geogaddi Dandelion 75 L 1147538632
Boards Of Canada Geogaddi Sunshine Recorder 6 372 L 1147538694
Boards Of Canada Geogaddi In The Annexe 7 82 L 1147539067
Before I've listened to Boards Of Canada I've listened to the first two tracks of Biosphere/Substrata.
So everything went fine except the first tracks were not logged.
Nevertheless: Great work! Can't wait for the next revision of the Audioscrobbler software to test the logfile.
I think it's an problem with the audio_set_track_changed_event() - but I need to put some test code together to confirm that.
I toggled playback of both albums by selecting the first track in the file system (I use file browsing instead of tag database).
Few other minor clean-ups
Because I couldn't wait for the official software I wrote a perl script to submit the logs automatically, the misticriver thread is this:
http://www.misticriver.net/showthread.php?t=33245&page=5
One thing I believe is handled wrong in the patch is the issue of missing Track numbers. At the moment this is replaced by another \\t, resulting in \\t\\t\\t with separators. I understand the spec like this: Track number is set to blank, resulting to \\t\\t with separators. This would make the parsing easier and makes imho more sense.
Great work on the uploader - I was looking to do this myself. Any chance you could post it here for those not signed-up to Misticriver?
I also build the latest misticriver experimental build for the H300 with this patch - get it in my gallery there.
The script should already address the issue with the \\t\\t\\t by replacing them with \\t\\t :)
http://www.rockbox.org/tracker/task/2564
This one does everything in the playback.c, but is imho a bit shorter. This is kindof important for combining the patch with others as long we have a feature freeze (we do have one,eh?). I guess its due to the rtc detection done in your code.
Probably the problem with the missing first song is avoided by using swap_codec to call the logging function instead of audio_set_track_changed_event - maybe thats an alternative for your code as well? I'm trying to find a decent editor for linux now, maybe I'll write some own modifications afterwards. Anyways, having two teams develop the same stuff is probably a bit too much...
Link to the latest experimental H300 build, now open for everyone:
http://www.misticriver.net/photos/displayimage.php?album=lastup&cat=22288&pos=0
Most of this patch is in the scrobbler.c and .h files - these will patch cleanly since they're new files being added to the source. It's mostly the menu and lang strings that are likely to date the fastest and cause rejections - I don't think there is a lot that can be done about those (since the logging needs to be optional). It's easy enough to manually fix those anyway.
I've just checked out the source from before the playback changes - this doesn't have any problems with the audio_set_track_changed_event(), so I've created a new bug report (
FS#5495).like only storing the played songs including duration, the compute the playtime "backwards" from the current time. This way all can be submitted. Its cheating and messing up statistics, but I don't really care if there is no other choice.
Some comments about the current patch:
- The "ipod comment" has to be replaced with a proper one (just search for ipod)
- The change in the Makefile is not clear to me, what does it do?
- why is prev_track_elapsed set in playback.c _and_ mpeg.c?
-Ipod comment - oops - I was copy/pasting from an different patch I wrote - I'll correct that.
-The Makefile change allows me to use the ARCHOS variable set by the configure script - this is a text string describing the target, ie ipodvideo/h120/recorderv2 etc. After speaking to Russ and RJ from Audioscrobbler I added the third header line to the spec - this will allow them to pin down any problem clients.
-This is down to HWCODEC vs SWCODEC in Rockbox - Archos devices use a hardware chip to decode MP3s, the rest use the SWCODEC engine in playback.c Both share audio.h The code in mpeg.c is AFAIK untested.
I'll (hopefully) post a version of the patch for non-RTC targets tomorrow.
You are in contact with Russ&RJ? I didn't get a response so far, thats why my testing script still uses the tst id. I'm just implementing the handling of the header so any mobile player generating these logs can use the script. How is the Client ID and # going to be submitted? So far its not in the protocol, probably another line of handshaking...
Another small difference between your implementation and the protocol:
[quote log definition]
- unix timestamp when song started playing
[/quote]
as far as I understood the code the timestamp is saved after the track was played... I don't think this is really important though :)
The non-RTC code (and also the HWCODEC platforms) is untested - feedback is welcome :)
Just as a heads up the last.fm submission system is going down for a 3 day upgrade.
Never did any perl before, but this seems to work, so I hope it can be helpful !
BUT: at the moment you must tell the script to ignore the timestamps from the log by appending the -n option.
Sounds confusing? It hopefully isn't. For a full listing of options just call the script without any option. I gave two examples which should cover it all. And once the .bat is set up you never have to look at it again, until the next update :)
BTW: Sticked to Hajobens changes, but perlified in some way :)
Does writing a wrong user password give an error for you? It should be catched in Scrobbler.pm, but isn't displayed for some strange reason
This is most likely still buggy code - but I just submitted my daily dose of songs on the first try :)
http://www.misticriver.net/showthread.php?p=457370#post457370
There is a build for H100 and the updated script zip in my gallery over at that site. Sorry for using this lazy way, but I'm pretty busy right now. The above linked script is working fine for me here, need a changed .bat though (but you'll figure out ;)
@piha:
nice work, but honestly I would be too scared about my precious last.fm password :)
But I guess not everyone cares as much as I do, so thanks for writing the webapp.
for example
log from scrobbler.pl:
-- Log by Rockbox ipodmini2g ver. 1.0 --
-- taking provided UTC offset +2 --
------------------------------------------
L: Artist: Diary Of Dreams| Album: PaniK Manifesto EP| Track: The Scream| Lenght.: 265|UTC Playtime: Fri Jun 23 07:35:35 2006|local Playtime: Fri Jun 23 09:35:35 2006|faked playtimeFri Jun 23 10:50:02 2006| submitted Fri Jun 23 07:35:35 2006
L: Artist: Diary Of Dreams| Album: PaniK Manifesto EP| Track: Monsters and Demons| Lenght.: 284|UTC Playtime: Fri Jun 23 07:40:01 2006|local Playtime: Fri Jun 23 09:40:01 2006|faked playtimeFri Jun 23 10:54:46 2006| submitted Fri Jun 23 07:40:01 2006
L: Artist: Diary of Dreams| Album: One of 18 Angels| Track: Rumours of angels| Lenght.: 500|UTC Playtime: Fri Jun 23 07:44:45 2006|local Playtime: Fri Jun 23 09:44:45 2006|faked playtimeFri Jun 23 11:03:06 2006| submitted Fri Jun 23 07:44:45 2006
L: Artist: Diary of Dreams| Album: One of 18 Angels| Track: Butterfly:dance!| Lenght.: 408|UTC Playtime: Fri Jun 23 07:53:05 2006|local Playtime: Fri Jun 23 09:53:05 2006|faked playtimeFri Jun 23 11:09:54 2006| submitted Fri Jun 23 07:53:05 2006
L: Artist: Diary of Dreams| Album: One of 18 Angels| Track: Mankind| Lenght.: 380|UTC Playtime: Fri Jun 23 07:59:54 2006|local Playtime: Fri Jun 23 09:59:54 2006|faked playtimeFri Jun 23 11:16:14 2006| submitted Fri Jun 23 07:59:54 2006
UTC Playtime is correct.
and last.fm shows that first song played at the time of submission and doesn't accepts other tracks .. here is part of rss with last played tracks:
<item>
<title>Diary of Dreams - The Scream</title>
<link>http://www.last.fm/music/Diary+of+Dreams/_/The+Scream</link>
<pubDate>Fri, 23 Jun 2006 11:16:19 +0000</pubDate>
<guid>http://www.last.fm/user/theli_ua/#1151061379</guid>
<description>http://www.last.fm/music/Diary+of+Dreams</description>
</item>
this is the only item here (rss keeps 10 recent/last played tracks)
<pubDate>Fri, 23 Jun 2006 08:31:47 +0000</pubDate>
<lastBuildDate>Fri, 23 Jun 2006 08:31:47 +0000</lastBuildDate>
<title>Diary of Dreams - The Scream</title>
<link>http://www.last.fm/music/Diary+of+Dreams/_/The+Scream</link>
<pubDate>Fri, 23 Jun 2006 11:16:19 +0000</pubDate>
this is not only in rss it shows that everywhere
Could you please paste the header in the .scrobbler.log here or mail it to me, address is in the console output :)
Let me know if these still happen.
I tried to compile a new build with the scrobbler.patch. But unfortunatly I'm not a skilled programmer, so I failed...
*cough* Could someone of you wonderful guys make a sync to the newest build? Please?
(Shame on me)
The last versions did work an a X5 (except the first-track-problem, see above).
Removed the playtime guess used by scrobbler_shutdown and renamed a function and variable.
-renamed the menu entry from "Audioscrobbler Log" to "Last.fm Log"
-moved mktime() to timefuncs.c - this is currently defined for all targets, I don't know if it should be wrapped up in a "#ifdef CONFIG_RTC" or not?
Also removed some debug code.
I did some debugging and discovered that while global_settings.audioscrobbler is set to true when the settings are loaded, it is false by the time scrobbler_init() is called. I have no idea why this is happening. I was able to work around it with the attached patch, which sets a bool in scrobbler.c from settings_apply(). So, global_settings.audioscrobbler is somehow getting cleared between settings_apply() and scrobbler_init().
I'd love to hear if anyone else is having this problem.
And have exactly the same problem
My workaround is to move the bool audioscrobbler variable
up in the "user_settings" struct. Then the value is correct
I suspect either some memory overwrite or an toolchain
problem because it depends also where the scrobbler.c file is
located in the SOURCES file.
It also dont depend on the scrobbler patch.
It can be reproduced with other settings to
and if possible file a bug report for it
I also updated the settings.patch mentioned previously. (Everything builds with that patch applied, too.)
Bye Norbert
Anyway, now I see the log file.
Thanks.
Ciao
Norb
Sorry for my English,
Alexander
I have a X5 powered with Rockbox and the scrobbler patch. Well, this patch does work on the X5 perfectly. At the moment there is just one fault: The first track of a selection of tracks doesn't get logged. But this doesn't seem to be a problem of the patch. This seems to be a (small) bug of the Rockbox firmware.
I don't have any russian tagged tracks, but I have german (Kraftwerk) and icelandic (Sigur Rós). They are logged, submitted and scrobbled correctly! ;)
Nothing was logged.
Didn't patch the settings file, so I just did that, and I'm rebuilding right now.
Thanx.
You did a bad job looking.
I'm GMT-5 and changed the log to reflect this, however, when I start listening to music around 6am when I'm getting ready for school, then continuing to listen to music until 4 - 4:30pm when I get home and submit, the hour is off by a few hours, but only during this time.
If I keep my DAP plugged in and playing during the night, the track times will be correct when I submit the log in the morning.
this first test version is available at http://www.yourfilehost.com/media.php?cat=other&file=LogScrobbler.zip as well
I still have to make it clear the old file out, but it seems to work good. I will be making it detect the MP3 player when it is plugged in and ask if you want to upload your .scrobbler.log to last.fm
right now you have to add your username/password/and browse for the .scrobbler.log file and click Go!
I'll release a much better version soon with source.
here is is again
1) You should perhaps declare some globals and functions static, unless they need to be exported.
2) I think you should open the file with O_WRONLY and not O_RDWR in write_cache().
This looks like CVS material to me.
-The last track isn't logged. (It should be caught if it's resumed...)
-If auto-resume is enabled, the first resumed song won't be logged. (I think it's a bug in playback.c -
FS#5495)-If the track doesn't have enough tag information - it must have at least artist and track name.
-The log info is held in memory, currently upto 32 tracks, before being written to disc. It will write this cache earlier on non-flash devices IF the drive is spinning while the track changes - so if you're doing a lot of skipping you're probably flush the cache. If you don't shutdown cleanly, or your player crashes/locks up, you'll loose whatever hasn't been written.
-If the length of the log line produced is more than 512 characters (ie very long artist, track name etc).
I tested it for several hours yesterday (a good mix of L and S) and didn't have any problems.
What kind of player do you have? Can you go through a playlist of tracks (with known good meta info), note down what you skip and see how this compares to the log? The patch does use logf in places, so it might be worth trying a logf enabled build.
The last few times it seems to be working OK, weird
Here is what I thought was happening to me.
When I delete the .scrobbler.log via USB connection, then restart the player it creates a new .scrobbler.log file, but does not seem to populate the file unless I reset the device one more time.
That lead me to think that when the file is created a pointer is left open on the file so it cannot be written to by another thread, but when I look at the latest patch(which is the one I applied -- Monday, 02 October 2006, 11:26PM --) it looks like where the file is created, it is created with O_RDWR and is also closed at the end of the _init
I am going to run through a few more scenarios with a single known good playlist(good tags, that have shown up in the .scrobbler.log before ok),I'll post what I find.
How do I build it with logf? is that the (D)ev build
Yup, logf is a dev build option. When it's running you'll have 2 extra options under the Info->Debug menu - you can either view the log onscreen, or write it to a file.
as stated in the audioscrobbler.com wiki page:
"The audioscrobbler software will check for .scrobbler.log in the root of any connected usb devices. It will parse the file and submit the songs to the audioscrobbler server. The audioscrobbler software will then delete the file from the device."
or is the only way to submit tracks via a manual submission method?
At the moment the only method is via various forms of manual submission (perl script, web site and windows app).
http://www.yourfilehost.com/media.php?cat=other&file=LogScrobbler_0.3.zip
Hope it helps some that don't want to enter their data into a .ru site, or know how to get the perl version working, the perl version works great from my experience but I just didn't want to set it up on each PC I might sync from, so I thought I needed an app that just ran in systray.
Cheers
Tim G.
Tim - how did you get on with the testing?
Thanks again,
Tim G
this new version is kinda cool, say you let your girlfriend borrows your portable device, and she listens to Britney Spears all day but you didn't sync your log before hand. This version will let you choose which songs it will sync, cause it would suck if all of your friends visited your last.fm and saw what you really listen to ;-)
http://www.yourfilehost.com/media.php?cat=other&file=LogScrobbler_0.5.zip
This version also uses UTC time for posting files(since it was supposed to to begin with), and maybe a few other fixes
(http://logscrobbler.googlecode.com/svn/trunk/%20logscrobbler/bin/Release/LogScrobbler-0.6.zip)
* I think this fixes some issue with safely removing usb device.
* added setting for exit after processing complete
* added progress bar.
Tim G.
i have the iriver h140
rockbox-daily-20061009
#AUDIOSCROBBLER/1.0
#TZ/UNKNOWN
#CLIENT/Rockbox h120 1.0 Timeless
Crazy Town The Gift Of Game Toxic 2 168 S 0
Linkin Park Hybrid Theory A Place For My Head 9 184 S 0
Finch What It Is To Burn Perfection Through Silence 5 189 S 0
Nothingface Skeletons Here Come The Butchers 8 178 L 0
the last track i stopped near the end of the song
im assuming S stands for skipped because when i run that perl script to submit the tracks it skips right over the songs with the S
also is last.fm ever going to allow submissions out of order? because its lame how it doesnt take tracks that were played before your last entry... i personally dont bring my player home every day after work to submit the tracks played
http://logscrobbler.googlecode.com/svn/trunk/%20logscrobbler/bin/Release/LogScrobbler-Latest.zip
Added Shift Time(In case you listen to some tracks on your PC before syncing your log)
Show last posts to Last.FM
Bug Fixes
Haven't yet tested on target.