qbittorrent info cache

This commit is contained in:
royalcat 2024-12-09 23:46:53 +03:00
parent 36c501347c
commit 2d9dcd87fa
3 changed files with 127 additions and 25 deletions
daemons/qbittorrent

View file

@ -222,7 +222,7 @@ func (d *Daemon) syncTorrentState(ctx context.Context, file vfs.File, ih metainf
})
if err != nil {
d.log.Error(ctx, "error adding torrent", rlog.Error(err))
return err
return fmt.Errorf("error adding torrent: %w", err)
}
var props *qbittorrent.TorrentProperties
@ -247,7 +247,7 @@ func (d *Daemon) syncTorrentState(ctx context.Context, file vfs.File, ih metainf
// info := existing[0]
props, err := d.client.getProperties(ctx, ih.HexString())
if err != nil {
return err
return fmt.Errorf("error getting torrent properties: %w for infohash: %s", err, ih.HexString())
}
d.registeredTorrents.Add(props.Hash)
@ -256,7 +256,7 @@ func (d *Daemon) syncTorrentState(ctx context.Context, file vfs.File, ih metainf
log.Info(ctx, "moving torrent to correct location", slog.String("oldPath", props.SavePath))
err = d.qb.Torrent().SetLocation(ctx, []string{ih.HexString()}, torrentPath)
if err != nil {
return err
return fmt.Errorf("error moving torrent: %w", err)
}
}