Example #1
0
File: app.py Project: kyeah/gspot
def login_google():
    """ Log into Google and retrieve user library and playlists """

    g = Mobileclient()
    logged_in = g.login(config.auth['GOOGLE_EMAIL'], 
                        config.auth['GOOGLE_PASSWORD'],
                        Mobileclient.FROM_MAC_ADDRESS)

    if not g.is_authenticated():
        log.error("Invalid Google email/password; exiting.")
        sys.exit(1)

    log.info("Retrieving Google Music playlists")
    g.playlists = g.get_all_user_playlist_contents()

    log.info("Retrieving Google Music library")
    g.library = get_google_library(g)

    return g