SuprDewd / simpletracker

A minimal BitTorrent tracker written in PHP
MIT License
34 stars 14 forks source link

[REQUEST] Automatically add new torrent requests #15

Open QuixThe2nd opened 4 years ago

QuixThe2nd commented 4 years ago

If a torrent client announced from an unregistered torrent, automatically add it to the system.

Wiilf commented 3 years ago

Easy. If torrent_id not found then add conditional if check with a INSERT statement to a new 'requests' table. In the works.

QuixThe2nd commented 3 years ago

How would you go about getting the torrent metadata?

Wiilf commented 3 years ago

Do you mean add torrent to database or add torrent to client?

QuixThe2nd commented 3 years ago

Add torrent to database.

Wiilf commented 3 years ago

I would consult an API (check the one on YTS) and retrieve the data and import into database. It's best to roster these requests into a separate table named 'requests' and cycle through the rows on a cron task, while querying the API for meta result.. then scrape that content as a INSERT to torrents table. You must handle BLOB data so utilizing the bencode class appropriately.

If no matching clause is retrieved from API endpoint, then torrent is not found and we continue; the iteration until complete. Be sure to remove matched request rows while retaining request rows for content not found.