Sort repair queue
This commit is contained in:
@@ -29,7 +29,7 @@ type RootResponse struct {
|
|||||||
UserInfo *realdebrid.User `json:"user_info"`
|
UserInfo *realdebrid.User `json:"user_info"`
|
||||||
RDTrafficUsed uint64 `json:"rd_traffic_used"`
|
RDTrafficUsed uint64 `json:"rd_traffic_used"`
|
||||||
LibrarySize int `json:"library_size"` // Number of torrents in the library
|
LibrarySize int `json:"library_size"` // Number of torrents in the library
|
||||||
RepairQueueStr string `json:"repair_queue"` // List of torrents in the repair queue
|
TorrentsToRepair string `json:"repair_queue"` // List of torrents in the repair queue
|
||||||
MemAlloc uint64 `json:"mem_alloc"` // Memory allocation in MB
|
MemAlloc uint64 `json:"mem_alloc"` // Memory allocation in MB
|
||||||
TotalAlloc uint64 `json:"total_alloc"` // Total memory allocated in MB
|
TotalAlloc uint64 `json:"total_alloc"` // Total memory allocated in MB
|
||||||
Sys uint64 `json:"sys"` // System memory in MB
|
Sys uint64 `json:"sys"` // System memory in MB
|
||||||
@@ -61,17 +61,18 @@ func (zr *Handlers) handleHome(resp http.ResponseWriter, req *http.Request) {
|
|||||||
|
|
||||||
repairQueueStr := ""
|
repairQueueStr := ""
|
||||||
if zr.torMgr.RepairQueue == nil {
|
if zr.torMgr.RepairQueue == nil {
|
||||||
repairQueueStr = "repair is disabled"
|
repairQueueStr = "uninitialized"
|
||||||
} else if zr.torMgr.RepairQueue.IsEmpty() {
|
} else if zr.torMgr.RepairQueue.IsEmpty() {
|
||||||
repairQueueStr = "empty"
|
repairQueueStr = "empty"
|
||||||
} else {
|
} else {
|
||||||
|
var repairList []string
|
||||||
for _, torrent := range zr.torMgr.RepairQueue.ToSlice() {
|
for _, torrent := range zr.torMgr.RepairQueue.ToSlice() {
|
||||||
if torrent == nil {
|
if torrent != nil {
|
||||||
repairQueueStr += " ⬅ 'all torrents'"
|
repairList = append(repairList, zr.torMgr.GetKey(torrent))
|
||||||
} else {
|
|
||||||
repairQueueStr += fmt.Sprintf(" ⬅ %s", zr.torMgr.GetKey(torrent))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sort.Strings(repairList)
|
||||||
|
repairQueueStr = strings.Join(repairList, ", ")
|
||||||
}
|
}
|
||||||
|
|
||||||
sortedIDs := zr.torMgr.OnceDoneBin.ToSlice()
|
sortedIDs := zr.torMgr.OnceDoneBin.ToSlice()
|
||||||
@@ -95,7 +96,7 @@ func (zr *Handlers) handleHome(resp http.ResponseWriter, req *http.Request) {
|
|||||||
UserInfo: userInfo,
|
UserInfo: userInfo,
|
||||||
RDTrafficUsed: bToGb(uint64(rdTrafficUsed)),
|
RDTrafficUsed: bToGb(uint64(rdTrafficUsed)),
|
||||||
LibrarySize: allTorrents.Count(),
|
LibrarySize: allTorrents.Count(),
|
||||||
RepairQueueStr: repairQueueStr,
|
TorrentsToRepair: repairQueueStr,
|
||||||
MemAlloc: bToMb(mem.Alloc),
|
MemAlloc: bToMb(mem.Alloc),
|
||||||
TotalAlloc: bToMb(mem.TotalAlloc),
|
TotalAlloc: bToMb(mem.TotalAlloc),
|
||||||
Sys: bToMb(mem.Sys),
|
Sys: bToMb(mem.Sys),
|
||||||
@@ -307,7 +308,7 @@ func (zr *Handlers) handleHome(resp http.ResponseWriter, req *http.Request) {
|
|||||||
<td colspan="2">%v</td>
|
<td colspan="2">%v</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Repair Queue</td>
|
<td>Torrents to be repaired</td>
|
||||||
<td colspan="2">%s</td>
|
<td colspan="2">%s</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -409,7 +410,7 @@ func (zr *Handlers) handleHome(resp http.ResponseWriter, req *http.Request) {
|
|||||||
response.Config.ShouldForceIPv6(),
|
response.Config.ShouldForceIPv6(),
|
||||||
response.Config.GetOnLibraryUpdate(),
|
response.Config.GetOnLibraryUpdate(),
|
||||||
response.IDsToDelete,
|
response.IDsToDelete,
|
||||||
response.RepairQueueStr,
|
response.TorrentsToRepair,
|
||||||
response.Hosts,
|
response.Hosts,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user