Media analysis

This commit is contained in:
Ben Sarmiento
2024-05-26 04:21:22 +02:00
parent 4c23402c26
commit c203f11e76
3 changed files with 44 additions and 18 deletions

View File

@@ -269,21 +269,24 @@ func (zr *Handlers) handleHome(resp http.ResponseWriter, req *http.Request) {
<form method="get" action="/logs/upload">
<input type="submit" value="Upload logs" />
</form>
<form method="post" action="/reboot/worker">
<form method="post" action="/reboot-worker">
<input type="submit" value="Reboot worker pool" />
</form>
<form method="post" action="/reboot/refresh">
<form method="post" action="/reboot-refresh">
<input type="submit" value="Reboot refresh worker" />
</form>
<form method="post" action="/reboot/repair">
<form method="post" action="/reboot-repair">
<input type="submit" value="Reboot repair worker" />
</form>
<form method="post" action="/remount/downloads">
<form method="post" action="/downloads/remount">
<input type="submit" value="Remount downloads" />
</form>
<form method="post" action="/dump/torrents">
<form method="post" action="/torrents/dump">
<input type="submit" value="Dump torrents" />
</form>
<form method="post" action="/torrents/analyze">
<input type="submit" value="Analyze torrents" />
</form>
</td>
</tr>
</table>
@@ -387,6 +390,13 @@ func (zr *Handlers) handleDumpTorrents(resp http.ResponseWriter, req *http.Reque
fmt.Fprint(resp, "Dumping torrents...")
}
func (zr *Handlers) handleAnalyzeTorrents(resp http.ResponseWriter, req *http.Request) {
resp.Header().Set("Refresh", "2; url=/")
zr.torMgr.AnalyzeTrigger <- struct{}{}
zr.log.Infof("Triggered media analysis of torrents")
fmt.Fprint(resp, "Analyzing all torrents...")
}
func bToMb(b uint64) uint64 {
return b / 1024 / 1024
}