32bit compatibility

This commit is contained in:
Ben Sarmiento
2024-01-06 17:30:17 +01:00
parent a3eab1752c
commit d93fd2cdc1
6 changed files with 28 additions and 33 deletions

View File

@@ -9,10 +9,9 @@ import (
"github.com/debridmediamanager/zurg/internal/config"
"github.com/debridmediamanager/zurg/pkg/logutil"
"github.com/debridmediamanager/zurg/pkg/realdebrid"
mapset "github.com/deckarep/golang-set/v2"
cmap "github.com/orcaman/concurrent-map/v2"
"github.com/panjf2000/ants/v2"
"github.com/scylladb/go-set"
"github.com/scylladb/go-set/strset"
)
const (
@@ -25,7 +24,7 @@ type TorrentManager struct {
Api *realdebrid.RealDebrid
DirectoryMap cmap.ConcurrentMap[string, cmap.ConcurrentMap[string, *Torrent]] // directory -> accessKey -> Torrent
DownloadCache cmap.ConcurrentMap[string, *realdebrid.Download]
allAccessKeys *strset.Set
allAccessKeys mapset.Set[string]
latestState *LibraryState
requiredVersion string
workerPool *ants.Pool
@@ -42,7 +41,7 @@ func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, p
t := &TorrentManager{
Config: cfg,
Api: api,
allAccessKeys: set.NewStringSet(),
allAccessKeys: mapset.NewSet[string](),
latestState: &initialSate,
requiredVersion: "06.12.2023",
workerPool: p,
@@ -120,7 +119,7 @@ func (t *TorrentManager) TriggerHookOnLibraryUpdate(updatedPaths []string) {
}
func (t *TorrentManager) assignedDirectoryCb(tor *Torrent, cb func(string)) {
torrentIDs := strset.Union(tor.DownloadedIDs, tor.InProgressIDs).List()
torrentIDs := tor.DownloadedIDs.Union(tor.InProgressIDs).ToSlice()
// get filenames needed for directory conditions
var filenames []string
var fileSizes []int64
@@ -200,7 +199,7 @@ func (t *TorrentManager) readTorrentFromFile(torrentID string) *Torrent {
if err := json.Unmarshal(jsonData, &torrent); err != nil {
return nil
}
if strset.Union(torrent.DownloadedIDs, torrent.InProgressIDs).IsEmpty() {
if torrent.DownloadedIDs.Union(torrent.InProgressIDs).IsEmpty() {
t.log.Fatal("Torrent has no downloaded or in progress ids")
}
if torrent.Version != t.requiredVersion {