Howto: Currently playing Last.fm song as status message in Miranda @ tk here on Monday, September 18, 2006 2:31 AM
Google
You could also try tk Social Bookmarking Search or tk Video Search!

Monday, September 18, 2006

Howto: Currently playing Last.fm song as status message in Miranda

Background
A few months back I asked if this was possible. No one seemed to know back then.

At first, I tried to do this by retrieving it from the recently played rss of audioscrobbler. But I bumped into some problems when I realized there was no way of accessing a rss contact (at least not for the RSS News Popup plugin).

Solution
Yesterday, after much trial and error, I finally figured it out. I was playing around with Last.fm, trying to figure how to use an external player with it. I figured that one out eventually, but I found out something else. By opening C:\Documents and Settings\Your Username\Local Settings\Application Data\Last.fm\Client\webservice.log and searching for "WebService::requestMetaDataRadio", you will see a url like "ws.audioscrobbler.com/radio/np.php?session=xxx" where xxx should be an md5 checksum. When you load this url into your browser, guess what you see (I won't tell you, try it yourself).

With this in mind, I proceeded to work. You'll require the Webview plugin, Variables plugin, New away System plugin (or an away system that supports Variables) and My Details plugin (optional, to check your status message).

Webview
The first thing you need to do is make a Webview contact with the url above, "ws.audioscrobbler.com/radio/np.php?session=xxx". Set it to update data every 1 min.

In contact options, set display to Between start and end strings. Fill the start box with "artist=" and end box with "track_url=", w/o quotes.

In alert options, tick enable alerts. Choose Alert when, a specific part of webpage changes. Choose Alert Type, Log to File. Fill the start box with "artist=" and end box with "track_url=", w/o quotes. Under Log to file, choose where you want the log file to be and remember where you placed it, this is needed later on. DO NOT tick append data to file.

Variables
1st version:
?if(?stricmp(?substr(?txtfile(`C:\Program Files\Miranda IM\last.fm\track.txt`,3),1,6),artist),Now listening to ?substr(?txtfile(`C:\Program Files\Miranda IM\last.fm\track.txt`,3),8,99) - ?substr(?txtfile(`C:\Program Files\Miranda IM\last.fm\track.txt`,5),7,99),?nas_predefinedmessage(?mstatus()))

2nd version:
?if(?stricmp(?substr(?txtfile(`C:\Program Files\Miranda IM\last.fm\track.txt`,3),1,6),artist),Now listening to ?substr(?txtfile(`C:\Program Files\Miranda IM\last.fm\track.txt`,3),8,99) - ?substr(?txtfile(`C:\Program Files\Miranda\last.fm\track.txt`,5),7,99) on Last.fm,?if(?and(!processrunning(xmplay.exe),?not(!stricmp(!findwindow(XMPLAY-MAIN),xmplay 3.3))),Now listening to !findwindow(XMPLAY-MAIN),?nas_predefinedmessage(?mstatus())))

The 1st version shows "Now listening to Artist - Track name" if something is playing on last.fm, otherwise it shows the predefined message for that status.

The 2nd version also shows "Now listening to Artist - Track name on Last.fm" if something is playing on last.fm. If nothing is playing on last.fm, but something is playing on XMPlay, then "Now listening to xxx" will be shown. If both are not playing, the predefined message for that status is shown. If both are playing, Last.fm takes priority.

Choose which version you want and paste it into the Variables test area and tick Auto parse. You'll have to change "C:\Program Files\Miranda\last.fm\track.txt" to the name of the log file you chose in the webview section. If you choose the 2nd version, you'll have to change the code to fit your player if it is not XMPlay.

Launch the last.fm player and start playing. Within a min, the text should change to the track currently playing.

New away System
Make a new status message and paste your modified code in. Switch to that message and you're set.

Categories:
Cool Tech

 

2 people had something to say! Why don't you join in? The more the merrier!

On 05 January, 2007 03:10, devein said...

there is a script to do this:
http://addons.miranda-im.org/details.php?action=viewfile&id=3185

best option would be last.fm player support in watrack.dll miranda plugin...

On 29 August, 2008 17:25, Anonymous said...

Tank you!! I have bin looking for a solution to this also for some time now.

Google
You could also try tk Social Bookmarking Search or tk Video Search!