Final repair fixes

This commit is contained in:
Ben Sarmiento
2024-01-18 21:19:36 +01:00
parent 0a451cccde
commit 9472fae9fe
5 changed files with 28 additions and 20 deletions

View File

@@ -33,13 +33,14 @@ type TorrentManager struct {
latestState *LibraryState
requiredVersion string
workerPool *ants.Pool
repairPool *ants.Pool
log *logutil.Logger
}
// NewTorrentManager creates a new torrent manager
// it will fetch all torrents and their info in the background
// and store them in-memory and cached in files
func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, p *ants.Pool, log *logutil.Logger) *TorrentManager {
func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, workerPool, repairPool *ants.Pool, log *logutil.Logger) *TorrentManager {
t := &TorrentManager{
Config: cfg,
Api: api,
@@ -51,7 +52,8 @@ func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, p
allAccessKeys: mapset.NewSet[string](),
latestState: &LibraryState{},
requiredVersion: "11.01.2024",
workerPool: p,
workerPool: workerPool,
repairPool: repairPool,
log: log,
}
@@ -149,7 +151,7 @@ func (t *TorrentManager) assignedDirectoryCb(tor *Torrent, cb func(string)) {
tor.SelectedFiles.IterCb(func(key string, file *File) {
filenames = append(filenames, filepath.Base(file.Path))
fileSizes = append(fileSizes, file.Bytes)
if !tor.Unfixable && unplayable && utils.IsStreamable(file.Path) {
if !tor.Unrepairable && unplayable && utils.IsStreamable(file.Path) {
unplayable = false
}
})