Read iTunes library file.
To read library:
library = Library("iTunes Music Library.xml")
file = open("iTunes Music Library.xml", "r")
library = Library(file)
file = open("iTunes Music Library.xml", "r")
content = file.read()
library = Library(content)
To get the list of playlist names:
print(library.getPlaylistNames()
To get the playlist from its name:
playlist = library.getPlaylist(Playlist.Bibliotheque)
playlist = library.getPlaylist(Playlist.SeriesTV)
playlist = library.getPlaylist(Playlist.Podcasts)
playlist = library.getPlaylist(Playlist.Genius)
playlist = library.getPlaylist(Playlist.Memosvocaux)
playlist = library.getPlaylist(Playlist.Musique)
playlist = library.getPlaylist(Playlist.Films)
playlist = library.getPlaylist("Electro")
playlist = library.getPlaylist("Pop")
...
To get the informations about a playlist:
print(playlist.name)
print(playlist.playlistID)
print(playlist.playlistPersistentID)
print(playlist.allItems)
print(playlist.smartInfo)
To get the tracks of a playlist:
for track in playlist.getTracks():
pass
To get the informations about a track:
print(track.trackId)
print(track.name)
print(track.artist)
print(track.albumArtist)
print(track.album)
print(track.genre)
print(track.kind)
print(track.size)
print(track.totalTime)
print(track.trackNumber)
print(track.trackCount)
print(track.year)
print(track.dateModified)
print(track.dateAdded)
print(track.bitRate)
print(track.sampleRate)
print(track.comments)
print(track.playCount)
print(track.playDate)
print(track.playDateUTC)
print(track.skipCount)
print(track.skipDate)
print(track.releaseDate)
print(track.rating)
print(track.albumRating)
print(track.albumRatingComputed)
print(track.artworkCount)
print(track.sortAlbum)
print(track.sortName)
print(track.persistentID)
print(track.trackType)
print(track.podcast)
print(track.location)
print(track.fileFolderCount)
print(track.libraryFolderCount)
print(track.rating2)
print(track.location2)
The pYtunes.py module is compatible with the version 3.3.
But the compare.py script require version 2.7.