How to get status and song info from iTunes on Mac - macos

The iPhone has an app that can control iTunes on a Mac, for example play a song. Is it possible to get iTunes status in my program (Objective-c or other language like node.js)? When I play a song I want to receive an event, and when I add a song I want to know what file I added in my program. I tried to find documentation about this but found no result - is there documentation about how to do this?

Absolutely, this can be done with Applescript. iTunes is fully scriptable. You can control it, get information about the currently playing media, etc.
http://dougscripts.com/itunes/itinfo/info01.php

Related

Launching Apple Music with a specific library using Applescript

I'd like to have an Applescript change the current Apple Music library automatically, instead of requiring me to hold down the option key when opening the app and manually select a new one. I found this answer which apparently works for iTunes, but the the name of the library location default seems to be different in Apple Music, and I can't figure out what it is. Any help is appreciated. Thanks!

Why would SKStoreProductViewController loadProductWithParameters not call its completionBlock on iOS 8.0.2 for Apple App Testers?

My latest app update got rejected by Apple because their testers indicated that they can't buy songs with my app. In particular, it looks like the SKStoreProductViewController loadProductWithParameters never calls its completionBlock in my code. Everything works fine for me in development.
What am I missing:
the song id should be correct: I asked the testers to check that the country of their device's iTunes Store is the same country as the one I used to get the iTunes song ID from the iTunes API (both "US"), so the ID should work perfectly
I also checked that they were connected to the web before calling the loadProductWithParameters
What else could it be?
It looks like the completion block of [SKStoreProductViewController loadProductWithParameters:completionBlock:] is never called on iOS8 if the music item you're looking for is not available on your country's iTunes Store.
Personally, I would have used the error of the completion handler to communicate that, but I guess never calling you back is another way of saying the same thing.
At least you can work around this by using the iTunes Search API to look for an item that is available in your region or to take different steps when it isn't.

Script/Program to connect iTunes and Spotify

So I am trying to either play a song in spotify and have it update the playcount of the song in iTunes. Or when I play a song in iTunes to have it play in Spotify. either is fine.
I have a vbs script that can increment the playcount of a song if it matches a folder path on iTunes. However I don't know how to get that path of Spotify. As far as the second option I have no clue how to do it.
Any ideas? Thanks
Spotify doesn't really provide access to the currently playing song, so what you're attempting to do is probably not really feasible. I would suggest maybe using something like Last.FM to save overall playcounts.
I wrote a script in Python which can update iTunes with playcounts from Last.FM http://deceptacle.com/2010/10/21/itunes-playcount-updater-using-last-fm/ which may be of some use

How to get iTunes playlist or entire library into program in Cocoa?

I'm wondering how to get the iTunes library into a mac application using Cocoa? I want the user to be able to choose a song from the iTunes library and then play that song. How would I do this?
You can use Karelia Software's iMedia Browser framework, which lets the user choose all sorts of things from the user's iLife libraries.
To play the song, you'll probably use NSSound.

simple record and play application!

I am trying to make a simple application which will store the sound said by user , say on click of record button and will play it back to him/her , say on click of play button.
Can anyone suggest me some appropriate way to do this ??
Thanks,
Miraaj
You can use QuickTime Kit's capture APIs to record a movie of the audio, and QTMovie (from the same framework) to convert it to a more conventional format for audio files and to play back both the intermediate file and the converted file.
There used to be a QuickTime Kit Programming Guide, but it didn't cover capturing and is now gone from developer.apple.com. You should file a bug against the docs.
This answer will work in a Cocoa (Mac) app. If you meant to ask about the iPhone, you should re-tag your question, as the solution will be completely different for a Cocoa app vs. a Cocoa Touch (iPhone) app.
I used direct sound to create an entire internet phone application a few years ago. Your question is far simpler, you won't have to deal with the circular buffer as critically. Direct sound is pretty main stream and you can find a lot of help with it in forums, and it's free!

Resources