https://github.com/sfxcode/itunes-reader
convert itunes xml data to scala classes
https://github.com/sfxcode/itunes-reader
itunes scala xml
Last synced: 8 months ago
JSON representation
convert itunes xml data to scala classes
- Host: GitHub
- URL: https://github.com/sfxcode/itunes-reader
- Owner: sfxcode
- License: apache-2.0
- Created: 2018-07-22T17:07:05.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-06-01T07:11:31.000Z (over 5 years ago)
- Last Synced: 2025-06-22T11:08:39.632Z (8 months ago)
- Topics: itunes, scala, xml
- Language: Scala
- Size: 52.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- License: LICENSE
Awesome Lists containing this project
README
# itunes-reader
## Info
Library for converting itunes xml files to scala model classes.
I made this library for using itunes Tracks and Playlists in some of my projects.
## Travis
[](https://travis-ci.org/sfxcode/itunes-reader)
## Download
[  ](https://bintray.com/sfxcode/maven/itunes-reader/_latestVersion)
## Model
### MusicLibrary
Members:
* tracks: List[Track]
* playlists: List[Playlist]
* builtTime: Long (Parsing and computing of itunes xml data in ms)
* playlistsForTrack: List[Playlist]
### PlayList
Support for:
Playlist ID, Playlist Persistent ID, Parent Persistent ID, Name,
Master", Folder, Visible, Music, Distinguished Kind
Members:
* data: PlaylistData
* customValues: Map[String, Any]
* parent: Option[Playlist]
* children: List[Playlist]
Functions:
* trackSet: Set[Track] (removes duplicate tracks if exist)
* parentName: name of parent playlist (if exist)
* containsTrackWithId
* totalTime: totalTime of of tracks for this Playlist
* totalTimeString: formatted totalTime of of tracks for this Playlist
### Track
Support for:
Track ID, Name, Artist, Album, Composer, Album Artist, Genre, Sample Rate,
Bit Rate, Artwork Count, Total Time Year, Play Count, Play Date, Track Type, Location
Members:
* data: PlaylistData
* customValues: Map[String, Any]
Functions:
* totalTimeString: **3m43s** (formatted total time)
## Demo
```scala
object MusicDatabaseApp extends App {
val path = getClass.getClassLoader.getResource("itunes.xml").getPath
val lib = MusicLibrary(path)
lib.playlists.foreach(playlist => {
println(playlist.name + " : " + playlist.totalTimeString())
})
lib.tracks.foreach(track => {
println(track.name + " : " + track.totalTimeString())
})
}
```