Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to delete a file using the API? #549

Open
lfnt3 opened this issue Dec 8, 2024 · 1 comment
Open

how to delete a file using the API? #549

lfnt3 opened this issue Dec 8, 2024 · 1 comment

Comments

@lfnt3
Copy link

lfnt3 commented Dec 8, 2024

Hi,

how can i delete a file using the API?

Something along the lines of:
curl -X POST "https://metube.local.example.com/delete?file=/downloads/audio/myaudio.ogg"?

(this didn't work)

@lfnt3
Copy link
Author

lfnt3 commented Dec 9, 2024

This doesn't work either:

curl -X POST "https://metube.local.example.com/delete"
-H "Content-Type: application/json"
-d '{
"ids": ["/downloads/audio/myaudio.ogg"],
"where": "done"
}'

At least I get a 200 response code with {"status": "ok"}, but the file is not deleted.

The idea above is based on this function in this delete function in /app/main.py:

@routes.post(config.URL_PREFIX + 'delete')
async def delete(request):
post = await request.json()
ids = post.get('ids')
where = post.get('where')
if not ids or where not in ['queue', 'done']:
raise web.HTTPBadRequest()
status = await (dqueue.cancel(ids) if where == 'queue' else dqueue.clear(ids))
return web.Response(text=serializer.encode(status))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant