Example #1
0
def upload():
    user = get_current_user(session['token'])

    if not authorize(user, 'upload'):
        abort(401)

    hash = rtorrent.load_raw(request.files['file'], user['name'])

    if hash is None:
        abort(422)

    tdata = rtorrent.torrent(hash,
                             'get_name',
                             'get_ratio',
                             'get_complete',
                             'get_directory',
                             'is_hash_checking',
                             'is_active',
                             'is_open',
                             'get_size_bytes',
                             'get_size_chunks',
                             'get_completed_chunks',
                             'get_message',
                             'get_custom=metadata')

    tdata['hash'] = hash
    download = rtorrent.create_download(tdata)
    return json.dumps(download, sort_keys=True)
Example #2
0
def add(args):
    path = args[0]
    file = open(path, 'rb')
    rtorrent.load_raw(file, 'system')