Reimplement deletes and marking files as broken

This commit is contained in:
Ben Sarmiento
2024-01-29 22:28:27 +01:00
parent 1615c9e121
commit b505400f60
12 changed files with 64 additions and 112 deletions

View File

@@ -27,7 +27,6 @@ type TorrentManager struct {
DownloadCache cmap.ConcurrentMap[string, *realdebrid.Download]
DownloadMap cmap.ConcurrentMap[string, *realdebrid.Download]
fixers cmap.ConcurrentMap[string, *Torrent]
deleteOnceDone mapset.Set[string]
allAccessKeys mapset.Set[string]
latestState *LibraryState
requiredVersion string
@@ -56,7 +55,6 @@ func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, w
RefreshKillSwitch: make(chan struct{}, 1),
RepairKillSwitch: make(chan struct{}, 1),
fixers: cmap.New[*Torrent](),
deleteOnceDone: mapset.NewSet[string](),
allAccessKeys: mapset.NewSet[string](),
latestState: &LibraryState{},
requiredVersion: "0.9.3-hotfix.3",
@@ -78,6 +76,7 @@ func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, w
// proxy
func (t *TorrentManager) UnrestrictUntilOk(link string) *realdebrid.Download {
// check if it's a valid link
if !strings.HasPrefix(link, "http") {
return nil
}
@@ -114,6 +113,9 @@ func (t *TorrentManager) GetKey(torrent *Torrent) string {
}
func (t *TorrentManager) GetPath(file *File) string {
if !t.Config.ShouldIgnoreRenames() && file.Rename != "" {
return file.Rename
}
if t.Config.ShouldExposeFullPath() {
filename := strings.TrimPrefix(file.Path, "/")
filename = strings.ReplaceAll(filename, "/", " - ")