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

Ashley Bostock abostock at gmail.com
Sat Jan 5 17:58:48 UTC 2008


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

Second you will need to run the following SQL to set the correct submittion
settings
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
banned.

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
mysql
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"
file.
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.

Thanks,
Ash
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mythtv.org/pipermail/mythtv-users/attachments/20080105/8e9895a8/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mythlastfm.pl.gz
Type: application/x-gzip
Size: 1467 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-users/attachments/20080105/8e9895a8/attachment.bin 


More information about the mythtv-users mailing list