Build a .scrobbler.log file from the RadioDJ history table

One thing that I’ve been trying to figure out how to do is report the tracks I’ve listened to/played via RadioDJ to last.fm. With the little bit of time I’ve had the best solution I’ve been able to come up with thus far is creating a log file from the info stored in RadioDJ’s database, then uploading that log file via someone else’s “scrobbler”.

First, the SQL query to build a .scrobbler.log file:
SELECT `artist`, `album`, `title`, `track_no`, cast(duration as decimal(10,0)), 'L' AS `listened_dummy_field`, UNIX_TIMESTAMP(date_played) FROM `history` WHERE `song_type`='0' AND `date_played` LIKE '2015-06-25%' ORDER BY `date_played` DESC INTO OUTFILE 'C:/.scrobbler.log' FIELDS TERMINATED BY '\t';

The code above currently pulls the info from the history table–assuming that the RadioDJ database has already been selected for use, of course–and outputs all the plays for the set date (set by the `date_played` LIKE '2015-06-25%') into a tab delimited text file. As of now, I’ve found two services that will use the file created: the online scroblr.net, and a standalone client called LogScrobbler. I’m hoping that I can later tweak the query and find a way to inject the proper headers into the .scrobbler.log file, so that the log-file is more compatible with other scrobbling clients. My end-goal is to create either a batch process that does all that, and uses a command-line scrobbling client, OR some sort of php script that handles querying the database and posting to last.fm…

…needless to say, I also want a better way to handle the date option. And, finding a way to scrobble in “real-time” would be preferable, rather than this “bulk” scrobbling option.

Inspiration for this little project:
http://www.rockbox.org/wiki/LastFMLog
http://www.audioscrobbler.net/wiki/Portable_Player_Logging

One thought on “Build a .scrobbler.log file from the RadioDJ history table”

Leave a Reply

Your email address will not be published. Required fields are marked *