jesec / flood

A modern web UI for various torrent clients with a Node.js backend and React frontend.
https://flood.js.org
GNU General Public License v3.0
2.18k stars 136 forks source link

Create a torrent in flood using mktorrent #49

Closed mirolm closed 3 years ago

mirolm commented 4 years ago

Type: Feature Request

Summary

Flood currently lacks a way to create a torrent. I think it was requested before but it was never implemented.

Idea of implementation

Torrent can be created relatively easy using the console utility mktorrent. If flood implements the frontend and then call mktorrent to do the actual work it can happen. After that the resulting torrent needs to be handled to rtorrent for the initial seeding.

Example of creating a torrent with mktorrent can be seen below:

mktorrent -a http://nyaa.tracker.wf:7777/announce -a udp://open.stealth.si:80/announce -a udp://tracker.opentrackr.org:1337/announce -a udp://tracker.coppersurfer.tk:6969/announce -a udp://exodus.desync.com:6969/announce -l 22 -o Sora_yori_mo_Tooi_Basho.torrent -n Sora\ yori\ mo\ Tooi\ Basho /media/lv2/download/rtorrent/Sora\ yori\ mo\ Tooi\ Basho/ -s https://horriblesubs.info

The only thing that is little trickly is the piece size - torrent should have between 1500 and 2500 pieces.

2^18 = 262 144 = 256 KiB for filesizes between 256 MB - 512 MB 2^19 = 524 288 = 512 KiB for filesizes between 512 MB - 1 GB 2^20 = 1 048 576 = 1024 KiB for filesizes between 1 GB - 2 GB 2^21 = 2 097 152 = 2048 KiB for filesizes between 2 GB - 4 GB 2^22 = 4 194 304 = 4096 KiB for filesizes between 4 GB - 8 GB 2^23 = 8 388 608 = 8192 KiB for filesizes between 8 GB - 16 GB 2^24 = 16 777 216 = 16384 KiB for filesizes between 16 GB - 512 GB

If there is an algoritm to automatically calculate the best piece size it will be great.

jesec commented 4 years ago

Related issue: https://github.com/Flood-UI/flood/issues/332

Fantastic idea. I think it is important to make it easier for uploaders to create torrents.

Technically it would be relatively straightforward to implement. However I would prefer a pure JS implementation like create-torrent for easier deployment, better maintainability and cross platform support. Piece size algorithm won’t be technically challenging in my opinion.

The most challenging part would be handling of long torrent creation time and as a result potential API (HTTP) request timeout imposed by the browser or other middleware (eg. nginx or express). UX-wise, users probably want to see a progress bar or see the process happens in background instead of waiting with a spinning icon.

I also found it challenging to find a perfect place in the frontend for this feature. The best solution I can think of currently is to add a “Create” tab to “Add Torrents” panel. I am concerned about the potential confusion, though. Do you have some better ideas?

mirolm commented 4 years ago

Adding another tab in "Add torrent" can be a solution, but it can confuse users which are not used to working with flood.

Another solution can be to add another button next to add and remove torrent with an icon for example "^" which can be close to upload visually.

jesec commented 4 years ago

Action bar buttons are for frequently used actions. We should not make it too bloated to avoid confusion. Majority of users probably won't frequently create torrents.

jesec commented 3 years ago

@mirolm

50 added the requested feature. Can you check it out? Is this issue still relevant?

mirolm commented 3 years ago

Tested with creating 2 torrents - one from file and one from folder. Both work fine.