- Fix alldebrid bug
- Minor cleanup - speedgains
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/sirrobot01/debrid-blackhole/internal/config"
|
||||
"github.com/sirrobot01/debrid-blackhole/internal/logger"
|
||||
"github.com/sirrobot01/debrid-blackhole/internal/request"
|
||||
"github.com/sirrobot01/debrid-blackhole/internal/utils"
|
||||
"github.com/sirrobot01/debrid-blackhole/pkg/debrid/torrent"
|
||||
|
||||
"net/http"
|
||||
@@ -106,7 +107,9 @@ func flattenFiles(files []MagnetFile, parentPath string, index *int) []torrent.F
|
||||
} else {
|
||||
// This is a file
|
||||
fileName := filepath.Base(f.Name)
|
||||
if common.RegexMatch(common.SAMPLEMATCH, fileName) {
|
||||
|
||||
// Skip sample files
|
||||
if utils.IsSampleFile(fileName) {
|
||||
continue
|
||||
}
|
||||
if !cfg.IsAllowedFile(fileName) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/sirrobot01/debrid-blackhole/internal/config"
|
||||
"github.com/sirrobot01/debrid-blackhole/internal/logger"
|
||||
"github.com/sirrobot01/debrid-blackhole/internal/request"
|
||||
"github.com/sirrobot01/debrid-blackhole/internal/utils"
|
||||
"github.com/sirrobot01/debrid-blackhole/pkg/debrid/torrent"
|
||||
|
||||
"net/http"
|
||||
@@ -124,7 +125,7 @@ func (dl *DebridLink) GetTorrent(id string) (*torrent.Torrent, error) {
|
||||
if data.Status == 100 {
|
||||
status = "downloaded"
|
||||
}
|
||||
name := common.RemoveInvalidChars(data.Name)
|
||||
name := utils.RemoveInvalidChars(data.Name)
|
||||
t.Id = data.ID
|
||||
t.Name = name
|
||||
t.Bytes = data.TotalSize
|
||||
@@ -171,7 +172,7 @@ func (dl *DebridLink) SubmitMagnet(t *torrent.Torrent) (*torrent.Torrent, error)
|
||||
}
|
||||
data := *res.Value
|
||||
status := "downloading"
|
||||
name := common.RemoveInvalidChars(data.Name)
|
||||
name := utils.RemoveInvalidChars(data.Name)
|
||||
t.Id = data.ID
|
||||
t.Name = name
|
||||
t.Bytes = data.TotalSize
|
||||
|
||||
@@ -171,7 +171,7 @@ func (r *RealDebrid) GetTorrent(id string) (*torrent.Torrent, error) {
|
||||
if err != nil {
|
||||
return t, err
|
||||
}
|
||||
name := common.RemoveInvalidChars(data.OriginalFilename)
|
||||
name := utils.RemoveInvalidChars(data.OriginalFilename)
|
||||
t.Id = id
|
||||
t.Name = name
|
||||
t.Bytes = data.Bytes
|
||||
@@ -203,7 +203,7 @@ func (r *RealDebrid) CheckStatus(t *torrent.Torrent, isSymlink bool) (*torrent.T
|
||||
var data TorrentInfo
|
||||
err = json.Unmarshal(resp, &data)
|
||||
status := data.Status
|
||||
name := common.RemoveInvalidChars(data.OriginalFilename)
|
||||
name := utils.RemoveInvalidChars(data.OriginalFilename)
|
||||
t.Name = name // Important because some magnet changes the name
|
||||
t.Folder = name
|
||||
t.Filename = data.Filename
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/sirrobot01/debrid-blackhole/internal/config"
|
||||
"github.com/sirrobot01/debrid-blackhole/internal/logger"
|
||||
"github.com/sirrobot01/debrid-blackhole/internal/request"
|
||||
"github.com/sirrobot01/debrid-blackhole/internal/utils"
|
||||
"github.com/sirrobot01/debrid-blackhole/pkg/debrid/torrent"
|
||||
|
||||
"mime/multipart"
|
||||
@@ -180,7 +181,7 @@ func (tb *Torbox) GetTorrent(id string) (*torrent.Torrent, error) {
|
||||
cfg := config.GetConfig()
|
||||
for _, f := range data.Files {
|
||||
fileName := filepath.Base(f.Name)
|
||||
if common.RegexMatch(common.SAMPLEMATCH, fileName) {
|
||||
if utils.IsSampleFile(fileName) {
|
||||
// Skip sample files
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ func (t *Torrent) GetMountFolder(rClonePath string) (string, error) {
|
||||
possiblePaths := []string{
|
||||
t.OriginalFilename,
|
||||
t.Filename,
|
||||
common.RemoveExtension(t.OriginalFilename),
|
||||
utils.RemoveExtension(t.OriginalFilename),
|
||||
}
|
||||
|
||||
for _, path := range possiblePaths {
|
||||
|
||||
Reference in New Issue
Block a user