-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show currently playing stream on dashboard
- Loading branch information
Showing
8 changed files
with
111 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
function updateDurations() { | ||
const entries = document.querySelectorAll('[data-start-time]'); | ||
const now = Math.floor(Date.now() / 1000); | ||
|
||
entries.forEach(entry => { | ||
const startTime = parseInt(entry.dataset.startTime); | ||
const durationSeconds = now - startTime; | ||
|
||
const hours = Math.floor(durationSeconds / 3600); | ||
const minutes = Math.floor((durationSeconds % 3600) / 60); | ||
const seconds = durationSeconds % 60; | ||
|
||
let durationStr = ''; | ||
if (hours > 0) durationStr += `${hours}h `; | ||
if (minutes > 0) durationStr += `${minutes}m `; | ||
durationStr += `${seconds}s`; | ||
|
||
const startTimeStr = new Date(startTime * 1000).toLocaleTimeString(); | ||
entry.title = `Started: ${startTimeStr} (Duration: ${durationStr})`; | ||
}); | ||
} | ||
|
||
// Update durations immediately and every second | ||
updateDurations(); | ||
setInterval(updateDurations, 1000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<div class="p-4"> | ||
<h3 class="text-lg font-semibold mb-5">Active Streams: {{len .ActiveStreams}} / Total Streams: {{.TotalStreams}}</h3> | ||
|
||
<div class="flex flex-col gap-3 mt-5"> | ||
{{range .ActiveStreams}} | ||
<div class="flex items-center p-3 bg-gray-50 dark:bg-dark-bg rounded-lg transition-colors hover:bg-gray-100" data-start-time="{{.StartTime.Unix}}" title="Started: {{.StartTime.Format "15:04:05"}}"> | ||
{{if .LogoURL}} | ||
<img src="{{.LogoURL}}" alt="{{.Name}}" class="w-10 h-10 object-contain mr-4"> | ||
{{end}} | ||
<div class="flex gap-x-6"> | ||
<div class="font-bold">{{.Name}}</div> | ||
<div class="text-sm text-gray-500 content-center">{{.ClientIP}}</div> | ||
</div> | ||
</div> | ||
{{else}} | ||
<div class="text-center font-bold text-gray-500 py-5">No active streams</div> | ||
{{end}} | ||
</div> | ||
</div> |