"Plugin" for submitting data from MOC to Last.fm

Forums:

Alright, so it isn't a plugin. As far as I know, MOC doesn't have a plugin structure... Or perhaps it does, but I haven't looked at it. :o/

Anyway -- I faced the problem of liking MOC, but wanting to submit the feed of which songs I listen to Last.fm. other people are able to do it with other players, which have their respective plugins. After searching a bit (not much) I decided to write my own, in Python. It was easy.

I used lastfmsubmitd to handle the interface with the last.fm protocol, and the rest was really easy -- just opening MOC from time to time and asking it which song it is playing.

Of course, it would be nicer if one could execute a program on song change. Is this possible?

Anyway, I thought this might be useful for someone out there, so I am posting here the link to the program.

There is no possibility to run commands when song is changed now.
See http://moc.daper.net/node/214 for more info.

That is a pity. That option alone would be handy. Or at least a plugin API.

Jack Miller who has recently sent me few patches fixing bugs and adding new features (like average bitrate displayed by mocp -i and settings volume from command line) mailed me recently that he is interested in implementation of the OnSongChange config option (and more), so there is a big chance that it will appear in MOC.

--
Damian Pietras - MOC developer

Nice script, thanks for that. AFAIK this is the first attempt to connect MOC with lastfm.

--
Damian Pietras - MOC developer

You are welcome! I'm glad that someone finds it useful.

For me, at least, it is working quite flawlessly:
http://www.last.fm/user/Anarres/

I am considering rewritting it to make the script a bit better -- a bit more programlike, and less like a quick homemade hack. But I will do that after I am done with exams, in two or three weeks.

One of the problems I am having is with non-ASCII tracks, which tend to display special characters (accented letters, beta, eñe, etc.) in weird ways. That probably has more to do with the encoding of the files themselves and/or the locale setup of my system, though.

Perhaps there is a way to translate these to an ASCII approximation... I need to think on this.

(Just thinking out loud.)

If you want to approximate to ASCII you could take a look at 'recode' (standard linux tool).
I used it only in other contexts but afaik it can strip accents and other special 'decorations' from characters.