Fix rewrites
This commit is contained in:
@@ -1,16 +1,29 @@
|
||||
package torrent
|
||||
|
||||
import "github.com/debridmediamanager/zurg/pkg/logutil"
|
||||
|
||||
type LibraryState struct {
|
||||
TotalCount int
|
||||
ActiveCount int
|
||||
FirstTorrentId string
|
||||
log *logutil.Logger
|
||||
}
|
||||
|
||||
func (ls *LibraryState) Eq(a LibraryState) bool {
|
||||
if ls.TotalCount == 0 || ls.FirstTorrentId == "" {
|
||||
ls.log.Debugf("Checksum is empty")
|
||||
return false
|
||||
} else if a.TotalCount != ls.TotalCount {
|
||||
ls.log.Debugf("Checksum total count mismatch: %d != %d", a.TotalCount, ls.TotalCount)
|
||||
return false
|
||||
} else if a.ActiveCount != ls.ActiveCount {
|
||||
ls.log.Debugf("Checksum active count mismatch: %d != %d", a.ActiveCount, ls.ActiveCount)
|
||||
return false
|
||||
} else if a.FirstTorrentId != ls.FirstTorrentId {
|
||||
ls.log.Debugf("Checksum first torrent id mismatch: %s != %s", a.FirstTorrentId, ls.FirstTorrentId)
|
||||
return false
|
||||
}
|
||||
return a.TotalCount == ls.TotalCount && a.ActiveCount == ls.ActiveCount && a.FirstTorrentId == ls.FirstTorrentId
|
||||
return true
|
||||
}
|
||||
|
||||
func (t *TorrentManager) setNewLatestState(checksum LibraryState) {
|
||||
|
||||
Reference in New Issue
Block a user