Accessing iTunes XML metadata with Python

The Extensible Markup Language (XML)[1] is a widely used markup language and text file format for storing and exchanging arbitrary data. A wide variety of applications, including the Apple iTunes application, use the XML format for exchanging or storing library data. In this article, I will show you how to use Python to read and manipulate data from an iTunes [2] XML library file.

iTunes Library File

iTunes divides its content into two separate categories: media and metadata. Media (music and video) are saved in separate files from metadata. Throughout the rest of this article, I will focus on music information – artist, song title, album title, track number, genre, release year – and refer to it as metadata. The iTunes metadata files have either a .itl or .xml extension (Figure 1).

Figure 1: The iTunes XML metadata file hierarchy.

[...]

Use Express-Checkout link below to read the full article (PDF).

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Musical Talent: Songbird 1.2 has Landed

    The new version automatically organizes music libraries and is fully integrative with iTunes.

  • Firefly Audio Streaming

    The Firefly Media Server makes streaming music and Internet radio onto your home network for iTunes or Banshee clients as easy as pie.

  • LibreOffice Music Database

    LibreOffice Calc and Base are all you need to create a simple database for organizing the songs in your music collection.

  • Banshee

    In Irish mythology, the banshee’s mourning call is heard when a member of the family is about to die. The Banshee tool on Linux makes noise too, but for a far happier purpose. This banshee helps you organize your musical collection.

  • Rhythmbox

    Originally inspired by Apple’s iTunes, Rhythmbox organizes your music collection, and more.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News