Open vikulin opened 5 years ago
Same question here. Found #92 so far, but that one about seeding, not torrent creation.
Not possible atm, so you'll need to use an external tool. PRs welcome!
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
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?
Here you are: file.torrent.zip
Try adding a bogus announce value.
Yep, adding announce does the trick:
d8:announce8:http://a4:info...
So, there are three issues:
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.