omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Play music in Apple Music App

    Pythonista
    music ios12 pythonista 3
    7
    9
    5792
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • weda82
      weda82 last edited by

      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 cvp 2 Replies Last reply Reply Quote 0
      • mikael
        mikael @weda82 last edited by

        @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.

        1 Reply Last reply Reply Quote 0
        • cvp
          cvp @weda82 last edited by

          @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 😢

          1 Reply Last reply Reply Quote 0
          • weda82
            weda82 last edited by

            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 1 Reply Last reply Reply Quote 1
            • cvp
              cvp @weda82 last edited by

              @weda82 👍

              1 Reply Last reply Reply Quote 1
              • vincentyyl
                vincentyyl last edited by

                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.

                1 Reply Last reply Reply Quote 0
                • ElfledaElysia
                  ElfledaElysia last edited by ElfledaElysia

                  This post is deleted!
                  1 Reply Last reply Reply Quote 0
                  • Lucia Burns
                    Lucia Burns last edited by Lucia Burns

                    This post is deleted!
                    1 Reply Last reply Reply Quote 0
                    • florencekeva
                      florencekeva last edited by

                      This post is deleted!
                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post
                      Powered by NodeBB Forums | Contributors