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

How to create own .torrent file without any external tools and using only BT lib #103

Open
vikulin opened this issue Dec 16, 2018 · 7 comments

Comments

@vikulin
Copy link

vikulin commented Dec 16, 2018

How to create own .torrent file without any external tools and using only BT lib. It would be great if anyone could add such example code.

@IriaSomobu
Copy link

Same question here. Found #92 so far, but that one about seeding, not torrent creation.

@atomashpolskiy
Copy link
Owner

Not possible atm, so you'll need to use an external tool. PRs welcome!

@IriaSomobu
Copy link

IriaSomobu commented Dec 16, 2019

Found SO question, but generated file makes BT stop work with following error:

bt.BtException: Validation failed for torrent metainfo:
1. Standard torrent model: [properties are required: [announce, info]]
2. Standalone info dictionary model: [properties are mutually exclusive: [[length], [files]]; properties are required: [length, files]; properties are required: [piece length, pieces]]
	at bt.metainfo.MetadataService.buildTorrent(MetadataService.java:124)
	at bt.metainfo.MetadataService.fromUrl(MetadataService.java:90)
	at bt.TorrentClientBuilder.fetchTorrentFromUrl(TorrentClientBuilder.java:277)
	at bt.TorrentClientBuilder.lambda$buildProcessingContext$0(TorrentClientBuilder.java:237)
	at bt.processor.torrent.FetchTorrentStage.doExecute(FetchTorrentStage.java:36)
	at bt.processor.torrent.FetchTorrentStage.doExecute(FetchTorrentStage.java:25)
	at bt.processor.TerminateOnErrorProcessingStage.doExecute(TerminateOnErrorProcessingStage.java:38)
	at bt.processor.RoutingProcessingStage.execute(RoutingProcessingStage.java:39)
	at bt.processor.ChainProcessor.doExecute(ChainProcessor.java:112)
	at bt.processor.ChainProcessor.executeStage(ChainProcessor.java:96)
	at bt.processor.ChainProcessor.lambda$process$0(ChainProcessor.java:81)
	at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1626)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

UPD: qBittorrent successfully parses this generated file

@atomashpolskiy
Copy link
Owner

We're being conservative over the format of metainfo and validate against the following schema: bt-core/src/main/resources/metainfo.yml.

Perhaps, we can relax the requirement for the announce key to be present. For other properties, I need to check the contents of the file that you've generated. For instance, properties are required: [piece length, pieces] message looks like a valid reason to fail the parsing of metainfo, because without these properties we won't be able to download the data anyways. It's weird that qBittorrent accepts the file, but maybe I'm missing something.

Can you post the file?

@IriaSomobu
Copy link

Here you are:
file.torrent.zip

@atomashpolskiy
Copy link
Owner

Try adding a bogus announce value.

@atomashpolskiy
Copy link
Owner

atomashpolskiy commented Dec 16, 2019

Yep, adding announce does the trick:

d8:announce8:http://a4:info...

So, there are three issues:

  • announce should be optional
  • validation should be more specific about the problem (currently it just dumps all the rules, even if only a single rule has been violated it's more subtle actually)
  • client should terminate properly on validation errors

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

3 participants