Skip to content

Commit

Permalink
code refactoring / fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
marcopiovanello committed Aug 20, 2024
1 parent 01e9da6 commit 92e3fd9
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 55 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.tsx linguist-detectable=false
2 changes: 1 addition & 1 deletion frontend/src/components/livestream/LivestreamDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const LivestreamDialog: React.FC<Props> = ({ open, onClose }) => {
<Grid item xs={12} mb={2}>
<Alert severity="info">
This will monitor yet to start livestream. Each process will be executed with --wait-for-video 10.<br />
If an already started livestream is provided it will be still downloaded but progress will not be tracked.
If an already started livestream is provided it will be still downloaded but its progress will not be tracked.
</Alert>
<Alert severity="warning" sx={{ mt: 1 }}>
This feature is still experimental. Something might break!
Expand Down
102 changes: 49 additions & 53 deletions frontend/src/views/Livestream.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,60 +66,56 @@ const LiveStreamMonitorView: React.FC = () => {
return (
<>
<LivestreamSpeedDial onOpen={() => setOpenDialog(s => !s)} onStopAll={stopAll} />
{
!progress || Object.keys(progress).length === 0 ?
<NoLivestreams /> :
<Container maxWidth="xl" sx={{ mt: 4, mb: 8 }}>
<Paper sx={{
p: 2.5,
display: 'flex',
flexDirection: 'column',
minHeight: '80vh',
}}>
<TableContainer component={Box}>
<Table sx={{ minWidth: '100%' }}>
<TableHead>
<TableRow>
<TableCell>Livestream URL</TableCell>
<TableCell align="right">Status</TableCell>
<TableCell align="right">Time to live</TableCell>
<TableCell align="right">Starts on</TableCell>
<TableCell align="right">Actions</TableCell>
<LivestreamDialog open={openDialog} onClose={() => setOpenDialog(s => !s)} />

{!progress || Object.keys(progress).length === 0 ?
<NoLivestreams /> :
<Container maxWidth="xl" sx={{ mt: 4, mb: 8 }}>
<Paper sx={{
p: 2.5,
display: 'flex',
flexDirection: 'column',
minHeight: '80vh',
}}>
<TableContainer component={Box}>
<Table sx={{ minWidth: '100%' }}>
<TableHead>
<TableRow>
<TableCell>Livestream URL</TableCell>
<TableCell align="right">Status</TableCell>
<TableCell align="right">Time to live</TableCell>
<TableCell align="right">Starts on</TableCell>
<TableCell align="right">Actions</TableCell>
</TableRow>
</TableHead>
<TableBody>
{progress && Object.keys(progress).map(k => (
<TableRow
key={k}
sx={{ '&:last-child td, &:last-child th': { border: 0 } }}
>
<TableCell>{k}</TableCell>
<TableCell align='right'>
{mapStatusToChip(progress[k].Status)}
</TableCell>
<TableCell align='right'>
{formatMicro(Number(progress[k].WaitTime))}
</TableCell>
<TableCell align='right'>
{new Date(progress[k].LiveDate).toLocaleString()}
</TableCell>
<TableCell align='right'>
<Button variant='contained' size='small' onClick={() => stop(k)}>
Stop
</Button>
</TableCell>
</TableRow>
</TableHead>
<TableBody>
{progress && Object.keys(progress).map(k => (
<TableRow
key={k}
sx={{ '&:last-child td, &:last-child th': { border: 0 } }}
>
<TableCell>{k}</TableCell>
<TableCell align='right'>
{mapStatusToChip(progress[k].Status)}
</TableCell>
<TableCell align='right'>
{formatMicro(Number(progress[k].WaitTime))}
</TableCell>
<TableCell align='right'>
{new Date(progress[k].LiveDate).toLocaleString()}
</TableCell>
<TableCell align='right'>
<Button variant='contained' size='small' onClick={() => stop(k)}>
Stop
</Button>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
</Paper>
</Container>
}
<LivestreamDialog
open={openDialog}
onClose={() => setOpenDialog(s => !s)}
/>
))}
</TableBody>
</Table>
</TableContainer>
</Paper>
</Container>}
</>
)
}
Expand Down
2 changes: 1 addition & 1 deletion server/internal/livestream/livestream.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func (l *LiveStream) monitorStartTime(r io.Reader) error {

l.liveDate = parsed

//TODO: check if useing channels is stupid or not
//TODO: check if using channels is stupid or not
// l.waitTimeChan <- time.Until(start)
l.waitTime = time.Until(parsed)
}
Expand Down

0 comments on commit 92e3fd9

Please sign in to comment.