Skip to content

Commit

Permalink
getPercent
Browse files Browse the repository at this point in the history
  • Loading branch information
cuu committed Dec 18, 2019
1 parent 864bea5 commit b554bce
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pyaria2.py
Expand Up @@ -134,6 +134,20 @@ def urlWaiting(self,url):

return None,False

def getPercent(self,url):
try:
resp = self.tellActive()
for i in resp:
uris = self.aria2.getUris(i["gid"])
for x in uris:
if x["uri"] == url:
pct = float(i["completedLength"]) / float( i["totalLength"])
pct = pct * 100.0
return int(pct)
except:
return None
return None

class Wsrpc(object):

MUTI_METHOD = "system.multicall"
Expand Down

0 comments on commit b554bce

Please sign in to comment.