How does iTunes track/identify a song in its music library? - itunes

This may not sound like a programming issue, but I'm trying to implement similar rating feature like iTunes does, and I'm curious about how iTunes track a song like this:
After I rate a song in iTunes, even though I change the meta tags(artist/title/album), it can match the song and show the rating, and even I move the file to another folder or change the filename, the rating is still there, I dig a little bit and found in 'iTunes Music Library.xml', there's a 'persistent Id' for each song, I think the 'persistent Id' is the key, but I'm still confused about how iTunes matches the 'persistent Id' with a song even though user can change the filename/meta tag of the audio file.
any idea?

Related

Get subtitle info with iTunes Search API

I am trying to use iTunes API to get information about subtitle languages currently available of a movie.
I'm using this API: https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/iTuneSearchAPI/Searching.html#//apple_ref/doc/uid/TP40017632-CH5-SW1
I can get everything related to the movie, like its title, director, country but I can't get any subtitle information.
Using Bones and All as example: https://itunes.apple.com/us/movie/bones-and-all/id1651952453
I tried this: http://itunes.apple.com/search?term=bones+and+all&country=us&entity=movie&limit=1 I get info like "trackName: Bones And All"; "country":"USA", "currency":"USD", "releaseDate":"2022-11-23T08:00:00Z", etc. but
it doesn't show anything about subtitle languages available. Checking the iTunes page of the movie, there are more than 10 subtitle languages available.
Also, don't know if I have to use any "entity" or "attribute" parameters.

How to pass the MediaLibrary to the AudioService and start playing from specific song in flutter

I have all the UI and logic to read songs from the device and I made my own loagic for playlists because android 10 has a bug. Anyways, so I'm looking on the audio_service package. The example has it all, but the Media library is hardcoded. Despite the name I can imagine this as Playlist with a list of songs.
How can I pass the playlist chosen to play. Maybe Shared preferences?
And another question: Is there a way from which song to start playing the playlist?

Star a song in spotify from an external source?

I'm looking for a way to star a song in Spotify without having to go to the app itself.
For instance:
I'm playing a game on fullscreen, or I'm working on something and Spotify is on for music. I hear a great song and I want to star it.
Now instead of going to the app, I want to star the song using a shortcut or a dedicated external button.
Whether it is a shortcut, a USB button, or a button on a remote, I believe this function would be really helpful. I've searched through the Spotify core API, but I couldn't find anything that enables me to "star" a song.
Any ideas?
Since you tagged CocoaLibSpotify in this question, well, CocoaLibSpotify has this functionality built right in - the SPTrack object has the starred property. It'd be fairly simple to write a little app that, when triggered, fetches the currently playing track using the Spotify client's AppleScript bridge and use CocoaLibSpotify to star it.
Alternatively, the Apps API can star a track as well (the Track object has the starred property). You could use the player object to get the current track and star it. However, linking that to an external button will be tricky. One (hacky) way would be to have the button trigger a system URL launch of spotify:app:star-this-track:invocation:1 where the number at the end increments each time you push the button. Then, the application's ARGUMENTSCHANGED event will fire, at which point you can star the track.

Getting list/path of songs from iphone's library

Want to create an alarm application, that will play a music file at a specific time. How can i get list of songs from iphone's library. I want to show this list in tableview, user can then select a single file that will be played at sepecified time.
Any code sample?
Just use the MPMediaPickerController.
The sample code AddMusic shows how to choose (and add) music in the iPod library.

How do I add a song to itunes using Applescript and make a vote for it?

Since iTunes 8.1 has iTunes DJ I want to be able to upload songs from one of my computers to another that runs iTunes 8.1, and add these to the Library on iTunes. After that, I want to make that song the next song in iTunes, but only if no other song has been "requested" more times through the Apple Remote application.
Doug's AppleScripts for iTunes has a script called Play Album Next In Party Shuffle. It seems like a good jumping-off point. iTunes DJ and Party Shuffle are apparently the same thing as far as scripts are concerned.