Use full path of files
This commit is contained in:
@@ -52,7 +52,7 @@ func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, w
|
||||
deleteOnceDone: mapset.NewSet[string](),
|
||||
allAccessKeys: mapset.NewSet[string](),
|
||||
latestState: &LibraryState{},
|
||||
requiredVersion: "24.01.2024",
|
||||
requiredVersion: "27.01.2024",
|
||||
workerPool: workerPool,
|
||||
repairPool: repairPool,
|
||||
log: log,
|
||||
|
||||
@@ -213,15 +213,18 @@ func (t *TorrentManager) getMoreInfo(rdTorrent realdebrid.Torrent) *Torrent {
|
||||
}
|
||||
torrent.SelectedFiles = cmap.New[*File]()
|
||||
for _, file := range selectedFiles {
|
||||
// remove forward slash in the beginning
|
||||
filename := strings.TrimPrefix(file.Path, "/")
|
||||
filename = strings.ReplaceAll(filename, "/", " - ")
|
||||
// todo better handling of duplicate filenames
|
||||
if torrent.SelectedFiles.Has(filepath.Base(file.Path)) {
|
||||
oldName := filepath.Base(file.Path)
|
||||
if torrent.SelectedFiles.Has(filename) {
|
||||
oldName := filename
|
||||
ext := filepath.Ext(oldName)
|
||||
filename := strings.TrimSuffix(oldName, ext)
|
||||
newName := fmt.Sprintf("%s (%d)%s", filename, file.ID, ext)
|
||||
noExtension := strings.TrimSuffix(oldName, ext)
|
||||
newName := fmt.Sprintf("%s (%d)%s", noExtension, file.ID, ext)
|
||||
torrent.SelectedFiles.Set(newName, file)
|
||||
} else {
|
||||
torrent.SelectedFiles.Set(filepath.Base(file.Path), file)
|
||||
torrent.SelectedFiles.Set(filename, file)
|
||||
}
|
||||
}
|
||||
torrent.DownloadedIDs = mapset.NewSet[string]()
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
mapset "github.com/deckarep/golang-set/v2"
|
||||
)
|
||||
|
||||
func (t *TorrentManager) getUncachedTorrents() ([]*Torrent, error) {
|
||||
func (t *TorrentManager) GetUncachedTorrents() ([]*Torrent, error) {
|
||||
t.log.Debug("Checking if torrents are still cached")
|
||||
allTorrents, _ := t.DirectoryMap.Get(INT_ALL)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user