commit
438e96b37d
6 changed files with 53 additions and 8 deletions
|
|
@ -1,4 +1,3 @@
|
|||
.git
|
||||
.venv
|
||||
ui/.angular
|
||||
ui/node_modules
|
||||
ui/
|
||||
|
|
|
|||
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -2,7 +2,8 @@
|
|||
/frontend/dist
|
||||
|
||||
# dependencies
|
||||
/frontend/node_modules
|
||||
**/node_modules/*
|
||||
**/.nuxt/*
|
||||
|
||||
# IDEs and editors
|
||||
/ui/.idea
|
||||
|
|
|
|||
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
|
|
@ -73,6 +73,6 @@
|
|||
}
|
||||
],
|
||||
"justMyCode": true
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
|
|
|
|||
6
Pipfile.lock
generated
6
Pipfile.lock
generated
|
|
@ -1080,12 +1080,12 @@
|
|||
},
|
||||
"yt-dlp": {
|
||||
"hashes": [
|
||||
"sha256:743dbe081ea871be3f5ff083e2cd95da866dea773fc70ae6b109838cfbf72ac4",
|
||||
"sha256:a7b8724e58fff4f3204cae4feb936dbd249ca6d22c5f25dec1b3c6f1cb7745a2"
|
||||
"sha256:5a16b7511e8500cbb13ff0babc9c6deb1e049dc1c854a51738aad2529167fcdf",
|
||||
"sha256:77e15afb9d460ecb7294a39bb5e39dc9f4e8a65f3a37ef4db58800b94d095511"
|
||||
],
|
||||
"index": "pypi",
|
||||
"markers": "python_version >= '3.9'",
|
||||
"version": "==2024.12.6"
|
||||
"version": "==2024.12.13"
|
||||
}
|
||||
},
|
||||
"develop": {}
|
||||
|
|
|
|||
|
|
@ -342,6 +342,9 @@ class Notifier:
|
|||
async def error(self, dl: dict, message: str):
|
||||
await self.emit('error', (dl, message))
|
||||
|
||||
async def warning(self, message: str):
|
||||
await self.emit('error', message)
|
||||
|
||||
async def emit(self, event: str, data):
|
||||
tasks = []
|
||||
tasks.append(self.sio.emit(event, self.serializer.encode(data)))
|
||||
|
|
|
|||
44
app/main.py
44
app/main.py
|
|
@ -1,6 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import asyncio
|
||||
import base64
|
||||
from datetime import datetime
|
||||
|
|
@ -688,6 +687,49 @@ class Main:
|
|||
})
|
||||
await self.sio.emit('cli_close', {'exitcode': -1})
|
||||
|
||||
@self.sio.event()
|
||||
async def add_url(sid, post: dict):
|
||||
url: str = post.get('url')
|
||||
quality: str = post.get('quality')
|
||||
|
||||
if not url:
|
||||
self.notifier.warning('No URL provided.')
|
||||
return
|
||||
|
||||
format: str = post.get('format')
|
||||
folder: str = post.get('folder')
|
||||
ytdlp_cookies: str = post.get('ytdlp_cookies')
|
||||
ytdlp_config: dict = post.get('ytdlp_config')
|
||||
output_template: str = post.get('output_template')
|
||||
if ytdlp_config is None:
|
||||
ytdlp_config = {}
|
||||
|
||||
status = await self.add(
|
||||
url=url,
|
||||
quality=quality,
|
||||
format=format,
|
||||
folder=folder,
|
||||
ytdlp_cookies=ytdlp_cookies,
|
||||
ytdlp_config=ytdlp_config,
|
||||
output_template=output_template
|
||||
)
|
||||
await self.sio.emit('status', self.serializer.encode(status))
|
||||
|
||||
@self.sio.event
|
||||
async def cancel_items(sid, post: dict):
|
||||
ids = post.get('ids')
|
||||
identifier: str = post.get('identifier')
|
||||
|
||||
if not ids:
|
||||
await self.notifier.warning('Invalid request.')
|
||||
return
|
||||
|
||||
status: dict[str, str] = {}
|
||||
status = await self.queue.cancel(ids)
|
||||
status.update({'identifier': identifier})
|
||||
|
||||
await self.sio.emit('cancel_items', self.serializer.encode(status))
|
||||
|
||||
@self.sio.event()
|
||||
async def archive_item(sid, data):
|
||||
if not isinstance(data, dict) or 'url' not in data or not self.config.keep_archive:
|
||||
|
|
|
|||
Loading…
Reference in a new issue