A while back (2018) I created a utility to display playback statistics from iTunes, now Apple Music which I called iStats (https://unfinishedbitness.info/2018/05/04/itunes-missing-feature-library-statistics). Apple deprecated the automatic creation of the music library XML file not long ago, and that diminished my enthusiasm and support for my iStats utility. Recently I discovered you can generate a compatible XML file with Apple Music so I added few things to iStats and cleaned it up a bit. Though no longer automatic, you can still create it on the fly using menu item File > Library > Export Library…
During the update, the tools and resources I used:
- Microsoft VSCode. (https://code.visualstudio.com). This is a new tool for me after having used Atom for many years (https://atom.io), which is a very nice editor in its own right.
- HTML5 – HyperText Markup Language (https://www.w3schools.com/html/html5_intro.asp)
- CSS – Cascading Style Sheets (https://www.w3schools.com/Css/)
- chart.js – Charting library (http://www.chartjs.org)
- list.js – List library (http://listjs.com)
- FileSaver.js – Local file saving library (https://github.com/eligrey/FileSaver.js/)
The next updates I wanted to include were:
- Ability to set number of ranked results in charts. There was a static 10 defined before, now it will allow the selection from 1 to 10.
- Ability to export the song library to CSV file. This will allow import into big data analysis tools like Splunk (https://splunk.com) and Elasticsearch (https://elastic.co). With these tools one can perform all kinds of analysis and reporting on the library.
- Ability to metricize song duration and total listening time broken down in various terms.
The main page is pretty much the same, along with new version information:
The primary difference on the main page is the addition of two more input elements. These two elements should be set before selecting the music library XML file in the third element since that one starts the report generation process:
The elements are self explanatory.
- For the results number, choose from 1 to 10. The default is 10.
- For the export, simply check or uncheck. The default is checked. If checked, a CSV file called AppleMusicLibrary.csv will be created and saved to your browsers default save location. Some browsers may ask for permission to do this. The song durations in the CSV file are for the song itself, not the duration of listen time for the song. Everything else exported in it should be self explanatory.
Before starting, open Apple Music and export the Library file in XML format. Select File, then Library, then Export Library. Give it a name and location of your choosing.
To begin report generation after selecting the report options, use the “Choose file” button to open a native file selector. Locate and select the library XML file you previously exported:
At completion, iStats will try to save a file called “AppleMusicLibrary.csv” to your browsers default save location. You may have to give it permission.
I’ll refer you to the previous iStats post (https://unfinishedbitness.info/2018/05/04/itunes-missing-feature-library-statistics) for general overview of the statistics generated and section output.
With that said, there is a new section which will appear before the Results section. This new section is Total Time Listened. It displays the total combined duration all songs have been listened to accounting for play counts of each. It will display one line showing the total days, hours, minutes, seconds, and milliseconds. Following that will be alternative views for total seconds, minutes, and hours listened as single entities:
iStats is released under the Simplified BSD License. Feel free to use, modify and improve.
Link to the iStats zip file containing everything you need (hosted at Google Drive): iStats-Distro.zip