-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
iTunes: Modularize importer and use iTunesLibrary
on macOS for compatibility with Music.app
#11353
Conversation
iTunesLibrary
on macOS by defaultiTunesLibrary
on macOS for compatibility with Music.app
b86318e
to
4284f0f
Compare
Do you have a good write-up on Obj-C(++) for C++ developers? Also, can you try to keep the Obj-C code minimal? introducing more programming languages increases the risk of pulling in code that we rely on but can't maintain. Especially when that programming language is not used outside the apple ecosystem (which we already don't have access to since none of the active core devs uses macos). |
Yeah, that's something I'm already trying to do, also because C++/Qt containers tend to be quite a bit more performant than ObjC types, the latter rely heavily on boxing.
http://www.jonhoyle.com/maccompanion/columns/200809.html might be worth looking into. Since we don't use any of the 'fancy' ObjC features here and only what's necessary to interact with the APIs, this should boil down to learning the syntactic differences (only), e.g. |
4284f0f
to
ad7f428
Compare
8e5e707
to
2c146c3
Compare
I am unsure what to do with this PR. Is the iTunes integration in 2.3 broken, after a user has received the music.app? In the unlike case that this PR does any harm, is it possible to disable it and use the XML importer? I am considering to merge it to 2.4. Do you think the 3 month beta is good enough for testing. Since I am on Linux, I am personally not able to do a sorrowly test. I think we need a real iTunes user to verify details. Any thoughts? |
Thank you, I'll familiarize and try to review ASAP. |
Kind of.
The user should (even if
Since the API surface that we use is relatively low and we reuse a large part of the existing DB infrastructure, I would say that is sufficient. Ideally some users, especially with large libraries, could test this integration. |
The iTunesLibrary framework only allows us to inspect the default library, so we might as well reflect that in our API.
c8da607
to
fb3cc2a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
last comment. lgtm otherwise. I'll have to see whether I can conduct a manual test.
src/library/itunes/itunesfeature.cpp
Outdated
#ifdef __MACOS_ITUNES_LIBRARY__ | ||
if (m_dbfile.isEmpty()) { | ||
importer = std::make_unique<ITunesMacOSImporter>(this, m_database, m_cancelImport); | ||
} else { | ||
importer = std::make_unique<ITunesXMLImporter>( | ||
this, m_dbfile, m_database, m_pathMapping, m_cancelImport); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should log which importer was chosen here. Choosing the importer simply based on whether we found the db file seems somewhat brittle (though idk what else would be more robust).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is that e.g. a user on macOS can explicit select an XML file, but also click Use Default Library
in the context menu to switch back to the native iTunes integration. Perhaps we should make this more explicit?
I agree that logging the importer is probably a good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite understand the workflow, what context menu exactly? Is "native iTunes integration" the XML-file or the iTunesLibrary Framework solution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is "native iTunes integration" the XML-file or the iTunesLibrary Framework solution?
The iTunesLibrary
framework solution.
I don't quite understand the workflow, what context menu exactly?
Selecting Use Default Library
sets the dbfile path to an empty string which we interpret as "use the iTunesLibrary
importer". If the dbfile path is set to an XML file, we use the XML importer instead. This should also handle existing users of the XML file integration on macOS gracefully (e.g. someone who has an iTunes XML on an external drive etc.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mhmm, maybe add a comment that we interpret it that way idk. You're free to improve it in a future PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a short doc comment to m_dbfile
and a short log message
42209cd
to
bb11d5e
Compare
f33c67d
to
de5188d
Compare
I have made some minor stylistic improvements here and there and tested the XML importer more extensively, fixing a small regression that surfaced in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small comment, personally, i think the changes look good, but I'd like some more testing, preferably by another 3rd party as I currently don't have access to apple hardware for testing.
@daschuer what do you think? Should we just merge for 2.4 and see what bug reports we get in the beta? |
28828bb
to
f4ab748
Compare
Any update on this? As mentioned in the original post, there are some things I have in the pipeline for this (e.g. adding the folder logic to the XML importer too), but would move into a separate PR since they change the semantics of the existing importer rather than "just" copying the logic into a separate file. |
Well, I would've liked to know @daschuer's opinion before merging since they're usually the ones taking care of coordinating the releases. If you want to work on other things based on this PR, why don't just do it in a separate branch and occasionally rebase in case changes have been done here? Or am I misunderstanding? |
I support merging this into 2.4. I think we need the confirmation that the legacy import is still working before merging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have just fired up my win 10 virtual machine and can confirm that this does not creates obvious regression with iTunes 12.12.7.1
So lets merge this and collect bugs if there are any from beta testers.
Thank you for the work.
That's the right attitude for making progress and keeping trustworthy developers motivated ;) |
@@ -51,22 +55,31 @@ class ITunesFeature : public BaseExternalLibraryFeature { | |||
void clearTable(const QString& table_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of the method declarations above are obselete now.
I removed them in #11208 when merging 2.4
85c9209
85c9209#diff-380635a0ce3c43f060770fd4001274c29a8142ebba2d56abdef1a9cf06620133
This fixes
.musicdb
generated by Apple'sMusic.app
(which replaces iTunes in newer macOS versions) #11256Description
This branch modularizes the iTunes library integration into importers:
ITunesMacOSImporter
, using Apple'siTunesLibrary
frameworkMusic.app
ITunesXMLImporter
, the current XML parserThis modularity should also make it easy to drop in new importers in the future, e.g. a cross-platform parser for the new database format.
To do
ITunesXMLImporter
ITunesMacOSImporter
Future Directions
TreeItem
afterwards) for the XML importeriTunesLibrary
framework tooMusic.app
in many cases do not store the cover art in the track metadata, making it inaccessible to MixxxNSImage
from anITLibMediaItem
: https://developer.apple.com/documentation/ituneslibrary/itlibmediaitem/1810529-artworkiTunesLibrary
framework (e.g. querying the iTunes ID for a given track), which might be undesirable since this way the iTunes integration would become a leaky abstraction