[mythtv-users] Script to submit tracks played in MythMusic to last.fm

Ashley Bostock abostock at gmail.com
Sat Jan 5 16:05:45 UTC 2008

First off DO NOT use the attached script unless you are running svn 15222 or

Second you will need to run the following SQL to set the correct submittion
for MythMusic (replace the HOSTNAME part)...

INSERT INTO settings (value,data,hostname) VALUE('MusicLastPlayDelay',
'240', 'HOSTNAME');

This is so that songs do not get marked as played unless they have been
playing for
at least 240 seconds or half their length, whichever comes first. It's
important to do the
above as those rules are set by last.fm and if you break them then the
script could get

On my machine I've set the script to run every 5mins in a cronjob but before
it's run for
the first time you'll need to...

1) Change these lines to the relevant username/password for last.fm and
my $lastfmuser  = 'USERNAME';
my $lastfmpass  = 'PASSWORD';
my $dbuser      = 'mythtv';
my $dbpass      = 'mythtv';

2) Run this line in the same folder as the script to create a "lastrun"
date +%s > lastrun

It will stick the current time in the file, then everything you play in
mythmusic from now
on will get submitted.

For testing you can also run the script as...
./mythlastfm.pl debug
...and it will output some debug status messages.

Please let us know if you have any suggestions/improvements.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mythtv.org/pipermail/mythtv-users/attachments/20080105/6c7acd0c/attachment.htm 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mythlastfm.pl
Url: http://mythtv.org/pipermail/mythtv-users/attachments/20080105/6c7acd0c/attachment.diff 

More information about the mythtv-users mailing list