Fix magnet conversion
Some checks failed
Release / goreleaser (push) Failing after 2m4s

This commit is contained in:
Mukhtar Akere
2024-12-19 00:12:29 +01:00
parent 58c0aafab1
commit b77dbcc4f4
2 changed files with 4 additions and 4 deletions

View File

@@ -18,11 +18,8 @@ jobs:
- name: Get version - name: Get version
id: get_version id: get_version
run: | run: |
echo "All tags:"
git tag
LATEST_TAG=$(git tag | sort -V | tail -n1) LATEST_TAG=$(git tag | sort -V | tail -n1)
echo "latest_tag=${LATEST_TAG}" >> $GITHUB_ENV echo "latest_tag=${LATEST_TAG}" >> $GITHUB_ENV
echo "Found tag: ${LATEST_TAG}"
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v3

View File

@@ -10,6 +10,7 @@ import (
gourl "net/url" gourl "net/url"
"os" "os"
"path/filepath" "path/filepath"
"slices"
"strconv" "strconv"
"strings" "strings"
) )
@@ -167,6 +168,7 @@ func (r *RealDebrid) CheckStatus(torrent *Torrent, isSymlink bool) (*Torrent, er
var data structs.RealDebridTorrentInfo var data structs.RealDebridTorrentInfo
err = json.Unmarshal(resp, &data) err = json.Unmarshal(resp, &data)
status := data.Status status := data.Status
fmt.Println("RD STATUS: ", status)
name := common.RemoveInvalidChars(data.OriginalFilename) name := common.RemoveInvalidChars(data.OriginalFilename)
torrent.Name = name // Important because some magnet changes the name torrent.Name = name // Important because some magnet changes the name
torrent.Folder = name torrent.Folder = name
@@ -179,6 +181,7 @@ func (r *RealDebrid) CheckStatus(torrent *Torrent, isSymlink bool) (*Torrent, er
torrent.Links = data.Links torrent.Links = data.Links
torrent.Status = status torrent.Status = status
torrent.Debrid = r torrent.Debrid = r
downloading_status := []string{"downloading", "magnet_conversion", "queued", "compressing", "uploading"}
if status == "error" || status == "dead" || status == "magnet_error" { if status == "error" || status == "dead" || status == "magnet_error" {
return torrent, fmt.Errorf("torrent: %s has error: %s", torrent.Name, status) return torrent, fmt.Errorf("torrent: %s has error: %s", torrent.Name, status)
} else if status == "waiting_files_selection" { } else if status == "waiting_files_selection" {
@@ -211,7 +214,7 @@ func (r *RealDebrid) CheckStatus(torrent *Torrent, isSymlink bool) (*Torrent, er
} }
} }
break break
} else if status == "downloading" { } else if slices.Contains(downloading_status, status) {
if !r.DownloadUncached { if !r.DownloadUncached {
return torrent, fmt.Errorf("torrent: %s not cached", torrent.Name) return torrent, fmt.Errorf("torrent: %s not cached", torrent.Name)
} }