casey / intermodal

A command-line utility for BitTorrent torrent file creation, verification, and more
https://imdl.io
Creative Commons Zero v1.0 Universal
487 stars 25 forks source link

Automatic splitting of output torrent files #498

Open mr-bo-jangles opened 3 years ago

mr-bo-jangles commented 3 years ago

Hey, this is more a feasibility questions than anything.

Currently with large batches of content we're having issues getting anything other than qbittorent to load the generated torrents while preserving the file list, the solution is to split. So if we're to split the torrents up we want to generate the minimum number of these files.

Is there the possibility of generating these automaticly split torrents that cover the same folder structure once the overall .torrent file gets too large?

casey commented 3 years ago

One good first step that we should definitely do is figure out exactly what the limiting factor is, and then add a lint for it. imdl has lints for a few things, like uneven piece length, small piece length, etc, which it will complain about if they're violated, but which you can disable if you want. I think this should definitely be a lint.

Do you know what exactly the limiting factor is? Is it the size of the .torrent file, the size of the pieces list, the number of files, or possibly something else?

I think there are two possible approaches here:

The former approach is much easier, and I can imagine it being used in other contexts. The latter approach is obviously much nicer, but probably also a more involved change.

In either case though, a lint would be a great place to start. If you don't mind doing some experimenting, and finding the specific limits, and which torrent clients have those issues, that would be a huge help.

mr-bo-jangles commented 3 years ago

So we're likely encountering multiple issues:

The first limit I've found is uTorrent with their limit of 65535 pieces per torrent file. "µTorrent won't open torrents with more than 65535 pieces by design"

The second limiting factor is the number of files per .torrent making it impractical to use the torrent with a webui which is common with torrent server setups. This may be negated by torrentv2?

The third limiting factor is probably just poor memory management for some torrent clients which choke/crash with larger .torrents

Being practical I'd guess that when the final .torrent size is getting over 4MB you're probably close to hitting one of these limits

casey commented 3 years ago

Lints should be relatively objective, so I think having more than 65535 pieces is good lint, since uTorrent is so popular. I'm not sure number of files or torrent size would make good lints, because I'm not sure what they should be set to.

I created #499 to track adding a piece-count lint.

I'm definitely in favor of adding automatic torrent splitting, although I'm not sure when/if I'll actually implement it myself.