Skip to content

Instantly share code, notes, and snippets.

@laiso
Created June 4, 2012 11:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laiso/2867888 to your computer and use it in GitHub Desktop.
Save laiso/2867888 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys
import os
import netrc
from gmusicapi.api import Api
def main():
path = sys.argv[1]
if not os.path.exists(path):
print "Invalid file path. %s" % path
return
api = Api()
(email, account, password) = netrc.netrc().hosts['google.com']
api.login(email, password)
if not api.is_authenticated():
print "Login Error\n"
return
print "start upload...\n"
upload_info = api.upload(path)
print upload_info
print "upload is completed.\n"
api.logout()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment