📜 ⬆️ ⬇️

Scrobble tracks at Last.fm from your mobile device

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

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

Solution idea
We use a player on the mobile device that can write a log file of the listened tracks (for example, I use MortPlayer ). Further, this log file is transferred to the computer and sent to Last.fm using the Python script, which is described below.
')
System requirements
1. On the mobile device you need a player who can write a log file of the listened tracks. The log file format should be “day-month-year hour: minute: second performer - composition - album”, for example:
2008-01-14 21:17:45 Sean Paul - Like Glue - Dutty Rock
2008-01-14 21:21:43 Sean Paul - Get Busy - Dutty Rock

Other computer requirements (from which we will scrobble):
2. Linux.
3. Rhythmbox with the Last.fm plugin (in the latest versions 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.
Everything :)

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

Download script (iFolder.ru)

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

Configuration parameters (for example, the path to the log file) are set up at the beginning of the script text.

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


- This is my first P. o S. t on Habré. Please do not judge strictly.

Source: https://habr.com/ru/post/18742/


All Articles