Beispiel #1
0
def inventory(args):
    c = TolinoCloud(args.partner)
    c.login(args.user, args.password)
    c.register()
    inv = c.inventory()
    c.unregister()
    c.logout()
    print('{} document{} stored in tolino cloud account {}'.format(
        len(inv), 's' if len(inv) > 1 else '', args.user))
    for i in inv:
        print('')
        print('id        : {}'.format(i['id']))
        print('title     : {}'.format(i['title']))
        print('subtitle  : {}'.format(i['subtitle']))
        for a in i['author']:
            if a:
                print('author    : {}'.format(a))
        print('mimetype  : {}'.format(i['mime']))
        print('type      : {} / {}'.format(i['type'], {
            'edata': 'user storage area',
            'ebook': 'tolino storage area'
        }.get(i['type'], i['type'])))
        if 'issued' in i:
            print('issued    : {}'.format(
                datetime.datetime.fromtimestamp(i['issued'] /
                                                1000.0).strftime('%c')))
        print('purchased : {}'.format(
            datetime.datetime.fromtimestamp(i['purchased'] /
                                            1000.0).strftime('%c')))
        print('partner   : {} / {}'.format(
            i['partner'], TolinoCloud.partner_name[i['partner']]))
Beispiel #2
0
def inventory(args):
    c = TolinoCloud(args.partner)
    c.login(args.user, args.password)
    c.register()
    inv = c.inventory()
    c.unregister()
    c.logout()
    print('{} document{} stored in tolino cloud account {}'.format(len(inv), 's' if len(inv) > 1 else '', args.user))
    for i in inv:
        print('')
        print('id        : {}'.format(i['id']))
        print('title     : {}'.format(i['title']))
        print('subtitle  : {}'.format(i['subtitle']))
        for a in i['author']:
            if a:
                print('author    : {}'.format(a))
        print('mimetype  : {}'.format(i['mime']))
        print('type      : {} / {}'.format(i['type'], {
                'edata' : 'user storage area',
                'ebook' : 'tolino storage area'
            }.get(i['type'], i['type'])
        ))
        if 'issued' in i:
            print('issued    : {}'.format(datetime.datetime.fromtimestamp(i['issued']/1000.0).strftime('%c')))
        print('purchased : {}'.format(datetime.datetime.fromtimestamp(i['purchased']/1000.0).strftime('%c')))
        print('partner   : {} / {}'.format(i['partner'], TolinoCloud.partner_name[i['partner']]))
Beispiel #3
0
def delete(args):
    c = TolinoCloud(args.partner)
    c.login(args.user, args.password)
    c.register()
    c.delete(args.document_id)
    c.unregister()
    c.logout()
    print('deleted {} from tolino cloud.'.format(args.document_id))
Beispiel #4
0
def delete(args):
    c = TolinoCloud(args.partner)
    c.login(args.user, args.password)
    c.register()
    c.delete(args.document_id)
    c.unregister()
    c.logout()
    print('deleted {} from tolino cloud.'.format(args.document_id))
Beispiel #5
0
def download(args):
    c = TolinoCloud(args.partner)
    c.login(args.user, args.password)
    c.register()
    fn = c.download(None, args.document_id)
    c.unregister()
    c.logout()
    print('downloaded {} from tolino cloud to {}.'.format(args.document_id, fn))
Beispiel #6
0
def upload(args):
    c = TolinoCloud(args.partner)
    c.login(args.user, args.password)
    c.register()
    document_id = c.upload(args.filename)
    c.unregister()
    c.logout()
    print('uploaded {} to tolino cloud as {}.'.format(args.filename, document_id))
Beispiel #7
0
def cover(args):
    c = TolinoCloud(args.partner)
    c.login(args.user, args.password)
    c.register()
    c.cover(args.document_id, args.image)
    c.unregister()
    c.logout()
    print('successfully modified cover for book {}'.format(args.document_id))
Beispiel #8
0
def download(args):
    c = TolinoCloud(args.partner)
    c.login(args.user, args.password)
    c.register()
    fn = c.download(None, args.document_id)
    c.unregister()
    c.logout()
    print('downloaded {} from tolino cloud to {}.'.format(
        args.document_id, fn))
Beispiel #9
0
def upload(args):
    c = TolinoCloud(args.partner)
    c.login(args.user, args.password)
    c.register()
    document_id = c.upload(args.filename, args.name)
    c.unregister()
    c.logout()
    print('uploaded {} to tolino cloud as {}.'.format(args.filename,
                                                      document_id))
Beispiel #10
0
def meta(args):
    c = TolinoCloud(args.partner)
    c.login(args.user, args.password)
    c.register()
    c.metadata(args.document_id, args.title, args.subtitle, args.author,
               args.publisher, args.isbn, args.edition, args.issued,
               args.language)
    c.unregister()
    c.logout()
    print('successfully modified book {}'.format(args.document_id))