Use worker pool extensively

This commit is contained in:
Ben Sarmiento
2023-11-30 00:40:26 +01:00
parent 6e54fa760b
commit 9e3760f275
5 changed files with 97 additions and 64 deletions

View File

@@ -0,0 +1,29 @@
package torrent
import (
"time"
"github.com/debridmediamanager/zurg/pkg/realdebrid"
)
type LibraryState struct {
TotalCount int
FirstTorrent *realdebrid.Torrent
DownloadingCount int
}
func (ls LibraryState) equal(a LibraryState) bool {
return a.TotalCount == ls.TotalCount && a.FirstTorrent.ID == ls.FirstTorrent.ID && a.DownloadingCount == ls.DownloadingCount
}
func EmptyState() LibraryState {
oldestTime := time.Time{}
return LibraryState{
TotalCount: 0,
FirstTorrent: &realdebrid.Torrent{
ID: "",
Added: oldestTime.Format(time.RFC3339),
},
DownloadingCount: 0,
}
}