Skip to content

Commit

Permalink
Fix magnet conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
sirrobot01 committed Dec 18, 2024
1 parent 58c0aaf commit b77dbcc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@ jobs:
- name: Get version
id: get_version
run: |
echo "All tags:"
git tag
LATEST_TAG=$(git tag | sort -V | tail -n1)
echo "latest_tag=${LATEST_TAG}" >> $GITHUB_ENV
echo "Found tag: ${LATEST_TAG}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand Down
5 changes: 4 additions & 1 deletion pkg/debrid/realdebrid.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
gourl "net/url"
"os"
"path/filepath"
"slices"
"strconv"
"strings"
)
Expand Down Expand Up @@ -167,6 +168,7 @@ func (r *RealDebrid) CheckStatus(torrent *Torrent, isSymlink bool) (*Torrent, er
var data structs.RealDebridTorrentInfo
err = json.Unmarshal(resp, &data)
status := data.Status
fmt.Println("RD STATUS: ", status)
name := common.RemoveInvalidChars(data.OriginalFilename)
torrent.Name = name // Important because some magnet changes the name
torrent.Folder = name
Expand All @@ -179,6 +181,7 @@ func (r *RealDebrid) CheckStatus(torrent *Torrent, isSymlink bool) (*Torrent, er
torrent.Links = data.Links
torrent.Status = status
torrent.Debrid = r
downloading_status := []string{"downloading", "magnet_conversion", "queued", "compressing", "uploading"}
if status == "error" || status == "dead" || status == "magnet_error" {
return torrent, fmt.Errorf("torrent: %s has error: %s", torrent.Name, status)
} else if status == "waiting_files_selection" {
Expand Down Expand Up @@ -211,7 +214,7 @@ func (r *RealDebrid) CheckStatus(torrent *Torrent, isSymlink bool) (*Torrent, er
}
}
break
} else if status == "downloading" {
} else if slices.Contains(downloading_status, status) {
if !r.DownloadUncached {
return torrent, fmt.Errorf("torrent: %s not cached", torrent.Name)
}
Expand Down

0 comments on commit b77dbcc

Please sign in to comment.