'Convert Playerpro music playlist from xml to csv
I use PlayerPro to listen to music on my phone, and I would like to access the song information on my Linux Mint desktop. PlayerPro allows you to export a backup of your music information into an xml file that looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Major Version</key><integer>1</integer>
<key>Minor Version</key><integer>1</integer>
<key>Application Version</key><string>12.9.5.7</string>
<key>Total Tracks</key><integer>3</integer>
<key>Tracks</key>
<dict>
<key>63</key>
<dict>
<key>Track ID</key><integer>63</integer>
<key>Name</key><string>Autumn Sweater</string>
<key>Artist</key><string>Yo La Tengo</string>
<key>Album</key><string>I Can Hear The Heart Beating As One</string>
<key>Size</key><integer>13220116</integer>
<key>Play Date</key><integer>1649366769</integer>
<key>Play Date UTC</key><date>2022-04-07T21:26:09Z</date>
<key>Play Count</key><integer>1</integer>
<key>Skip Count</key><integer>0</integer>
<key>Rating</key><integer>60</integer>
<key>Location</key><string>/storage/emulated/0/Music/08 Autumn Sweater.m4a</string>
</dict>
<key>167</key>
<dict>
<key>Track ID</key><integer>167</integer>
<key>Name</key><string>No Easy Action</string>
<key>Artist</key><string>Mark Lanegan</string>
<key>Album</key><string>Field Songs</string>
<key>Size</key><integer>3975419</integer>
<key>Play Date</key><integer>1649366450</integer>
<key>Play Date UTC</key><date>2022-04-07T21:20:50Z</date>
<key>Play Count</key><integer>1</integer>
<key>Skip Count</key><integer>1</integer>
<key>Rating</key><integer>100</integer>
<key>Location</key><string>/storage/emulated/0/Music/02 No Easy Action.m4a</string>
</dict>
</dict>
</plist>
(The real file has thousands of songs, omitted for brevity)
I would like to automate converting this data into a csv file thru bash, Python, or any other tool available on Linux Mint, but none of the xml to csv conversion examples I've found have the same syntax as this. Any suggestions? Thank you for your help!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
