Last.fm

Hey there!
I just founded a last.fm group. If you like last.fm and moc feel free to join. Unfortunately moc doesn't support scrobbling.

Hi! I revive this thread now that moc has this nyw songonchange-thing. How do I do to make it work with lastfm? If i understand, this was what the function was meant for? Is some stable plugin in the works or something? Why not a wiki for tutorials and explanations for moc?
Thanks, moc is great!

The function is just (and nothing more than) a mechanism to run a script when MOC starts playing a song. It can make easier writing a script for last.fm like this one: http://moc.daper.net/node/215 In this case the script polls MOC regulary to see if the song was changed but with OnSongChange MOC can notify the script.

The description is in config.example file in MOC sources (unstable version), it's nothing complex and IMHO it doesn't require a longer descrition.

--
Damian Pietras - MOC developer

Okey, but someone still has to write the script? Or can the existing script you linked be adapted to onsongchange? Is this lastfm-support meant to be included in 2.5-stable?

Yes, someone must write a script. If it appears it will be at least posted on this site I think.

--
Damian Pietras - MOC developer

You don't need to roll your own script (unless you really want to). Just install lastfmsubmitd, the program has several utilities, one is lastfmsubmit --which is a python script. It submits your artist,title,length,album info to lastfm.

I use ubuntu, so the script is installed in /usr/lib/lastfmsubmitd/

I have the following in my ~/.moc/config file:

OnSongChange = "/usr/lib/lastfmsubmitd/lastfmsubmit --artist %a --title %t --length %d --album %b"

I've been using it for a couple of weeks without issues.

xmonk

I've been trying to get that to work, but I for some reason can't get the OnSongChange thing to work at all.

It's not a lastfmsubmitd problem though as I can run it manually and nothing seems to want to run from OnSongChange :/

I've spent all day trying to make MOC work with lastfmsubmitd. If I run lastfmsubmitd manually, it works like a charm, so I'm not worried about whether that's configured correctly.

To test, I put the following line in my ~/.moc/config OnSongChange = "echo working >> /home/ragnarok/onsongchange"

Then I run watch ls ~/ \| grep onsongchange to see whether that file ever gets created. It never does.

Any advice at all here? Am I at least testing this correctly? I can't get OnSongChange to call anything.

Output of mocp -V is moc 2.5.0-alpha3 Build: Jun 13 2009 17:19:44
Output of uname -a is Linux Stirling 2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16 14:04:26 UTC 2009 i686 GNU/Linux

It's working! The absolute only thing I changed was to copy the example config file in /usr/share/doc/moc/examples and use that. I uncommented OnSongChange and declared the line same as always, and now it works.

Also, my echo test could not work, as the example file stated:

No pipes/redirects can be used directly, but writing a shell script can do the job.

Presumably, some environmental declarations are made throughout the example config file. If this is so, then creating a blank config file and adding a declaration for OnSongChange won't work!

I wrote a script that uses OnSongChange, with the additional feature that it will wait until you have listened to half the track before submitting to last.fm. This means that skipping through a list will not result in lots of bogus submissions.

See here: http://lukeplant.me.uk/blog.php?id=1107301687