• davidj1810

    Thanks for your support. I should look into this when I have time.

    Improved code for project thus far:

    import webbrowser
    from objc_util import *
    
    def main():
        try:
            NSBundle.bundleWithPath_('/System/Library/Frameworks/MediaPlayer.framework').load()
            webbrowser.open('music://')
            mp = ObjCClass('MPMusicPlayerController')
            mq = ObjCClass('MPMediaQuery')
            query = mq.songsQuery()
            player = mp.systemMusicPlayer()
            player.setQueueWithQuery_(query)
            player.shuffleMode = 2
            player.prepareToPlay()
            player.play()
        except Exception as e:
            print str(e)
        
    
    if __name__ == '__main__':
        main()```

    posted in Pythonista read more
  • davidj1810

    Thanks BTW!!! Looks like you are some sort of Admin/creator? Awesome stuff. Now I need to... possibly extend this to be able to run a script on a schedule. Idea being to play music on a timer each morning. Any ideas?

    posted in Pythonista read more
  • davidj1810

    Dangit. I usually pride myself on not making those! Yes, there was a typo. Now it works!
    In my defense, it IS an iPhone keyboard and an IDE that doesn't underline errors. :)

    posted in Pythonista read more
  • davidj1810

    Yeah, I did try that... unfortunately does not work for me. I have iPhone5c and it is up-to-date OS-wise. Just downloaded Pythonista last Sunday and don't believe it requires updating.

    I get this error with the above recommendation:

    AttributeError: 'NoneType' object has no attribute 'load'

    posted in Pythonista read more
  • davidj1810

    I'm trying to access the MPMusicPlayerController using the objc_util and I get the error in the title- ValueError, no objective-c class MPMusicPlayerController found.

    I did see a related post but the answer didn't help- dealing with loading the framework.

    import webbrowser
    from objc_util import *
    
    def main():
        webbrowser.open('music://')
        mp = ObjCClass('MPMusicPlayerController')
        player = mp.systemMusicPlayer()
        player.play()
        
    
    if __name__ == '__main__':
        main()
    

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!