Merge branch 'beta' of github.com:sirrobot01/debrid-blackhole into beta
This commit is contained in:
@@ -127,6 +127,7 @@ func (r *AllDebrid) GetTorrent(id string) (*Torrent, error) {
|
|||||||
files = append(files, file)
|
files = append(files, file)
|
||||||
}
|
}
|
||||||
parentFolder := data.Filename
|
parentFolder := data.Filename
|
||||||
|
|
||||||
if data.NbLinks == 1 {
|
if data.NbLinks == 1 {
|
||||||
// All debrid doesn't return the parent folder for single file torrents
|
// All debrid doesn't return the parent folder for single file torrents
|
||||||
parentFolder = ""
|
parentFolder = ""
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ func (t *Torrent) GetSymlinkFolder(parent string) string {
|
|||||||
return filepath.Join(parent, t.Arr.Name, t.Folder)
|
return filepath.Join(parent, t.Arr.Name, t.Folder)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Torrent) GetMountFolder(rClonePath string) string {
|
func (t *Torrent) GetMountFolder(rClonePath string) (string, error) {
|
||||||
possiblePaths := []string{
|
possiblePaths := []string{
|
||||||
t.OriginalFilename,
|
t.OriginalFilename,
|
||||||
t.Filename,
|
t.Filename,
|
||||||
@@ -67,10 +67,10 @@ func (t *Torrent) GetMountFolder(rClonePath string) string {
|
|||||||
|
|
||||||
for _, path := range possiblePaths {
|
for _, path := range possiblePaths {
|
||||||
if common.FileReady(filepath.Join(rClonePath, path)) {
|
if common.FileReady(filepath.Join(rClonePath, path)) {
|
||||||
return path
|
return path, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ""
|
return "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Torrent) Delete() {
|
func (t *Torrent) Delete() {
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ func (q *QBit) ProcessSymlink(debridTorrent *debrid.Torrent) (string, error) {
|
|||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
files := debridTorrent.Files
|
files := debridTorrent.Files
|
||||||
ready := make(chan debrid.TorrentFile, len(files))
|
ready := make(chan debrid.TorrentFile, len(files))
|
||||||
|
if len(files) == 0 {
|
||||||
|
return "", fmt.Errorf("no video files found")
|
||||||
|
}
|
||||||
|
|
||||||
q.logger.Printf("Checking %d files...", len(files))
|
q.logger.Printf("Checking %d files...", len(files))
|
||||||
rCloneBase := debridTorrent.Debrid.GetMountPath()
|
rCloneBase := debridTorrent.Debrid.GetMountPath()
|
||||||
@@ -86,9 +89,9 @@ func (q *QBit) ProcessSymlink(debridTorrent *debrid.Torrent) (string, error) {
|
|||||||
|
|
||||||
func (q *QBit) getTorrentPath(rclonePath string, debridTorrent *debrid.Torrent) (string, error) {
|
func (q *QBit) getTorrentPath(rclonePath string, debridTorrent *debrid.Torrent) (string, error) {
|
||||||
for {
|
for {
|
||||||
torrentPath := debridTorrent.GetMountFolder(rclonePath)
|
torrentPath, err := debridTorrent.GetMountFolder(rclonePath)
|
||||||
if torrentPath != "" {
|
if err == nil {
|
||||||
return torrentPath, nil
|
return torrentPath, err
|
||||||
}
|
}
|
||||||
time.Sleep(time.Second)
|
time.Sleep(time.Second)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -188,7 +188,8 @@ func (q *QBit) UpdateTorrent(t *Torrent, debridTorrent *debrid.Torrent) *Torrent
|
|||||||
}
|
}
|
||||||
|
|
||||||
if t.TorrentPath == "" {
|
if t.TorrentPath == "" {
|
||||||
t.TorrentPath = filepath.Base(debridTorrent.GetMountFolder(rcLoneMount))
|
tPath, _ := debridTorrent.GetMountFolder(rcLoneMount)
|
||||||
|
t.TorrentPath = filepath.Base(tPath)
|
||||||
}
|
}
|
||||||
savePath := filepath.Join(q.DownloadFolder, t.Category) + string(os.PathSeparator)
|
savePath := filepath.Join(q.DownloadFolder, t.Category) + string(os.PathSeparator)
|
||||||
torrentPath := filepath.Join(savePath, t.TorrentPath) + string(os.PathSeparator)
|
torrentPath := filepath.Join(savePath, t.TorrentPath) + string(os.PathSeparator)
|
||||||
|
|||||||
Reference in New Issue
Block a user