Use full path of files
This commit is contained in:
@@ -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]()
|
||||
|
||||
Reference in New Issue
Block a user