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
def update_oof_cookies(): req_data = json.loads(request.get_data() or '{}') update_dict = json.loads(req_data['update_dict']) status = OOFDownloader.update_local_cookies(update_dict) return jsonify({'status': status})
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
def diagnose_downloader_setup(): error_list = {} try: OOFDownloader() except FileNotFoundError: error_list['oof_cookies'] = BackendTranslation()['oof_cookies_not_found'] if not verify_aria2_configs_exist(): error_list['aria2_setup'] = BackendTranslation()['aria2_setup_error'] if error_list: return jsonify({'error': error_list}), 500 return jsonify({'success': 1})
def oof_quota(): try: return jsonify({'success': OOFDownloader().check_quota()}) except FileNotFoundError: return jsonify({'error': BackendTranslation()['oof_cookies_not_found']}), 500
def read_oof_cookies(): return jsonify({ 'oof_cookies': OOFDownloader.load_local_cookies( return_all=request.args.get('return_all', False)) }) # convert returned obj to dict format