Export your Apple Music Library to the default xml and feed it to this. It looks up the MusicBrainz ID for the given track and write that to a JSON file for import into Lidarr.
The tool automatically preprocesses track and album names before searching MusicBrainz to improve matching accuracy. Specifically, it removes common suffixes that may interfere with search results:
- ' - Single' (case-insensitive) - Removed from track titles and album names
- ' - EP' (case-insensitive) - Removed from track titles and album names
For example:
- "Love Me Like You Do - Single" → "Love Me Like You Do"
- "Summer Hits 2023 - EP" → "Summer Hits 2023"
This preprocessing helps find matches in MusicBrainz where the release may be stored without these commercial suffixes.
Convert Apple Music Library XML to Lidarr JSON format:
python3 AppleMusicXmlToLidarr.py Library.xml found_tracks.json not_found_tracks.jsonThis will:
- Parse your Apple Music Library.xml file
- Look up MusicBrainz IDs for each track
- Save found MBIDs to
found_tracks.jsonfor Lidarr import - Save unmatched tracks to
not_found_tracks.jsonfor later processing
Reprocess tracks that were not found initially:
python3 AppleMusicXmlToLidarr.py --recheck found_tracks.json not_found_tracks.jsonThis will:
- Read tracks from
not_found_tracks.json - Search for MusicBrainz IDs for each track again
- Append any newly found MBIDs to the existing
found_tracks.json - Update
not_found_tracks.jsonby removing successfully matched tracks
Extract unique albums and get release-group MBIDs:
python3 AppleMusicXmlToLidarr.py albums Library.xml albums.json albums_notfound.jsonThis will:
- Parse your Apple Music Library.xml file
- Extract unique (artist, album) pairs
- Look up MusicBrainz release-group IDs for each album
- Save found release-group MBIDs to
albums.jsonfor Lidarr import - Save unmatched albums to
albums_notfound.jsonfor later processing
Reprocess albums that were not found initially:
python3 AppleMusicXmlToLidarr.py albums --recheck albums.json albums_notfound.jsonThis will:
- Read albums from
albums_notfound.json - Search for MusicBrainz release-group IDs for each album again
- Append any newly found MBIDs to the existing
albums.json - Update
albums_notfound.jsonby removing successfully matched albums
- Run initial processing to generate both found and not-found files
- Import the found tracks into Lidarr
- Periodically run recheck mode to find MBIDs for previously unmatched tracks
- Import any newly found tracks into Lidarr
- Run album processing to generate release-group MBIDs
- Import the found albums into Lidarr as release-groups
- Periodically run recheck mode to find MBIDs for previously unmatched albums
- Import any newly found albums into Lidarr
The recheck mode is useful for both tracks and albums because:
- MusicBrainz database is constantly updated with new entries
- Network issues may have caused temporary lookup failures
- You can refine your approach or wait for better data coverage
- Use albums subcommand when importing entire albums to Lidarr - this provides release-group MBIDs which are more appropriate for album-based imports
- Use default track processing when you need fine-grained control over individual songs
- Always save both found and not-found files to enable reprocessing later
- Be mindful of MusicBrainz rate limits - the tool includes 1-second delays between requests
- Consider the file naming convention: use descriptive names like
albums.json/albums_notfound.jsonfor album processing
- found_tracks.json: Contains MusicBrainz recording IDs in Lidarr-compatible format
- not_found_tracks.json: Contains track metadata for songs that couldn't be matched
- albums.json: Contains MusicBrainz release-group IDs in Lidarr-compatible format
- albums_notfound.json: Contains album metadata (artist, album) for albums that couldn't be matched
All files use UTF-8 encoding and pretty-printed JSON for readability.