Welcome, Guest. Please Login or Register
Click Here To Return To The Home Page
 
  HomeHelpSearch Merchandise DonateContactEvent CalendarLoginRegister  
 
Pages: 1 2 
Scrobbling to last.fm (Read 25,662 times)
 
m_gol
Stellar Newbie
*
Offline



Posts: 11
Poland (Warsaw/Stalowa Wola)
Gender: male
Scrobbling to last.fm
27th Feb, 2009 at 12:01am
 
Hi!

Is there any way to scrobble names of songs listened in S.A. to last.fm? I use Amarok 1.4 under Ubuntu 8.04 (Linux) - it has an included mechanism to scrobble songs to last.fm, but it doesn't work for radio stations like S.A.
Back to top
 

Regards,
Michał Gołębiowski
student of Mathematics & Computer Science at the Warsaw University in Poland
 
IP Logged
 
ProgMaster
Stellar Owner
****
Offline


Stellar Attraction

Posts: 3,777
British Isles
Gender: male
Re: Scrobbling to last.fm
Reply #1 - 28th Feb, 2009 at 5:15pm
 
Hi Michał,

I have to confess, I've no idea ... I'll look into this though as I appeciate that last.fm is proving to be increasingly popular these days.

D
Back to top
 

...
WWW WWW 5444228463  
IP Logged
 
fdmartin
Stellar Newbie
*
Offline



Posts: 5
Re: Scrobbling to last.fm
Reply #2 - 11th Aug, 2009 at 4:01pm
 
I've coded a little Python script for this, I hope it's useful:
Code:
import urllib

def scrobble(new_song):
    artist, song = new_song.split(' - ',1)
    params = urllib.urlencode({'submissionType':'track','username':'XXXX', 'password':'XXXXX', 'artist':artist, 'album':'', 'track':song, 'number':1, 'duration':200})
    site = urllib.urlopen('http://lastfmstats.livefrombmore.com/universalscrobbler/scrobble.php?',params)
    site.close()

if __name__ == '__main__':
    while True:
        raw_input()
        site = urllib.urlopen('http://www.stellar-attraction.com/playing.php')
        site_contents = site.read()
        start_index = site_contents.index('href="http://s1.viastreaming.net:7170/listen.pls">')+50
        new_song = site_contents[start_index:site_contents.index('</a>',start_index)]
        print 'Scrobbled %s'%(new_song)
        scrobble(new_song)
        site.close() 



