Esempio n. 1
0
def main():
    if len(sys.argv) < 2:
        usage()
        return

    outdir = sys.argv[1]
    if not os.path.exists(outdir):
        os.makedirs(outdir)

    if len(sys.argv) > 2:
        username = sys.argv[2]
    else:
        f = open("./.username")
        username = f.read()

    if len(sys.argv) > 3:
        password = sys.argv[3]
    else:
        f = open("./.password")
        password = f.read()

    print "Loading manifest...",
    load_manifest(outdir)
    print "%d track(s)" % len(manifest)

    print "Authenticating as %s..." % username,
    flush()
    sess = rapi.auth(username, password)
    print "ok"

    print "Listing library contents...",
    flush()
    lib = rapi.library(sess)
    print "%d tracks" % len(lib)
    flush()

    for i in range(len(lib)):
        print "[%d of %d]" % (i + 1, len(lib)),
        if lib[i] in manifest:
            print "skipped (in manifest)"
        else:
            try:
                handle(lib[i], outdir, sess)
                append_manifest(outdir, lib[i])
            except:
                print "error"
Esempio n. 2
0
def main():
    if len(sys.argv) < 2:
        usage()
        return

    outdir = sys.argv[1]
    if not os.path.exists(outdir):
        os.makedirs(outdir)

    if len(sys.argv) > 2:
        username = sys.argv[2]
    else:
        f = open("./.username")
        username = f.read()

    if len(sys.argv) > 3:
        password = sys.argv[3]
    else:
        f = open("./.password")
        password = f.read()

    print "Loading manifest...",
    load_manifest(outdir)
    print "%d track(s)" % len(manifest)

    print "Authenticating as %s..." % username,
    flush()
    sess = rapi.auth(username, password)
    print "ok"

    print "Listing library contents...",
    flush()
    lib = rapi.library(sess)
    print "%d tracks" % len(lib)
    flush()

    for i in range(len(lib)):
        print "[%d of %d]" % (i + 1, len(lib)),
        if lib[i] in manifest:
            print "skipped (in manifest)"
        else:
            try:
                handle(lib[i], outdir, sess)
                append_manifest(outdir, lib[i])
            except:
                print "error"
Esempio n. 3
0
#!/usr/bin/env python

import rapi
from rapi import Artist, Album, Track

sample_artist = "Art.6774631"
sample_album = "Alb.9999950"
sample_track = "Tra.10013054"

username = "******"
password = "******"

if __name__ == '__main__':
    sess = rapi.auth(username, password)

    print sess.cobrandId
    print sess.token
    print sess.userGuid
    print

    art = Artist.read(sess, sample_artist)
    print art.id
    print art.name
    print art.image
    for alb in art.albumids:
        print alb, " ",
    print 
    print

    alb = Album.read(sess, sample_album)
    print alb.id
Esempio n. 4
0
#!/usr/bin/env python

import rapi
from rapi import Artist, Album, Track

sample_artist = "Art.6774631"
sample_album = "Alb.9999950"
sample_track = "Tra.10013054"

username = "******"
password = "******"

if __name__ == '__main__':
    sess = rapi.auth(username, password)

    print sess.cobrandId
    print sess.token
    print sess.userGuid
    print

    art = Artist.read(sess, sample_artist)
    print art.id
    print art.name
    print art.image
    for alb in art.albumids:
        print alb, " ",
    print
    print

    alb = Album.read(sess, sample_album)
    print alb.id