Proper logging and fixing for unavailable files
This commit is contained in:
@@ -538,7 +538,7 @@ func (t *TorrentManager) repairAll() {
|
||||
|
||||
allTorrents, _ := t.DirectoryMap.Get(ALL_TORRENTS)
|
||||
allTorrents.IterCb(func(_ string, torrent *Torrent) {
|
||||
if torrent.InProgress() {
|
||||
if torrent.AnyInProgress() {
|
||||
t.log.Debugf("Skipping %s for repairs because it is in progress", torrent.AccessKey)
|
||||
return
|
||||
}
|
||||
@@ -588,7 +588,7 @@ func (t *TorrentManager) Repair(accessKey string) {
|
||||
return
|
||||
}
|
||||
|
||||
if torrent.InProgress() {
|
||||
if torrent.AnyInProgress() {
|
||||
t.log.Infof("Torrent %s is in progress, cannot repair", torrent.AccessKey)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ type Torrent struct {
|
||||
Instances []realdebrid.TorrentInfo
|
||||
}
|
||||
|
||||
func (t *Torrent) InProgress() bool {
|
||||
func (t *Torrent) AnyInProgress() bool {
|
||||
for _, instance := range t.Instances {
|
||||
if instance.Progress < 100 {
|
||||
return true
|
||||
@@ -22,6 +22,16 @@ func (t *Torrent) InProgress() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (t *Torrent) AllInProgress() bool {
|
||||
count := 0
|
||||
for _, instance := range t.Instances {
|
||||
if instance.Progress < 100 {
|
||||
count++
|
||||
}
|
||||
}
|
||||
return count == len(t.Instances)
|
||||
}
|
||||
|
||||
type File struct {
|
||||
realdebrid.File
|
||||
Added string
|
||||
|
||||
Reference in New Issue
Block a user