Pass additional options to transmission-remote

Issue #10 resolved
Johnny Depp created an issue

leech-transmission

From:

TRANSMISSION_OPTS=

[ ! -z "$HOST_PORT" ] && TRANSMISSION_OPTS="$TRANSMISSION_OPTS "$HOST_PORT""
[ ! -z "$USERNAME_PASSWORD" ] && TRANSMISSION_OPTS="$TRANSMISSION_OPTS -n "$USERNAME_PASSWORD""
[ ! -z "$LEECH_TARGET_DIR" ] && TRANSMISSION_OPTS="$TRANSMISSION_OPTS -w "$LEECH_TARGET_DIR""

exec transmission-remote $TRANSMISSION_OPTS -a "$LEECH_URL"

To:

TRANSMISSION_OPTS=

[ ! -z "$HOST_PORT" ] && TRANSMISSION_OPTS="$TRANSMISSION_OPTS "$HOST_PORT""
[ ! -z "$USERNAME_PASSWORD" ] && TRANSMISSION_OPTS="$TRANSMISSION_OPTS -n "$USERNAME_PASSWORD""
[ ! -z "$LEECH_TARGET_DIR" ] && TRANSMISSION_OPTS="$TRANSMISSION_OPTS -w "$LEECH_TARGET_DIR""

ADDITIONAL_OPTS=

[ ! -z "$OPTIONS" ] && ADDITIONAL_OPTS="$OPTIONS"

exec transmission-remote $TRANSMISSION_OPTS -a "$LEECH_URL" $OPTIONS

For use with leech-defmission and leech-transmission. See 'transmission-remote -h' or 'man transmission-remote' for available options. For example, to set seed a ratio of 3 and bandwidth priority to high:

OPTIONS="-sr 3 -Bh"

Regardless if you accept this, thank you for creating leech!

Comments (10)

  1. Aleksey Tulinov repo owner

    What do you think if i remove

    TRANSMISSION_OPTS=
    

    instead. Then you could run leech as TRANSMISSION_OPTS="-sr 3 -Bh" /usr/sbin/leech. Would it work for you?

    Modified recipe can be downloaded here (branch transmission in Git).

  2. Johnny Depp reporter
    • changed status to open

    Removing TRANSMISSION_OPTS doesn't work. I didn't test well enough before. It seems to only work when the options are passed after the URL like in the example I first posted.

  3. Aleksey Tulinov repo owner

    Could you give me some more info: 1) how you're launching leech (preferably copy-paste of command line) 2) what is the error message displayed when you run unmodified recipe.

    You can also try to invoke leech-transmission directly, for example

    $ TRANSMISSION_OPTS="--start-paused" LEECH_DOWNLOADS_DIR=. LEECH_URL="..." ./sbin/leech-transmission 172.16.0.1:9091
    172.16.0.1:9091/transmission/rpc/ responded: "success"
    172.16.0.1:9091/transmission/rpc/ responded: "success"
    

    LEECH_URL could be any URL including magnets, LEECH_DOWNLOADS_DIR doesn't really matter here but required. 172.16.0.1:9091 is host:port of running transmission. And this should add URL to the list of downloads (paused).

    Doesn't it work for you? If it doesn't, could you please also let me know 1) what error message do you see when invoking leech-transmission 2) what's your shell: echo $SHELL 3) what's you shell version: probably $SHELL --version 4) what's your transmission-remote version: transmission-remote --version.

    Thanks.

  4. Johnny Depp reporter

    The additional TRANSMISSION_OPTS functions are the only part not working.

    Here’s how I confirmed:

    $ transmission-remote -sr 3 -a http://releases.ubuntu.com/17.04/ubuntu-17.04-desktop-amd64.iso.torrent
    No torrent specified!  Please use the -t option first.
    localhost:9091/transmission/rpc/ responded: "success"
    localhost:9091/transmission/rpc/ responded: "success"
    

    The torrent is added but the seed ratio is not changed.

    However if I pass the following the seed ratio is changed:

    $ transmission-remote -a http://releases.ubuntu.com/17.04/ubuntu-17.04-desktop-amd64.iso.torrent -sr 3
    localhost:9091/transmission/rpc/ responded: "success"
    localhost:9091/transmission/rpc/ responded: "success"
    

    The info you requested:

    $ TRANSMISSION_OPTS="--start-paused" LEECH_DOWNLOADS_DIR=. LEECH_URL="http://releases.ubuntu.com/17.04/ubuntu-17.04-desktop-amd64.iso.torrent" /usr/sbin/leech-transmission localhost:9091
    localhost:9091/transmission/rpc/ responded: "success"
    

    The torrent is not paused.

    $ echo $SHELL
    /bin/bash
    
    $ transmission-remote --version
    transmission-remote 2.92 (14714)
    

    I hope this helps.

  5. Aleksey Tulinov repo owner

    I think i see the problem. Apparently -sr 3 doesn't know what torrent to apply ratio to. Although i'm not sure why --start-paused didn't work, maybe this changed in 2.92.

    You could try recipe from 0692f4b, it's here (plain text). It will put $TRANSMISSION_OPTS after -a option.

  6. Johnny Depp reporter

    That works great and moving -w after the URL makes sense.

    transmission-remote [host:port | host | port] [-a filenames-or-URLs] [followed by all other options]
    

    This is how the man pages for both 2.84 and 2.92 read, so I don't think anything has changed and I don't think it'll cause problems for others. Thanks again for adding this!

  7. Aleksey Tulinov repo owner

    For some reason --start-paused worked independently from position in command line in 2.82, this is why i assume something related might have changed in later versions.

    Anyway thank you for looking into this. Updated recipe is going to be included into next release. Release ETA is couple of weeks from now if nothing else pops up.

  8. Log in to comment