Add Stream/Download buttons to global search results
This commit is contained in:
@@ -1153,6 +1153,23 @@ def api_download_file(did):
|
||||
return send_file(p, as_attachment=True, download_name=download_name)
|
||||
|
||||
|
||||
@app.route('/api/downloads/<did>/save')
|
||||
def api_download_save(did):
|
||||
"""Speichern: Datei senden und aus Liste entfernen"""
|
||||
d = DM.get(did)
|
||||
if not d or d.get('status') != 'complete':
|
||||
return jsonify({'error': 'not ready'}), 404
|
||||
p = d.get('path')
|
||||
if not p or not os.path.exists(p):
|
||||
return jsonify({'error': 'file missing'}), 404
|
||||
# Sauberer Titel als Dateiname
|
||||
safe_title = re.sub(r'[^\w\-\. ]', '_', d.get('title', 'video'))[:80]
|
||||
download_name = f"{safe_title}.mp4"
|
||||
# Aus Liste entfernen
|
||||
DM.delete(did)
|
||||
return send_file(p, as_attachment=True, download_name=download_name)
|
||||
|
||||
|
||||
@app.route('/api/downloads/<did>', methods=['DELETE'])
|
||||
def api_download_delete(did):
|
||||
if DM.delete(did):
|
||||
|
||||
Reference in New Issue
Block a user