Forum Archive

Play music in Apple Music App

weda82

Hello

I am looking for a way to specify an existing album from my Music app and start playing it.

Is this possible with Pythonista 3 on iOS 12?

I appreciate any ideas or solutions.

Thank you

mikael

@weda82, in docs for the objc_util module there is an example for accessing currently-playing song info. Probably you could expand from that with the help of Apple documentation.

cvp

@weda82 Perhaps something like this

from objc_util import *

def main():

    MPMediaPropertyPredicate = ObjCClass('MPMediaPropertyPredicate')
    MPMediaPropertyPredicate.predicateWithValue_forProperty_('Songs of Innocence', 'albumTitle')

    MPMediaQuery = ObjCClass('MPMediaQuery').alloc().initWithFilterPredicates_((MPMediaPropertyPredicate,))

    MPMusicPlayerController = ObjCClass('MPMusicPlayerController')
    player = MPMusicPlayerController.systemMusicPlayer()
    player.setQueueWithQuery_(MPMediaQuery)
    player.play()

main()

The script starts to play but I'm not able to select songs...
Just a starting point 😢

weda82

Thank you for your ideas and I am sorry for my late reply.

I tried the previous suggestion and I think the query is not working properly. If I iterate the query result it returns all my media items. But I also do not see the problem. As far as I understood the Apple documentation, it looks correct to my.

I tried a different approach:

from objc_util import *

def main():
    NSBundle.bundleWithPath_(
        '/System/Library/Frameworks/MediaPlayer.framework').load()

    matchingItem = ["928428096"] # StoreId of "Songs of innocence"
    MPMusicPlayerController = ObjCClass('MPMusicPlayerController')
    player = MPMusicPlayerController.systemMusicPlayer()
    player.setQueueWithStoreIDs(matchingItem)
    player.play()


main()

I got the StoreId from this web site:
https://linkmaker.itunes.apple.com/de-de

This is working, but not as comfortable as I was looking for.

cvp

@weda82 👍

vincentyyl

Thanks for sharing, but that seems not working anymore. I use the Tunelf Audio Converter to get Music songs down and the quality is still quite good.

ElfledaElysia

An affordable solution for new users.
Listen to free radio stations at the site internetradiosender

Lucia Burns

If you are bored with Apple music then you can switch to spotify where there are all the songs you need to find if you want to use more free spotify premium you can refer here https://modsuper. com/tr/spotify-premium

florencekeva

@Lucia-Burns said:

If you are bored with Apple music then you can switch to spotify where there are all the songs you need to find if you want to use more free spotify premium you can refer here https://techtodown.com/merge-master-dinosaur-mod-apk

Music apps with the latest apps I've accessed and downloaded are great. Thank you for sharing.