livestream code refactoring
This commit is contained in:
@@ -111,7 +111,7 @@ export enum LiveStreamStatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type LiveStreamProgress = Record<string, {
|
export type LiveStreamProgress = Record<string, {
|
||||||
Status: LiveStreamStatus
|
status: LiveStreamStatus
|
||||||
WaitTime: string
|
waitTime: string
|
||||||
LiveDate: string
|
liveDate: string
|
||||||
}>
|
}>
|
||||||
@@ -101,17 +101,17 @@ const LiveStreamMonitorView: React.FC = () => {
|
|||||||
>
|
>
|
||||||
<TableCell>{k}</TableCell>
|
<TableCell>{k}</TableCell>
|
||||||
<TableCell align='right'>
|
<TableCell align='right'>
|
||||||
{mapStatusToChip(progress[k].Status)}
|
{mapStatusToChip(progress[k].status)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell align='right'>
|
<TableCell align='right'>
|
||||||
{progress[k].Status === LiveStreamStatus.WAITING
|
{progress[k].status === LiveStreamStatus.WAITING
|
||||||
? formatMicro(Number(progress[k].WaitTime))
|
? formatMicro(Number(progress[k].waitTime))
|
||||||
: "-"
|
: "-"
|
||||||
}
|
}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell align='right'>
|
<TableCell align='right'>
|
||||||
{progress[k].Status === LiveStreamStatus.WAITING
|
{progress[k].status === LiveStreamStatus.WAITING
|
||||||
? new Date(progress[k].LiveDate).toLocaleString()
|
? new Date(progress[k].liveDate).toLocaleString()
|
||||||
: "-"
|
: "-"
|
||||||
}
|
}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import (
|
|||||||
"log/slog"
|
"log/slog"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/marcopeocchi/yt-dlp-web-ui/server/config"
|
"github.com/marcopeocchi/yt-dlp-web-ui/server/config"
|
||||||
"github.com/marcopeocchi/yt-dlp-web-ui/server/internal"
|
"github.com/marcopeocchi/yt-dlp-web-ui/server/internal"
|
||||||
@@ -63,11 +62,7 @@ func (m *Monitor) Status() LiveStreamStatus {
|
|||||||
// continue
|
// continue
|
||||||
// }
|
// }
|
||||||
|
|
||||||
status[k] = struct {
|
status[k] = Status{
|
||||||
Status int
|
|
||||||
WaitTime time.Duration
|
|
||||||
LiveDate time.Time
|
|
||||||
}{
|
|
||||||
Status: v.status,
|
Status: v.status,
|
||||||
WaitTime: v.waitTime,
|
WaitTime: v.waitTime,
|
||||||
LiveDate: v.liveDate,
|
LiveDate: v.liveDate,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import "time"
|
|||||||
type LiveStreamStatus = map[string]Status
|
type LiveStreamStatus = map[string]Status
|
||||||
|
|
||||||
type Status = struct {
|
type Status = struct {
|
||||||
Status int
|
Status int `json:"status"`
|
||||||
WaitTime time.Duration
|
WaitTime time.Duration `json:"waitTime"`
|
||||||
LiveDate time.Time
|
LiveDate time.Time `json:"liveDate"`
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user