These are chat archives for anacrolix/torrent

4th
Jan 2018
deranjer
@deranjer
Jan 04 2018 19:43

@elgatito Thanks, I did the following

fileRead := singleTorrent.NewReader()
fileRead.Seek(file.Offset(), 0)
fileRead.SetReadahead(file.Length())

I'm hoping that will set a singular file for prioritized download.

Although not 100% sure about the Seek command will need to do some testing on it first.

Denis
@elgatito
Jan 04 2018 19:51
Yupp, that is perfect
Reader readahead has priority over regular Download() pieces
deranjer
@deranjer
Jan 04 2018 19:52
Still mulling over the best way to cancel a reader, that is the next challange
but I assume since that is a reader that would give me a lot of flexibility for the future if I wanted to incorporate streaming?
Denis
@elgatito
Jan 04 2018 21:57
Jusr do reader.close(), it will restore priorities
deranjer
@deranjer
Jan 04 2018 22:32
@elgatito Yes but my client is built to persist settings across restarts, but shouldn't be that hard, just store a string in the DB with priority and on restart check the priority of all files and set them accordingly by opening readers and storing the readers somewhere while client is running and then closing the correct reader when user requests a priority change