Fix naming to accurately depict zurg
This commit is contained in:
@@ -37,6 +37,7 @@ func RemoveInvalidChars(value string) string {
|
||||
}
|
||||
|
||||
func RemoveExtension(value string) string {
|
||||
value = RemoveInvalidChars(value)
|
||||
re := regexp.MustCompile(VIDEOMATCH + "|" + SAMPLEMATCH + "|" + MUSICMATCH)
|
||||
|
||||
// Find the last index of the matched extension
|
||||
|
||||
@@ -173,7 +173,7 @@ func (r *RealDebrid) UpdateTorrent(t *torrent.Torrent) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
name := utils.RemoveInvalidChars(data.OriginalFilename)
|
||||
name := utils.RemoveExtension(data.OriginalFilename)
|
||||
t.Name = name
|
||||
t.Bytes = data.Bytes
|
||||
t.Folder = name
|
||||
@@ -379,7 +379,7 @@ func (r *RealDebrid) getTorrents(offset int, limit int) (int, []*torrent.Torrent
|
||||
}
|
||||
torrents = append(torrents, &torrent.Torrent{
|
||||
Id: t.Id,
|
||||
Name: t.Filename,
|
||||
Name: utils.RemoveInvalidChars(t.Filename),
|
||||
Bytes: t.Bytes,
|
||||
Progress: t.Progress,
|
||||
Status: t.Status,
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/goccy/go-json"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/sirrobot01/debrid-blackhole/internal/logger"
|
||||
"github.com/sirrobot01/debrid-blackhole/internal/utils"
|
||||
"github.com/sirrobot01/debrid-blackhole/pkg/debrid/debrid"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -108,7 +109,10 @@ func (c *Cache) refreshListings() {
|
||||
}
|
||||
|
||||
func (c *Cache) GetListing() []os.FileInfo {
|
||||
return c.listings.Load().([]os.FileInfo)
|
||||
if v, ok := c.listings.Load().([]os.FileInfo); ok {
|
||||
return v
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Cache) setTorrents(torrents map[string]*CachedTorrent) {
|
||||
@@ -249,6 +253,7 @@ func (c *Cache) load() (map[string]*CachedTorrent, error) {
|
||||
if len(ct.Files) != 0 {
|
||||
// We can assume the torrent is complete
|
||||
ct.IsComplete = true
|
||||
ct.Torrent.Name = utils.RemoveExtension(ct.Torrent.Filename) // Update the name
|
||||
torrents[ct.Id] = &ct
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user