Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple file mode #1

Open
supersaeyan opened this issue Jul 10, 2018 · 1 comment
Open

Multiple file mode #1

supersaeyan opened this issue Jul 10, 2018 · 1 comment

Comments

@supersaeyan
Copy link

supersaeyan commented Jul 10, 2018

I am trying to make a similar client but i just realized this client is only going to work for single file torrents.

The whole torrent, regardless of the number of files, is divided into pieces.

Now in the case of a single file torrent, the number of pieces can be calculated by taking the size of the metaData[b'info'][b'length'] key and divide it by piece length and then take the ceil of it for the last, smaller piece.

But in case of the multiple files, the pieces are still dividing the whole torrent regardless of the number of files.

But correct me if i am wrong, wouldn't you calculate the number of pieces for each file and not the whole torrent. Current implementation would write multiple files to a single file where some blocks would have some data from previous and other data from the next file.

Am i missing something here ?

Also, if i was to implement this, should i consider the files in the order that is given in the metadata[b'info'][b'files'] to calculate pieces for each file ?

@SimplyAhmazing Great work by the way.

@supersaeyan
Copy link
Author

If anyone is looking for this as desperately as i was looking,
Have a look at my fix https://github.com/supersaeyan/bittorpy/blob/master/file_saver.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant