Scrobble last.fm tracks from a mobile device

Published on January 15, 2008

Scrobble last.fm tracks from a mobile device

    In this post, I would like to offer my method of sending music to Last.fm from a mobile device (communicator, PDA, phone) without using the Internet on it.

    The problem
    is easy to scrobble on last.fm music from your computer. There are many programs for this (I, for example, use Rhythmbox ). But most of the music we listen to on a mobile device. I would like to send music to the site from him.
    At the same time, it is advisable not to use the Internet on a mobile device, because, firstly, the Internet is not accessible everywhere, and secondly, it is not cheap (especially if, for example, you went to rest in Turkey and took a PDA with you as a player )

    Solution idea
    We use a player on the mobile device that can write the log file of the songs you listen to (for example, I use MortPlayer ). Next, we transfer this log file to the computer and send it to Last.fm using the Python script, which is described below.

    System requirements
    1. On a mobile device, you need a player that can write a log file of the songs you listen to. The format of the log file should be “day-month-year hour: minute: second artist - composition - album”, for example:
    2008-01-14 21:17:45 Sean Paul - Like Glue - Dutty Rock
    01/14/2008 21:21:43 Sean Paul - Get Busy - Dutty Rock

    Other requirements for the computer (from which we will scribble):
    2. Linux.
    3. Rhythmbox with the Last.fm plugin (in the latest versions it comes with the program, but you need to enable it and configure the login / password to access the service).
    4. Python.

    Procedure
    1. Transfer the log file to the computer (for example, insert the memory card from the communicator).
    2. Run the scrobble script.
    That's it :)

    "Features" of the script
    1. Checking the appearance of tracks on the last.fm personal page (the counter of the listened tracks is checked).
    2. The ability to give out a table of the listened songs grouped by artist, with listening counters (convenient, for example, if you came back from far away and want to see what you most often listened to on vacation).
    3. Filtering songs that sounded less than a minute.

    Download the script (iFolder.ru)

    View the code (dumpz.org, with syntax highlighting and line numbers) (thanks for the tip thanks to Cyxapeff ) We

    configure the configuration parameters (for example, the path to the log file) at the beginning of the script text.

    UPD 07/29/2008
    In connection with the recent update of the Last.fm interface, the script needs to be changed: namely, the regular expression on line 219
    pattern = re.compile ('Tracks played: \ W * <\ / strong> \ W * (\ d +), (\ d +) <\ / span> <\ / span>')
    needs to be replaced with
    pattern = re.compile ('\ ((\ d +), (\ d +) tracks played \)')


    - This is my first P. about S. t at the hub Please do not judge strictly.