Once in a while, I would loop a song and keep listening to it over and over again. That's what I am doing and curious what songs I had done with before. I wrote a quick Bash script to use Last.fm user.getRecentTracks API for listening timeline, here is the script:
You will need to obtain a Last.fm API key in order to use this script, the script is run with this syntax:
Each numbers means how many times the track had been played consecutively including starting play. I use URL to group the result, which serves a unique key and it's okay to be used in final results. Not really hard to read the artist's and track's names from it, although simple process can be used to perfect the output format, but it's not necessary. The first two of same URL are not a glitch of this script, there were some tracks played between them.
The script only retrieve 1,000 tracks, because for every 200 tracks, it's about 140K of XML file. Quite a waste of bandwidth for just the URLs of tracks. Of course, I can pipe through YQL to select
Here is a text version of the sample output, in case you wonder what these songs are:
You will need to obtain a Last.fm API key in order to use this script, the script is run with this syntax:
./obs.sh APIKEY USERNAMEIt will retrieve last 1,000 tracks (using 5 API calls) that you have listened to and check consecutive plays of same tracks. Only three or more consecutive plays will be printed out as final results. The following screenshot is a sample output:
Each numbers means how many times the track had been played consecutively including starting play. I use URL to group the result, which serves a unique key and it's okay to be used in final results. Not really hard to read the artist's and track's names from it, although simple process can be used to perfect the output format, but it's not necessary. The first two of same URL are not a glitch of this script, there were some tracks played between them.
The script only retrieve 1,000 tracks, because for every 200 tracks, it's about 140K of XML file. Quite a waste of bandwidth for just the URLs of tracks. Of course, I can pipe through YQL to select
<url>
elements, but that is a bit overkill for this quick script. Although the API page listed JSON as alternative format, but that only returns empty response. This is not my first time to see JSON format returns empty response, I guess their API documentation is pretty out-of-date or just inaccurate to current status.Here is a text version of the sample output, in case you wonder what these songs are:
12 http://www.last.fm/music/Laura+Story/_/Blessings 26 http://www.last.fm/music/Laura+Story/_/Blessings 4 http://www.last.fm/music/Gipsy+Kings/_/Volare 23 http://www.last.fm/music/Ellie+Goulding/_/Your+Song 17 http://www.last.fm/music/John+Denver/_/Country+Roads+(West+Virginia) 22 http://www.last.fm/music/Mikeschair/_/Someone+Worth+Dying+For 132 http://www.last.fm/music/Miracle+Of+Sound/_/Commander+Shepard