Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hendriks73/jitlibrary

Java API for the native Apple iTunes Library Framework for Music.app and iTunes (macOS)
https://github.com/hendriks73/jitlibrary

apple itunes itunes-library java macos music objective-c

Last synced: about 1 month ago
JSON representation

Java API for the native Apple iTunes Library Framework for Music.app and iTunes (macOS)

Awesome Lists containing this project

README

        

[![LGPL 2.1](https://img.shields.io/badge/License-LGPL_2.1-blue.svg)](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.tagtraum/jitlibrary/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.tagtraum/jitlibrary)
[![Build and Test](https://github.com/hendriks73/jitlibrary/workflows/Build%20and%20Test/badge.svg)](https://github.com/hendriks73/jitlibrary/actions)
[![CodeCov](https://codecov.io/gh/hendriks73/jitlibrary/branch/main/graph/badge.svg?token=H98FM0SKQL)](https://codecov.io/gh/hendriks73/jitlibrary/branch/main)

# jITLibrary

*jITLibrary* is a thin wrapper around the Apple
[iTunes Library Framework](https://developer.apple.com/documentation/ituneslibrary/itlibrary),
which - despite its name - can also be used to access *Music.app* data.
Note that the API is read-only, just like Apple's framework. For write access,
see [Obstmusic](https://github.com/japlscript/obstmusic) or
[Obstunes](https://github.com/japlscript/obstunes).

## Important

You **must**
[code sign](https://developer.apple.com/library/archive/documentation/Security/Conceptual/CodeSigningGuide/Introduction/Introduction.html)
your app to retrieve information with this framework, and
iTunes library access is read-only. This framework is available to users with
iTunes 11 or later (also Music.app).

## Installation

jITLibrary is released via [Maven](https://maven.apache.org).
You can install it via the following dependency:

```xml


com.tagtraum
jitlibrary

```

## Java Module

jITLibrary is shipped as a Java module
(see [JPMS](https://en.wikipedia.org/wiki/Java_Platform_Module_System))
with the name `tagtraum.jitlibrary`.

## Usage

Once you have obtained an [ITLibrary](https://hendriks73.github.io/jitlibrary/com/tagtraum/jitlibrary/ITLibrary.html)
instance you may access its `ITMediaItem`s and `ITPlaylist`s as you like.

Example:

```java
import com.tagtraum.jitlibrary.*;

public class ListAllMediaItems {

public static void main(final String args) throws Exception {
// get library (blocking call)
final ITLibrary itLibrary = ITLibrary.getInstance(true);
// get the natively backed collection
final ITLibMediaItems allMediaItems = itLibrary.getAllMediaItems();

// print size if library
final int length = allMediaItems.size();
System.out.println("Library size: " + length);

// iterate over the library and print names and artists
for (int i=0; i