Last minute fixes
This commit is contained in:
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
@@ -64,7 +64,7 @@ jobs:
|
|||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: compiled-binaries
|
name: compiled-binaries
|
||||||
path: compressed_artifacts/*.zip
|
path: compressed_artifacts/
|
||||||
|
|
||||||
release:
|
release:
|
||||||
name: Release
|
name: Release
|
||||||
@@ -82,6 +82,7 @@ jobs:
|
|||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: compiled-binaries
|
name: compiled-binaries
|
||||||
|
path: compressed_artifacts
|
||||||
|
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
id: create_release
|
id: create_release
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ func HandlePropfindRequest(w http.ResponseWriter, r *http.Request, t *torrent.To
|
|||||||
}
|
}
|
||||||
|
|
||||||
func handleListDirectories(w http.ResponseWriter, t *torrent.TorrentManager) error {
|
func handleListDirectories(w http.ResponseWriter, t *torrent.TorrentManager) error {
|
||||||
fmt.Fprint(w, "<?xml?><d:multistatus xmlns:d=\"DAV:\">")
|
fmt.Fprint(w, "<?xml version=\"1.0\" encoding=\"utf-8\"?><d:multistatus xmlns:d=\"DAV:\">")
|
||||||
// initial response is the directory itself
|
// initial response is the directory itself
|
||||||
fmt.Fprint(w, dav.Directory("", ""))
|
fmt.Fprint(w, dav.Directory("", ""))
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ func handleListTorrents(w http.ResponseWriter, requestPath string, t *torrent.To
|
|||||||
return fmt.Errorf("cannot find directory %s", basePath)
|
return fmt.Errorf("cannot find directory %s", basePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Fprint(w, "<?xml?><d:multistatus xmlns:d=\"DAV:\">")
|
fmt.Fprint(w, "<?xml version=\"1.0\" encoding=\"utf-8\"?><d:multistatus xmlns:d=\"DAV:\">")
|
||||||
// initial response is the directory itself
|
// initial response is the directory itself
|
||||||
fmt.Fprint(w, dav.Directory(basePath, ""))
|
fmt.Fprint(w, dav.Directory(basePath, ""))
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ func handleListFiles(w http.ResponseWriter, requestPath string, t *torrent.Torre
|
|||||||
return fmt.Errorf("cannot find torrent %s", accessKey)
|
return fmt.Errorf("cannot find torrent %s", accessKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Fprint(w, "<?xml?><d:multistatus xmlns:d=\"DAV:\">")
|
fmt.Fprint(w, "<?xml version=\"1.0\" encoding=\"utf-8\"?><d:multistatus xmlns:d=\"DAV:\">")
|
||||||
// initial response is the directory itself
|
// initial response is the directory itself
|
||||||
fmt.Fprint(w, dav.Directory(requestPath, tor.LatestAdded))
|
fmt.Fprint(w, dav.Directory(requestPath, tor.LatestAdded))
|
||||||
|
|
||||||
|
|||||||
@@ -339,13 +339,11 @@ func (t *TorrentManager) getMoreInfo(rdTorrent realdebrid.Torrent) *Torrent {
|
|||||||
var err error
|
var err error
|
||||||
// file cache
|
// file cache
|
||||||
torrentFromFile := t.readFromFile(rdTorrent.ID)
|
torrentFromFile := t.readFromFile(rdTorrent.ID)
|
||||||
if torrentFromFile != nil && len(torrentFromFile.ID) > 0 && len(torrentFromFile.Links) == len(rdTorrent.Links) {
|
if torrentFromFile != nil && len(torrentFromFile.ID) > 0 && len(torrentFromFile.Links) > 0 && len(torrentFromFile.Links) == len(rdTorrent.Links) && torrentFromFile.Links[0] == rdTorrent.Links[0] {
|
||||||
if (len(torrentFromFile.Links) > 0 && torrentFromFile.Links[0] == rdTorrent.Links[0]) || len(torrentFromFile.Links) == 0 {
|
info = torrentFromFile
|
||||||
// see if api data and file data still match
|
info.Progress = rdTorrent.Progress
|
||||||
// then it means data is still usable
|
} else {
|
||||||
info = torrentFromFile
|
torrentFromFile = nil
|
||||||
info.Progress = rdTorrent.Progress
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if info == nil {
|
if info == nil {
|
||||||
info, err = t.api.GetTorrentInfo(rdTorrent.ID)
|
info, err = t.api.GetTorrentInfo(rdTorrent.ID)
|
||||||
@@ -390,6 +388,7 @@ func (t *TorrentManager) getMoreInfo(rdTorrent realdebrid.Torrent) *Torrent {
|
|||||||
for _, file := range selectedFiles {
|
for _, file := range selectedFiles {
|
||||||
torrent.SelectedFiles.Set(filepath.Base(file.Path), file)
|
torrent.SelectedFiles.Set(filepath.Base(file.Path), file)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(selectedFiles) > 0 && torrentFromFile == nil {
|
if len(selectedFiles) > 0 && torrentFromFile == nil {
|
||||||
t.writeToFile(info) // only when there are selected files, else it's useless
|
t.writeToFile(info) // only when there are selected files, else it's useless
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ func (rd *RealDebrid) GetTorrentInfo(id string) (*TorrentInfo, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
rd.log.Debugf("Got info for torrent %s", id)
|
rd.log.Debugf("Got info for torrent %s (progress=%d%%)", id, response.Progress)
|
||||||
return &response, nil
|
return &response, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user