Example #1
0
def download_via_aria():
    req_data = json.loads(request.get_data() or '{}')
    car = req_data.get('car')
    magnet = req_data.get('magnet')

    if not car or not magnet:
        return jsonify({'error': 'required fields are not found in posted json'}), 400

    oof_downloader = OOFDownloader()

    jav_obj = oof_downloader.handle_jav_download(car, magnet)
    if not jav_obj.get('error'):
        return jsonify({'success': jav_obj})
    else:
        return jsonify({'error': jav_obj.get('error')}), 400
Example #2
0
def download_magnet():
    req_data = json.loads(request.get_data() or '{}')
    car = req_data.get('car')
    magnet = req_data.get('magnet')

    if not car or not magnet:
        return jsonify(
            {'error': 'required fields are not found in posted json'}), 400

    if return_default_config_string('magnet_downloader') == 'aria2':
        _downloader = OOFDownloader()
    else:
        # use deluge client
        _downloader = DelugeDownloader()

    jav_obj = _downloader.handle_jav_download(car, magnet)
    if not jav_obj.get('error'):
        return jsonify({'success': jav_obj})
    else:
        return jsonify({'error': jav_obj.get('error')}), 400