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

[BUG] Something dCan the project run directly? What I need is to get the metadata according to infohashoes not work as it should #195

Open
1083 opened this issue Oct 19, 2021 · 5 comments

Comments

@1083
Copy link

1083 commented Oct 19, 2021

Can the project run directly? What I need is to get the metadata according to infohash

@pyckle
Copy link
Collaborator

pyckle commented Oct 19, 2021

Hi,

What version are you using? Are you trying to download just the metadata file, or the entire torrent? What exact error are you getting?

I just fixed a minor bug that broke magnet link downloads in the latest snapshot. #196

I will merge it once the CI passes.

@1083
Copy link
Author

1083 commented Oct 20, 2021

At present, I only have infohash and hostname. port 。 Now I want to get the corresponding metadata. Which method do you need?

1 similar comment
@1083
Copy link
Author

1083 commented Oct 20, 2021

At present, I only have infohash and hostname. port 。 Now I want to get the corresponding metadata. Which method do you need?

@pyckle
Copy link
Collaborator

pyckle commented Oct 20, 2021

Hi, I think you'll need to write a bit of java code to do this.

First, create a torrent context with a Magnet URI. Some examples on how to do this:
https://github.com/atomashpolskiy/bt/blob/master/examples/src/main/java/peertracker/Main.java

MagnetUri magnetUri = MagnetUri.torrentId(torrent.getTorrentId()).tracker(announceKey.getTrackerUrl()).buildUri();

If the hostname/port you have are for a tracker, then you'll need to add it to the magnet URI. If the hostname/port you have are of a peer, the easiest way to bootstrap this peer is with a mock tracker. See: https://github.com/atomashpolskiy/bt/blob/master/examples/src/main/java/yourip/mock/MockTracker.java

When you build a torrent context, there is a callback for when the torrent is fetched:

public B afterTorrentFetched(Consumer<Torrent> torrentConsumer) {

You can write a callback method that writes the torrent to disk, and then stops the torrent.

@atomashpolskiy - perhaps this might be a good feature to have? When metadata is downloaded from a magnet link, have an option to persist it to disk.

@atomashpolskiy
Copy link
Owner

atomashpolskiy commented Oct 20, 2021 via email

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