Opened 8 years ago

Closed 8 years ago

#5621 closed Enhancement (fixed)

Ratio vs Ratio Limit in transmission-remote

Reported by: anaximander Owned by:
Priority: Normal Milestone: 2.83
Component: Transmission Version: 2.82
Severity: Trivial Keywords: transmission-remote, ratio vs limt, ratio limit,


I noticed something that seems odd to me, and so I have searched through your tickets, but can't find anything that really addresses it. I'm submitting this as an enhancement because it's only hindering my script and is easily fixed by not setting an extremely odd ratio limit.

I have Transmission 2.82 on a headless server. I connect to it from my various computers with Transmission Remote GUI 4.1 (transgui). Within transgui, I can set per torrent ratios such as 1.15, and transgui will display the ratio as 1.150 (3 decimal places). In the instance I'll show you, I set it to 0.15. Transmission itself stops when the torrent reaches 0.150 in transgui.

Now, the oddness (at least to me). Running transmission-remote -t ID -i, I get information like this:

  Id: 1
  Name: Torrent Name
  Hash: Torrent Hash
  Magnet: Torrent Magnet Link

  State: Finished
  Location: Location of Torrent
  Percent Done: 100%
  ETA: 0 seconds (0 seconds)
  Download Speed: 0 kB/s
  Upload Speed: 0 kB/s
  Have: 2.23 GB (2.23 GB verified)
  Availability: 100%
  Total size: 2.23 GB (2.23 GB wanted)
  Downloaded: 2.23 GB
  Uploaded: 380.4 MB
  Ratio: 0.1        <============= 1 decimal place for Ratio
  Corrupt DL: None
  Peers: connected to 0, uploading to 0, downloading from 0

  Date added:       Thu Feb 27 18:01:14 2014
  Date finished:    Thu Feb 27 18:26:39 2014
  Date started:     Fri Feb 28 18:08:52 2014
  Latest activity:  Fri Feb 28 18:24:10 2014
  Downloading Time: 25 minutes (1556 seconds)
  Seeding Time:     34 minutes (2069 seconds)

  Public torrent: Yes
  Piece Count: 532
  Piece Size: 4.00 MiB

  Download Limit: Unlimited
  Upload Limit: Unlimited
  Ratio Limit: 0.10 <============= 2 decimal places for Ratio Limit
  Honors Session Limits: Yes
  Peer limit: 60
  Bandwidth Priority: Normal

I have a script that compares the Ratio to the Ratio limit to determine if the torrent is complete (complete download, complete seed = move torrent to rsync folder, delete from transmission), or downloaded but failed to reach the ratio limit (complete d/l, ratio < ratio limit for x days = stop the torrent, move to rsync folder and delete from transmission). As a result of the single decimal in the ratio, if I set the ratio limit to x.yz where 9 >= z >= 0, then my script fails on that torrent.

So, my question is, transgui, and other gui interfaces can set ratio limit to 2 decimal places, transmission respects the ratio limit, so why does transmission-remote display a single decimal for the ratio? Is this by design? Am I missing an easy configuration setting to make Ratio display 2 decimal points?

I'm not up on how to submit a change or even make the change work on my system, other wise I'd hunt through the code and see if I can find it.

Thank you for your time.

Change History (5)

comment:1 Changed 8 years ago by rb07

I agree about the number of decimals ratios should show.

The specific change which created the discrepancy you showed, and how ratios are shown in Transmission-Qt for instance (I guess in all the GUI clients) was made by treating ratios as percentages, which they are not, in

I've changed that part of the code long ago, using this modification:

--- libtransmission/utils.c     (revision 14242)
+++ libtransmission/utils.c     (working copy)
@@ -1526,7 +1558,7 @@
   else if ((int)ratio == TR_RATIO_INF)
     tr_strlcpy (buf, infinity, buflen);
-    tr_strpercent (buf, ratio, buflen);
+    tr_strtruncd (buf, ratio, 2, buflen);

   return buf;

comment:2 Changed 8 years ago by cfpp2p

The "1 decimal place for Ratio" stems from changeset r13895 (only show ratios to one decimal place).

I'd be interested in knowing why you are not using configuration settings script-torrent-done-enabled and script-torrent-done-filename instead of your comparison script but that's aside from the point.

To make Ratio display 2 decimal points I simply reverted r13895.

rb07's modification may work as well, but I didn't test it.

comment:3 Changed 8 years ago by anaximander

Well, it sounds as if the script-torrent-done-enabled would take care of torrents that finish d/l and hit the seed ratio. And, it would certainly make it not a big deal one off ratio. I may be wrong in that, but that seem to be what the settings say it does. This would be fine for about a forth of my script.

My entire script checks each torrent, then performs actions based on one of four criteria.

  1. Torrent d/l'd and seeded completely
    1. yes. Move complete torrent
    2. no. Leave active
  2. Torrent d/l'd, but not finished seeding
    1. Has torrent had any activity over xx days
      1. yes. leave active
      2. no. move complete torrent
  3. Torrent not completely d/l'd
    1. Has torrent had any activity over xx days
      1. yes. leave active
      2. no.
        1. are any files completely d/l'd
          1. yes. move those files
          2. no. delete torrent and remove contents

It was just easier to through in the two extra lines to take care of the completed torrents than to have two different scripts.

If I'm wrong about the script-torrent-done-* set's I'd be interested in knowing that though. It just seems that if I have two torrents that are hung, my script will handle it when the script-torrent-done settings won't be activated.

comment:4 Changed 8 years ago by jordan

To add yet a third opinion to this.. the inconsistency is coming from tr_strratio() using one rule for precision, and some (but not all) of remote.c using its own rules (eg, printf(" Ratio Limit: %.2f\n");).

We could also fix it by removing the %.2f style code from remote.c and replacing it with tr_strratio(). That fix has the added benefit of increasing both API and display consistency.

For example both rb07 and cfpp2p's customizations would work on top of this too.

comment:5 Changed 8 years ago by jordan

  • Milestone changed from None Set to 2.83
  • Resolution set to fixed
  • Status changed from new to closed

comment:4 changes added in r14263.

Note: See TracTickets for help on using tickets.