prepare for release

This commit is contained in:
Ben Sarmiento
2023-10-20 18:40:13 +02:00
parent 9dcdb60ae7
commit cd6b94f868
4 changed files with 157 additions and 17 deletions

View File

@@ -53,7 +53,7 @@ func createSingleTorrentResponse(basePath string, torrents []torrent.Torrent, t
// TODO: trigger a re-add for the file
// It is selected but no link is available
// I think this is handled on the manager side so we just need to refresh
t.RefreshInfo(torrent.ID)
// t.RefreshInfo(torrent.ID)
continue
}
filename := filepath.Base(file.Path)

View File

@@ -297,6 +297,15 @@ func (t *TorrentManager) writeToFile(torrentID string, torrent *Torrent) {
func (t *TorrentManager) readFromFile(torrentID string) *Torrent {
filePath := fmt.Sprintf("data/%s.bin", torrentID)
fileInfo, err := os.Stat(filePath)
if err != nil {
return nil
}
if time.Since(fileInfo.ModTime()) > time.Duration(t.config.GetCacheTimeHours())*time.Hour {
return nil
}
file, err := os.Open(filePath)
if err != nil {
return nil