Hi Erinn, I looked around a bit and I found a GPLv2 project that provides python bindings for AudioScrobbler (http://code.google.com/p/pyscrobbler/). To submit a track, here's all the code that is needed:
#!/usr/bin/env python
import audioscrobbler #download from the website above, via svn
#$svn checkout
http://pyscrobbler.googlecode.com/svn/trunk/ pyscrobbler-read-only
import time
#constructs a string with the current time in the correct format
time_now=time.localtime() # (2008, 12, 17, 0, 42, 36, 2, 352,
date_played_str=str(time_now.tm_year) + "-" + str(time_now.tm_mon) + "-" \
+ str(time_now.tm_mday) + " " + str(time_now.tm_hour) + ":" + \
str(time_now.tm_min) + ":" + str(time_now.tm_sec) + " "
#creates the track object
track = dict(artist_name="Audioscrobbler test",
song_title="The Yeah Yeah Yeah Song",
length=291,
date_played= date_played_str,
album="At War With The Mystics",
mbid=""
)
#the actual post
post = audioscrobbler.AudioScrobblerPost(username='BOGUS_USERNAME',
password='BOGUS_PASSWORD')
post(**track)
The post should happen (from
http://www.audioscrobbler.net/development/protocol/):
>In order to qualify for submission all of the following criteria must be met:
>
> 1. The track must be submitted once it has finished playing. Whether it has
> finished playing naturally or has been manually stopped by the user is
> irrelevant.
> 2. The track must have been played for a duration of at least 240 seconds
> or half the track's total length, whichever comes first. Skipping or pausing
> the track is irrelevant as long as the appropriate amount has been played.
> 3. The total playback time for the track must be more than 30 seconds. Do
> not submit tracks shorter than this.
> 4. Unless the client has been specially configured, it should not attempt
> to interpret filename information to obtain metadata instead of tags (ID3,
> etc).
Before digging deeper into this, I'm asking you if you think this is a good
approach.
Luca Invernizzi
---
http://allievi.sssup.it/invernizzi
signature.asc
Description: Digital signature

