Refactor structure, use cobra

This commit is contained in:
Ben Sarmiento
2023-11-29 23:05:08 +01:00
parent 70550ea57c
commit ced99b9667
10 changed files with 158 additions and 99 deletions

View File

@@ -40,7 +40,6 @@ type TorrentManager struct {
antsPool *ants.Pool
unrestrictPool *ants.Pool
log *zap.SugaredLogger
mu *sync.Mutex
}
// NewTorrentManager creates a new torrent manager
@@ -55,7 +54,6 @@ func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, p
requiredVersion: "18.11.2023",
antsPool: p,
log: log,
mu: &sync.Mutex{},
}
unrestrictPool, err := ants.NewPool(t.Config.GetUnrestrictWorkers())
@@ -65,8 +63,6 @@ func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, p
t.unrestrictPool = unrestrictPool
}
ensureDir(DATA_DIR)
// create internal directories
t.DirectoryMap.Set(INT_ALL, cmap.New[*Torrent]()) // key is AccessKey
t.DirectoryMap.Set(INT_INFO_CACHE, cmap.New[*Torrent]()) // key is Torrent ID