GithubHelp home page GithubHelp logo

Comments (6)

rakshasa avatar rakshasa commented on May 22, 2024

This is already possible with the load commands, just append any commands to call;

load_start="foo.torrent",print=$d.hash

from rtorrent.

blaenk avatar blaenk commented on May 22, 2024

@rakshasa: Beautiful, thanks :) I've traced around the source a bit but I can't figure out how rtorrent expects the example call you gave in xml. I am taking a look at rpc/parse_command.cc at the moment. Before, I saw in command_events.cc that apply_load takes the first argument as the torrent's path, and subsequent arguments as 'commands'. What I can't seem to figure out is how rtorrent expects those commands to be written. I have tried, for example, this:

<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
<methodName>load</methodName>
<params>
<param><value><string>thetorrent.torrent</string></value></param>
<param><value><string>print=$d.get_hash</string></value></param>
</params>
</methodCall>

The torrent loads (shows up in rtorrent), but rtorrent tells me Command on torrent creation failed: Could not find '='., the error message issued in parse_command.cc, so I'm clearly not forming my xmlrpc method call's extra commands correctly. Unfortunately my C++ expertise isn't quite at your level to make sense of the command parser. I will keep trying to figure it out, though I would surely appreciate any further help you can give.

I just came across this thread on the old issue tracker that helps a lot with other questions, but unfortunately doesn't go into the way the xml should be formed.

from rtorrent.

rakshasa avatar rakshasa commented on May 22, 2024

Should be 'print=$d.get_hash=' as there's a second command embedded.

from rtorrent.

blaenk avatar blaenk commented on May 22, 2024

@rakshasa: Wow! Indeed, I can't believe I kept trying and spending all that time for such a minor mistake that I should know by now. I guess it's time to take a break. Once again, thanks for your time in helping me with such a petty issue, who knows how much longer I would've spent trying this.

Just fixed that typo and indeed everything works beautifully. Now I can encapsulate all of the necessary logic into one call and rtorrent will automatically take care of calling it once the asynchronous torrent loading is done. Nice :)

Keep up the awesome work.

from rtorrent.

blaenk avatar blaenk commented on May 22, 2024

@rakshasa: Just a quick question, is there a difference between calling load and load_start aside from (my impression that) rtorrent starts the torrent once it's loaded with load_start? I tried doing load with extra calls as detailed in this issue. For example, a d.set_directory which did work (showed up in rtorrent to the directory I set), but I also wanted to finish off the extra commands with a d.start= to start the torrent, but it didn't seem to have any effect. I think I saw in the view that it was closed, inactive, so I did a d.open= before the start and the interesting thing is that the torrent then does show up as [OPEN], but still inactive. I thought maybe it was a bug that prevented the last command from being executed, but adding an extra d.start= at the end had no effect.

For the bigger picture:

<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
<methodName>load</methodName>
<params>
<param><value><string>thetorrent.torrent</string></value></param>
<param><value><string>d.set_directory=/some/dir</string></value></param>
<param><value><string>d.open=</string></value></param>
<param><value><string>d.start=</string></value></param>
</params>
</methodCall>

I do notice that the way core/download_factory.cc does it is by doing d.state.set with a parameter of 1, but is this only an internal command? Because I don't see it with system.listMethods. I kind of figured those mapped to d.start et al.

Would appreciate your insight. Thanks!

from rtorrent.

rakshasa avatar rakshasa commented on May 22, 2024

The download factory does some black magic (read; hacks that need to be cleaned up) in order to start the torrent, and as such use load_start and not d.start.

The d.state.set command is internal, and should not be called by the user at all.

from rtorrent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.