Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support the .musicdb generated by Apple's Music.app (which replaces iTunes in newer macOS versions) #11256

Closed
fwcd opened this issue Feb 8, 2023 · 7 comments

Comments

@fwcd
Copy link
Member

fwcd commented Feb 8, 2023

Feature Description

This seems to be a binary format, we might, however, be able to use Objective-C++ (similar to #4809) and could interface with the iTunesLibrary Framework to implement this (since this should only be relevant on macOS anyway).

See also:

@fwcd fwcd added the feature label Feb 8, 2023
@fwcd
Copy link
Member Author

fwcd commented Feb 8, 2023

Ah, I've just found an issue which this is likely a duplicate of, proposing a similar solution:

I think the XML iTunes Library support is definitely worth keeping around, since even the Music.app still supports manually exporting an XML through the menu.

What might be worth investigating is whether the upcoming Apple Music Preview app for Windows 11 will replace iTunes and whether it also uses Music.app's new binary format. (Edit: This seems to be the case!)

Reverse-engineering the binary format might also be an interesting task for cross-platform compatibility, especially if users moving between Macs and e.g. Linux PCs want to read their playlists on the go, but seems to be non-trivial [1].

In any case, making use of the first-class iTunesLibrary framework on macOS would make sense to me, especially since it seems to be more 'future-proof' against potential future versions and, as long as we make sure not to break anything on other OSes, be purely additive.

[1] Some notes on reverse-engineering the .musicdb format, in case anyone wants to dig deeper into this:

  • The payload seems to be encrypted and/or compressed
  • The format seems to be similar to the previous .itl format, which is documented here:
    • https://gist.github.com/mrexodia/b21b429cdab57fa64e81
    • While .itl uses hdfm as header, .musicdb starts its header with hfma
    • The header structure seems similar (e.g. both formats include the Music.app/iTunes version as ASCII string), but is not identical, in particular the header length doesn't seem to be encoded at the same offset as in the .itl (see the gist above)

Edit: Here's a full writeup of the reverse engineered schema:

https://home.vollink.com/gary/playlister/musicdb.html (archive link)

@fwcd
Copy link
Member Author

fwcd commented Feb 9, 2023

So after toying around a bit with the Apple Music Preview for Windows, it seems to be essentially a reskinned app using the same codebase as Music.app and presumably iTunes. It uses the new .musicdb format, can be used without an Apple Music Subscription or login as a plain old offline music player and even supports the iTunes Store. Thus if Apple intends to deprecate iTunes on Windows eventually, this might become interesting for DJs that use it to manage their local music collection and want to access it through Mixxx.

@fwcd fwcd changed the title Support the .musicdb generated by Music.app (which replaces iTunes in newer macOS versions) Support the .musicdb generated by Apple's Music.app (which replaces iTunes in newer macOS versions) Feb 9, 2023
@fwcd
Copy link
Member Author

fwcd commented Apr 4, 2023

macOS support is implemented in #11353

If/when Apple Music for Windows fully replaces iTunes there, we might investigate writing our own parser for .musicdb libraries, more details on this in #11256 (comment). The primary issue I see is that redistributing the encryption key for .musicdb files may not be permitted.

Aside from that, it will also be interesting to see how other DJ programs will handle this scenario, given that iTunes is still a popular choice for library management among DJs and the fact that there is no direct equivalent to the iTunesLibrary framework outside of macOS.

@belatar
Copy link

belatar commented Jul 13, 2024

macOS support is implemented in #11353

If/when Apple Music for Windows fully replaces iTunes there, we might investigate writing our own parser for .musicdb libraries, more details on this in #11256 (comment). The primary issue I see is that redistributing the encryption key for .musicdb files may not be permitted.

Aside from that, it will also be interesting to see how other DJ programs will handle this scenario, given that iTunes is still a popular choice for library management among DJs and the fact that there is no direct equivalent to the iTunesLibrary framework outside of macOS.

hi! i wonder what the status of this on windows is? im looking for a way to read a Library.musicdb file on windows and tried installing the v2.4.1 of mixxx but it didnt offer a way to import / read it.

@fwcd
Copy link
Member Author

fwcd commented Jul 13, 2024

Currently not implemented, sadly. Parsing the musicdb manually is possible and I have toyed around with implementing the reverse engineered schema myself. I don't see Mixxx adopting this, however, since it requires redistributing a proprietary encryption key, which might be legally risky even though it can be found in similar projects online (though I am not a lawyer).

Our best bet would probably be hoping for Apple to expose some kind of API to read the library, like on macOS. As mentioned in #11256 (comment), there seem to be some requests for this and if iTunes for Windows is eventually sunset, my hope is that they offer some migration path given that other popular DJ programs rely on parsing the legacy XML.

If you are interested in this too, I would encourage you to file a suggestion for a local Apple Music API on Windows at https://feedbackassistant.apple.com/. Assuming that DJs are a key demographic among iTunes users that are primarily interested in buying music as opposed to streaming, having enough people file feedback might make them more likely to consider this.

@belatar
Copy link

belatar commented Jul 13, 2024

thanks for the response, i might actually do that although i dont even have any financial motivation. its only that my mac broke, i only have a file copy of my music library but the windows version of apple music doesnt open the backup file. and now all my playlists compiled over the decades are gone (music files themselves i have). im quite frustrated at the incompatibility and even apple support couldnt help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants