These are chat archives for anacrolix/torrent

17th
Mar 2018
Matt Joiner
@anacrolix
Mar 17 2018 01:26
Are you calling Torrent.DownloadAll somewhere? Assuming there's no bugs, it's got to be either piece priorities, or a Reader
deranjer
@deranjer
Mar 17 2018 03:08
@anacrolix In both cases the downloadall is called BEFORE i set priorities... or does it not work that way? To my knowledge I'm not using a reader.
Matt Joiner
@anacrolix
Mar 17 2018 04:53
yeah it doesn't work that way: see the comment: https://godoc.org/github.com/anacrolix/torrent#Torrent.DownloadAll
if that's what you're doing i think we have found the problem, phew
deranjer
@deranjer
Mar 17 2018 13:49
@anacrolix Curious about how I do priorities then. When I first add the torrent I DO want to download all, but obviously that could change. Should I use downloadpieces then, and just specify all pieces, and then will that allow me to do priorities?
Matt Joiner
@anacrolix
Mar 17 2018 14:20
@deranjer Download all just sets all pieces to normal priority. So unset the piece priorities after you switch over to your file-based priorities
deranjer
@deranjer
Mar 17 2018 14:37
@anacrolix I thought I was doing that...
clientTorrent.DownloadAll()
    for _, singleFile := range clientTorrent.Files() { //setting all of the file priorities to normal
        singleFile.SetPriority(torrent.PiecePriorityNormal)
    }
deranjer
@deranjer
Mar 17 2018 14:59
Then in my api:
if file.Path() == sentFile {
                                    switch priorityRequested {
                                    case "High":
                                        priorityString = "High"
                                        file.SetPriority(torrent.PiecePriorityHigh)
                                    case "Normal":
                                        priorityString = "Normal"
                                        file.SetPriority(torrent.PiecePriorityNormal)
                                    case "Cancel":
                                        priorityString = "Cancel"
                                        file.SetPriority(torrent.PiecePriorityNone)
                                    default:
                                        priorityString = "Normal"
                                        file.SetPriority(torrent.PiecePriorityNormal)
                                    }