frostwire/frostwire-jlibtorrent

No file is created while downloading

Closed this issue · 5 comments

Hello,

For some torrents, seems that even if the progress changes, there is no file created:

public TorrentInputStream getVideoStream() throws FileNotFoundException {
File file = getVideoFile();
TorrentInputStream inputStream = new TorrentInputStream(this, file);
torrentStreamReferences.add(new WeakReference<>(inputStream));
return inputStream;
}
This function will throw a FileNotFoundException but onStreamProgress is reporting that it is still downloading (in some cases more than 30% total file download but no file is actually created).

you might want to want to share the code in getVideoFile()

Hello,

This is it.

public File getVideoFile() {
Log.e(TAG, "getVideoFile(): torrentHandle save path = " + torrentHandle.savePath());
return new File(torrentHandle.savePath() + "/" +
torrentHandle.torrentFile().files().filePath(selectedFileIndex));
}

Strange thing is that this issue is maybe 80% reproducible. The same code 20% of the time creates that file. When the files are no created, i can see that some .part files are created instead.

The torrent contains just 1 single file so I doubt that is the case :)

sounds like you haven't really checked the pieces are there.

libtorrent will usually save those pieces elsewhere and then at the end they will be at the location you are trying to open the file.

You need to use the piece checker to make sure the torrent has finally downloaded and assembled into the target file.