Script to output a csv of your weekly last.fm charts
-
Download the files using the green code download button (most will just want to choose download as zip)
-
(Optional) Feel free to change the name of the exampleSettings.txt file to just settings.txt as well as changing the contents of that file to your desired values. The first line is for your last.fm username, the second line is for your desired start date (please set in YYYY.MM.DD format, for example October 6th, 2020 would be 2020.10.06), and the third line is for your desired format (either artist, album, or track).
-
Now you can run main.exe! If you skipped step 2, you will be prompted for a username, start date, and format (either artist, album, or track). Be sure to follow the formatting (YYYY.MM.DD as numbers) and no typos on your username otherwise the file will most likely crash. You will then be prompted for whether you would like the script to collect image urls and tags for your top 30 artists/albums/tracks of each week. Respond either Y or N (for Yes or No). If you do this correctly, the window will show you your progress of downloading the weeks you requested (for several year timeframes, there will be a lot of weeks) and if you asked for the images/tags, it will let you know that it is grabbing those as well (so if you don't see that second line, you either didn't want them or did not enter Y in correctly).
-
The script will save several csvs following the format of "timeframeData.csv" in the location where main.exe is located. There are currently Weekly, Monthly (4 weeks, there are 13 per year in this format), Quarterly (4 even sections of a year aka 13 weeks), Semester (2 even sections of a year aka 26 weeks), and Yearly (every 52 weeks). The non-week options simply count from your start date by week so they will not necessarily match calendar dates. The weekly charts now include human readable timeframes in the header. If you requested images and tags, there will be three new columns: Image URL, Top Tag, All Tags. Use the image url column for images on flourish and the top tag column for categories if so desired. If the top tag is not something you want to use, feel free to overwrite it manually, the other tags are provided to you as a reference.
-
There you go, you now have a few csv options of your weekly charts! Feel free to see this flourish page for an exmaple of what you can do with this data (https://public.flourish.studio/visualisation/3921969/). To try making your own, click "Duplicate and Edit" in the top right. Once it opens, click "Data" in the middle above the racing bar chart. Choose to upload data using the dark grey button to the top right of the spreadsheet. Choose your desired time frame to upload. On the right, make sure the appropriate data is pointing to the righ columns (if you opted to gather images and tags, chances are the only thing you will need to adjust is how far the "Values" columns range to). From here you should explore the options Flourish provides you! The only major change most people will want to make across all options would be "Timeline & animation" towards the bottom, there is an option called "Timeline duration(s)" this is where you can control how fast or slow the whole chart will run. If your dataset is a lot larger or smaller than my example, your racing bar charts may be runnning comically fast/slow when you first load your data, this setting is why.
NOTE ABOUT IMAGES AND TAGS: requesting images and tags as a part of your data will add up to 30 extra calls of the last.fm api per week. I would not recommend using this on timeframes beyond a year otherwise the script will take a very long time. That being said, if you listened to a lot of the same stuff across a several year period and want to give it a shot, it may not take too long as the script will only look up each unique artist/album/track once. The speed of the script also depends on the format, artist being the fastest, track being the slowest. Another note: artist images do not appear currently so they will all show up as the generic last.fm picture for no picture. This is something last.fm sets and I have no control over. Tracks may also not be assigned to an album (which is the picture the script grabs), in those cases, no url will be provided.
The script will also generate a log file "main_logfile.out" in the folder in which you store it. You don't have to worry about this file and you can delete it if you want, this is just a new addition to help me debug any issues that you may encounter when running the script.