开发者

Uploading files to server form torrent

开发者 https://www.devze.com 2023-02-12 05:25 出处:网络
I am looking information about how to upload files to a server b开发者_高级运维y uploading just .torrent files related to files I actually wan to upload to server.

I am looking information about how to upload files to a server b开发者_高级运维y uploading just .torrent files related to files I actually wan to upload to server.

I am looking for a way to do it by programming...

Thanks for your answers in advance.

EDIT: OK I will try to emplane it.

Lets just say that user creates a torrent file and starts to seed it. Then he uploads file.torrent file to my website and from that .torrent file the seeded files a downloaded to my server. I imagine this happening in two ways:

  1. The files are downloaded from the torrent stream (that is from many other users seeding the file)
  2. The script figures out where on my users machine the file is and then uploads it.


First, you have to install a torrent client on your server. Deluge and rTorrent are good options for server operations. rTorrent is famous for it's high-performance seeding, while Deluge's underlying libtorrent-rasterbar is more up-to-date with bittorrent protocol specs thus performing better for leeching. Both of them provide APIs for integration with third-party tools.

When you install the torrent client, you can activate a download by 2 alternative methods: ether putting the users' .torrent files into Deluge/rTorrent's watch directory, or using their respective APIs to add the new torrent to their session.

Have in mind possible duplicate of torrent names - even different torrents can claim same file- or directory name ({info}{name} property from .torrent file), often leading to corrupted data for both torrents.

You have different ways to deal with this situation depending on the use of downloaded data. If you need to continue seeding the data after you get 100% of it, than you can either reject the next torrent with the same {info}{name} field, or you have to patch your torrent client in order to store the data under unique name (torrent's info-hash seems a good choice). If you don't want to become a seeder, when finished, remove the the torrent from Deluge/rTorrent's session (API call. Removing .torrent file from the watch directory works only for rTorrent AFAIK) and move the actual data downloaded to a new place under new name (again, info-hash is a good choice).

0

精彩评论

暂无评论...
验证码 换一张
取 消