Add more events
This commit is contained in:
parent
5172742e96
commit
9ba7b34803
4 changed files with 33 additions and 0 deletions
|
|
@ -19,6 +19,7 @@ from .config import Config
|
|||
from .DataStore import DataStore
|
||||
from .Download import Download
|
||||
from .Events import EventBus, Events
|
||||
from .Events import warning as event_warning
|
||||
from .ItemDTO import Item, ItemDTO
|
||||
from .Presets import Presets
|
||||
from .Scheduler import Scheduler
|
||||
|
|
@ -327,6 +328,7 @@ class DownloadQueue(metaclass=Singleton):
|
|||
dlInfo.info.error = msg
|
||||
itemDownload = self.done.put(dlInfo)
|
||||
NotifyEvent = Events.COMPLETED
|
||||
await self._notify.emit(Events.LOG_WARNING, data=event_warning(msg))
|
||||
elif self.config.allow_manifestless is False and is_manifestless is True:
|
||||
dlInfo.info.status = "error"
|
||||
dlInfo.info.error = "Video is in post-live manifestless mode."
|
||||
|
|
|
|||
|
|
@ -25,6 +25,21 @@ def error(msg: str, data: dict | None = None) -> dict:
|
|||
return message("error", msg, data)
|
||||
|
||||
|
||||
def warning(msg: str, data: dict | None = None) -> dict:
|
||||
"""
|
||||
Create an error message.
|
||||
|
||||
Args:
|
||||
msg (str): The message.
|
||||
data (dict|None): The data to include in the message.
|
||||
|
||||
Returns:
|
||||
dict : The message wrapped in a dictionary.
|
||||
|
||||
"""
|
||||
return message("warning", msg, data)
|
||||
|
||||
|
||||
def info(msg: str, data: dict | None = None) -> dict:
|
||||
"""
|
||||
Create an info message.
|
||||
|
|
@ -87,6 +102,8 @@ class Events:
|
|||
CLEARED = "cleared"
|
||||
ERROR = "error"
|
||||
LOG_INFO = "log_info"
|
||||
LOG_WARNING = "log_warning"
|
||||
LOG_ERROR = "log_error"
|
||||
LOG_SUCCESS = "log_success"
|
||||
|
||||
INITIAL_DATA = "initial_data"
|
||||
|
|
@ -139,6 +156,8 @@ class Events:
|
|||
Events.ADDED,
|
||||
Events.ERROR,
|
||||
Events.LOG_INFO,
|
||||
Events.LOG_WARNING,
|
||||
Events.LOG_ERROR,
|
||||
Events.LOG_SUCCESS,
|
||||
Events.COMPLETED,
|
||||
Events.CANCELLED,
|
||||
|
|
|
|||
|
|
@ -96,6 +96,8 @@ class NotificationEvents:
|
|||
CLEARED = Events.CLEARED
|
||||
LOG_INFO = Events.LOG_INFO
|
||||
LOG_SUCCESS = Events.LOG_SUCCESS
|
||||
LOG_WARNING = Events.LOG_WARNING
|
||||
LOG_ERROR = Events.LOG_ERROR
|
||||
TEST = Events.TEST
|
||||
|
||||
@staticmethod
|
||||
|
|
|
|||
|
|
@ -52,6 +52,16 @@ export const useSocketStore = defineStore('socket', () => {
|
|||
toast.success(json?.message);
|
||||
});
|
||||
|
||||
socket.value.on('log_warning', stream => {
|
||||
const json = JSON.parse(stream);
|
||||
toast.warning(json?.message);
|
||||
});
|
||||
|
||||
socket.value.on('log_error', stream => {
|
||||
const json = JSON.parse(stream);
|
||||
toast.error(json?.message);
|
||||
});
|
||||
|
||||
socket.value.on('completed', stream => {
|
||||
const item = JSON.parse(stream);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue