How to get *all* the playlists that contain a given track?
I'm trying to write a plugin to show in the SongContextView all the playlists that contain the selected track. For that, I need to retrieve those playlists for the selected track; how can I do that? The interface com.tamtraug.tunes.Track provides getPlaylist(), but only returns a single playlist.
I see that the contextual menu for tracks has an option for "Show in Playlist...", which opens a submenu with all the playlists. This is exactly the information I need. Is this available from the API?
Or, should I somehow loop through all the existing playlists and check whether each of them contains the song? If so, how can I get the list of existing playlists to start the process?
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by hmijail on 24 Oct, 2021 03:51 AM
In case it matters, my version numbers are:
macOS 11.6
Music.app 1.1.6.37
beaTunes 5.2.24
Support Staff 2 Posted by hendrik on 25 Oct, 2021 08:04 AM
Hey there,
please check out the attached screenshot. You can find out which playlists a track belongs to by using the track's context menu.
If that does not fit your use case, here's how you get the playlists (in Java):
The issue here is that
getPlayLists()
is not exposed inAudioSong
. Perhaps it should.Anyhow, hope this helps you,
-hendrik