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

Check for duplicate torrent #1082

Closed
andreapaiola opened this issue Mar 19, 2017 · 5 comments
Closed

Check for duplicate torrent #1082

andreapaiola opened this issue Mar 19, 2017 · 5 comments

Comments

@andreapaiola
Copy link
Contributor

@andreapaiola andreapaiola commented Mar 19, 2017

Duplicate torrent

https://andreapaiola.name/php-p2p-webtorrent-cdn/multi.php

Uncaught Error: Cannot add duplicate torrent 858155eb96db0008d9e0e720eb20d4db7dd18c77

How can I check if a torrent exists and use it to insert the content in the page? I think that could be useful to insert these in the documentation... thank you!

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Mar 19, 2017

Use client.get(torrentId) to see if the torrent is already part of the client.

https://github.com/feross/webtorrent/blob/master/docs/api.md#clientgettorrentid

@feross feross closed this Mar 19, 2017
@andreapaiola

This comment has been minimized.

Copy link
Contributor Author

@andreapaiola andreapaiola commented Mar 19, 2017

yeah, I use it... line 44... it doesn't work...

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Mar 19, 2017

If you add a torrent type that is async, like an http torrent file, then it's not possible for the client to know what the infohash of the torrent is until it has fetched the torrent file (an async operation). So if you call client.add twice with two torrent files that both have the same infohash, you'll get this error.

There's not an easy way for the webtorrent library to fix this issue.

@andreapaiola

This comment has been minimized.

Copy link
Contributor Author

@andreapaiola andreapaiola commented Mar 19, 2017

ummm maybe I can check the url of the .torrent file... I'll think about it

@lock

This comment has been minimized.

Copy link

@lock lock bot commented May 3, 2018

This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue.

@lock lock bot locked as resolved and limited conversation to collaborators May 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.