xonglennao / transdroid

Automatically exported from code.google.com/p/transdroid
GNU General Public License v3.0
0 stars 0 forks source link

File priorities set incorrectly in deluge #457

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
Attempt to set a file to the highest priority. It will instead be set to the 
second highest priority.

The UI in transdroid also names the priorities differently, but that is beside 
the point.
Transdroid  |  Deluge
Off         |  Off
Low         |  Normal
Normal      |  High
High        |  High (incorrect, should be "Highest")

In transdroid there is a visual distinction made between "Normal" and "High" (2 
arrows vs. 3 arrows), but both result in the same priority in Deluge.

What version of the product are you using?
Transdroid 1.1.10

What torrent client are you using?
Deluge 1.3.5

Original issue reported on code.google.com by cjmal...@gmail.com on 20 Feb 2013 at 10:17

GoogleCodeExporter commented 8 years ago
There is indeed a small mapping necessary between Deluge and Transdroid, as you 
point out correctly.

It seems to work fine here, though, tested against Deluge 1.3.1. Perhaps Deluge 
changes the 'number' behind the priorities? Here is what I use:
Transdroid  |  Deluge   | Number
Off         |  Off      | 0
Low         |  Normal   | 1
Normal      |  High     | 2
High        |  Highest  | 5

Unfortunately I don't have a newer Deluge set up right now to test against.

Original comment by erickok@gmail.com on 21 Feb 2013 at 10:05

GoogleCodeExporter commented 8 years ago
This is pulled from the tag "deluge-1.3.2" of their git repository:

#file path: root/deluge/common.py:71
FILE_PRIORITY = {
    0: "Do Not Download",
    1: "Normal Priority",
    2: "High Priority",
    5: "Highest Priority",
    "Do Not Download": 0,
    "Normal Priority": 1,
    "High Priority": 2,
    "Highest Priority": 5
}

This is the HEAD:

#file path: root/deluge/common.py:105
FILE_PRIORITY = {
    0: "Do Not Download",
    1: "Normal Priority",
    2: "High Priority",
    3: "High Priority",
    4: "High Priority",
    5: "High Priority",
    6: "High Priority",
    7: "Highest Priority",
    "Do Not Download": 0,
    "Normal Priority": 1,
    "High Priority": 5,
    "Highest Priority": 7
}

It appears the numbers have been changed since version 1.3.3. The commit 
message was "Adjust file priorities to make Highest actually the highest 
allowed by libtorrent and High has been changed to what Highest was" 
(http://git.deluge-torrent.org/deluge/commit/?id=71f9ef64996d9afbc615011ed2cb844
83915e435)

Original comment by cjmal...@gmail.com on 21 Feb 2013 at 10:36

GoogleCodeExporter commented 8 years ago
Ah, very useful, thanks! But also a bit depressing because how am I now 
supposed to know what number to send (as I want/need to stay backwards 
compatible)... 

Ugh... Deluge doesn't even report a version number in the web UI. The only 
thing that I can come up with is retrieve the /js/deluge-all.js file, search 
this huge Javascript file for the string ':"Highest Priority"' and parse the 
number from there. That is really bulky, cumbersome, tedious and should be very 
unnecessary.

Sorry for the rand - it's certainly not your (or any user's) fault! Any better 
ideas perhaps? Thanks again for the research.

Original comment by erickok@gmail.com on 21 Feb 2013 at 11:09

GoogleCodeExporter commented 8 years ago
Yeah I couldn't find any good documentation either which is why I resorted to 
looking at the repo. While in there I noticed a python script for "generating 
documentation". Might be worth checking out (path: 
root/deluge/scripts/wiki_docgen.py).

Submitting a patch to deluge for a version number API would be a good idea.. 
unfortunately that is no help for older versions of deluge.

In deluge 1.3.2 or lower if you set the priority to 7 will it accept it as 
"Highest Priority"? If so you may get it to work without the need to query the 
server for it's version number.

Original comment by cjmal...@gmail.com on 21 Feb 2013 at 11:20

GoogleCodeExporter commented 8 years ago
Yes, but parsing will still be off as a number 5 could mean High or Highest 
(given that there isn't a 2 or 7 in the list as well). And yes, a version 
number would be good, but it's too late for that. In their defence the JSON API 
was solely developed as web interface API, but still... 

Ugh... why did they pick 5 for the new High? That kind of messes everything up. 
:-S

Okay, here my proposal. We request a new 'feature' that the API (or even 
visibly in the web interface) the Deluge version is returned, preferable as 
easily parse-able integer. In the meantime I can (once every time Transdroid 
'starts') request the / page which is HTML and has the version number in the 
<title> tag. Still cumbersome, but better than nothing. That looks something 
like:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Deluge: Web UI 1.3.1</title>
... etc.

This is similar to how I need to parse qBittorrent's version number: 
http://code.google.com/p/transdroid/source/browse/lib/src/org/transdroid/daemon/
Qbittorrent/QbittorrentAdapter.java#89

Original comment by erickok@gmail.com on 21 Feb 2013 at 11:39

GoogleCodeExporter commented 8 years ago
This is what I meant:

Transdroid  |  Deluge   | Number
Off         |  Off      | 0
Low         |  Normal   | 1
Normal      |  High     | 2
High        |  Highest  | 7

We just completely ignore 5.

Original comment by cjmal...@gmail.com on 21 Feb 2013 at 11:57

GoogleCodeExporter commented 8 years ago
That might (I haven't checked) work for the setting of priorities. But now 
assume I retrieve from the server a file that has priority 5. Is this High or 
Highest? I can't tell without knowing which Deluge version is running. If < 
1.3.3 then 5 will mean High, but if >= 1.3.3 then 5 will mean Highest.

So:
Deluge        | Number  | Transdroid
Off           | 0       | Off
Normal        | 1       | Low
High          | 2       | Normal
High/Highest  | 5       | ?
Highest       | 7       | Highest

Original comment by erickok@gmail.com on 21 Feb 2013 at 12:03

GoogleCodeExporter commented 8 years ago
5 should always be Highest because the new versions of deluge should never use 
5 at all. Will need to be tested but that's what my guess is from glancing at 
the code. 

Original comment by cjmal...@gmail.com on 21 Feb 2013 at 2:08

GoogleCodeExporter commented 8 years ago
I just tested but at least with Deluge 1.3.5 that I tested a file with High is 
marked 5. :(

Original comment by erickok@gmail.com on 21 Feb 2013 at 2:18

GoogleCodeExporter commented 8 years ago
Too bad. Looks like you need a version number. 

Original comment by cjmal...@gmail.com on 21 Feb 2013 at 2:23