It uses the Universal Scrobbler Site (http://lastfmstats.livefrombmore.com/universalscrobbler/) to manually scrobble the tracks.
You have to replace the XXXXs with username and password. That's it.
Back to top
 
 
IP Logged
 
ProgMaster
Stellar Owner
****
Offline


Stellar Attraction

Posts: 3,777
British Isles
Gender: male
Re: Scrobbling to last.fm
Reply #3 - 11th Aug, 2009 at 6:59pm
 
Wow - a Python coder - very impressive stuff !! Cool

Welcome to S.A. fdmartin. Smiley
Back to top
 

...
WWW WWW 5444228463  
IP Logged
 
huntr_22
Watcher Of The Skies
****
Offline



Posts: 943
France
Gender: male
Re: Scrobbling to last.fm
Reply #4 - 11th Aug, 2009 at 7:08pm
 
Welcome to SA fdmartin! Smiley
Back to top
 
 
IP Logged
 
fdmartin
Stellar Newbie
*
Offline



Posts: 5
Re: Scrobbling to last.fm
Reply #5 - 11th Aug, 2009 at 7:19pm
 
Haha, you're welcome. Thanks for the attention, and I hope the script is useful to all of you. I found the station recently and it's great! Thank you for this fantastic station.
Back to top
 
 
IP Logged
 
ProgMaster
Stellar Owner
****
Offline


Stellar Attraction

Posts: 3,777
British Isles
Gender: male
Re: Scrobbling to last.fm
Reply #6 - 11th Aug, 2009 at 7:25pm
 
No problem, fdmartin. Glad that you were tuned-in to hear the 'shout-out'.

Thanks again for the script. Cool
Back to top
 

...
WWW WWW 5444228463  
IP Logged
 
m_gol
Stellar Newbie
*
Offline



Posts: 11
Poland (Warsaw/Stalowa Wola)
Gender: male
Re: Scrobbling to last.fm
Reply #7 - 11th Aug, 2009 at 7:32pm
 
I'm a bit afraid of how it deals with some texts that are displayed in SA title field apart from song names - sth like "You're not allowed to record..." etc.

What should I expect?
Back to top
 

Regards,
Michał Gołębiowski
student of Mathematics & Computer Science at the Warsaw University in Poland
 
IP Logged
 
ProgMaster
Stellar Owner
****
Offline


Stellar Attraction

Posts: 3,777
British Isles
Gender: male
Re: Scrobbling to last.fm
Reply #8 - 11th Aug, 2009 at 7:40pm
 
m_gol wrote on 11th Aug, 2009 at 7:32pm:
I'm a bit afraid of how it deals with some texts that are displayed in SA title field apart from song names - sth like "You're not allowed to record..." etc.

What should I expect?


Looking at this script at face-value (and not being familiar with Python at all ...) I don't think that this should be a problem, m_gol. It appears to be opening the site / song information from the playing.php script which itself doesn't display any of the (very occasional ...) messages. Basically, the occasional 'message' is only displayed in the listener's media player and never on the S.A. website. Although, I'm sure that fdmartin will be able to provide a full answer.

PS The 'You're not allowed to record ...' message has been removed. Wink
Back to top
 

...
WWW WWW 5444228463  
IP Logged
 
fdmartin
Stellar Newbie
*
Offline



Posts: 5
Re: Scrobbling to last.fm
Reply #9 - 11th Aug, 2009 at 7:59pm
 
I've taken that into account when coding the script, so the song names are taken from the playing.php script, as ProgMaster said. Also notice scrobbles are done manually: you have to press enter in order to get the song scrobbled. I thought it would be more comfortable to do it automatically, but that would mean refreshing the site a considerable amount of times a minute, and I didn't want to put pressure (although low) on the server. After all, it's just pushing a button after the song ends.
Here's a screenshot of the script working:
...
Back to top
 
 
IP Logged
 
ProgMaster
Stellar Owner
****
Offline


Stellar Attraction

Posts: 3,777
British Isles
Gender: male
Re: Scrobbling to last.fm
Reply #10 - 11th Aug, 2009 at 8:44pm
 
Thanks for the update, fdmartin. It certainly looks impressive. Cool
Back to top
 

...
WWW WWW 5444228463  
IP Logged
 
Yes Phreak
Squonk
***
Offline



Posts: 694
Manchester, England
Gender: male
Re: Scrobbling to last.fm
Reply #11 - 11th Aug, 2009 at 9:30pm
 
welcome to SA martin. Smiley
Back to top
 
 
IP Logged
 
matejn
Stellar Newbie
*
Offline



Posts: 2
Re: Scrobbling to last.fm
Reply #12 - 25th Jan, 2010 at 11:35am
 
Hello, I'm sorry for this question but I would like to know where should I copy this code to make it work..  Embarrassed
Back to top
 
 
IP Logged
 
ProgMaster
Stellar Owner
****
Offline


Stellar Attraction

Posts: 3,777
British Isles
Gender: male
Re: Scrobbling to last.fm
Reply #13 - 25th Jan, 2010 at 7:15pm
 
matejn wrote on 25th Jan, 2010 at 11:35am:
Hello, I'm sorry for this question but I would like to know where should I copy this code to make it work..  Embarrassed


Hi there matejn and welcome to S.A. !!

This script will have to be run on a PC, Server etc. that has a Python interpreter. Again, I haven't used Python at all myself, however, doing a quick Google search it returned a few results as to how to run Python scripts on a Windows PC (I'm sure most *Nix flavours will inherently have Python bundled with them).

http://www.python.org/doc/faq/windows/

http://docs.python.org/using/windows.html
Back to top
 

...
WWW WWW 5444228463  
IP Logged
 
matejn
Stellar Newbie
*
Offline



Posts: 2
Re: Scrobbling to last.fm
Reply #14 - 25th Jan, 2010 at 9:38pm
 
thanks a lot:)
Back to top
 
 
IP Logged
 
Pages: 1 2 
Bookmarks
Facebook Twitter del.icio.us Google reddit Digg Linked in MySpace StumbleUpon Yahoo