Direction or Plugin: Context Menu Cross-Seeding

saroos1

Member
May 25, 2018
718
0
16
I think it'd be really cool to have a plugin that works simply by right-clicking on a torrent, hitting Cross-seed, and typing in a new tracker URL. It would handle changing the piecesize, and simply start seeding.

I would write this myself, but I can't find any beginner docs on how to write a plugin. Can I get some direction, or does someone else want to write this?
 

peshua19

Member
May 25, 2018
897
0
16
Okay, so I took some time to try to at least get a skeleton of this thing going... I'm trying to simply make a context menu item which opens a dialog, but the context menu item isn't showing up. Code can be found here.
 

simur612

Member
May 25, 2018
879
0
16
You need to overwrite theWebUI.createMenu and *inside it* add you item to menu. See plugin 'ratio' as example.
 

lisas4567

Member
May 25, 2018
773
0
16
Okay, this might be a really stupid question, but at this point I have a context menu, which, once clicked opens up a dialog box. The dialog box has an input for a tracker URL, and an OK / Cancel button.

Here's where I'm going form here:

1. I would like to pass along the piece size, data directory, and the entered tracker URL to my PHP file which...
2. Will run a mktorrent.sh script I have created, and move it to the...
3. Watch directory, which the path can be specified within an options menu.

Once I get to the PHP bit, I'm fine, but JS is really not my language. Can you point me to a good example of how I can get the piece size and data directory of the torrent, and how I should be passing this info to my PHP file?
 

peshua19

Member
May 25, 2018
897
0
16
You must obtain this info on the PHP side. Pass hash to server side, open .torrent file from session directory, and obtain piece size (see Torrent object in the php/Torrent.php).

Pass d.get_directory with torrent hash to rtorrent. From PHP. Via xmlrpc request (See php/xmlrpc.php).
Thanks once again. Is d.get_directory a part of _getdir, and if so how can I check that the plugin is enabled before setting up my plugin?