Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.mkd
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ Set up the file `~/.config/putio-cli/config`, with the following contents:
[download]
user=YOUR_PUTIO_USERNAME
password=YOUR_PUTIO_PASSWORD
limitrate=0

The `[download]` section is optional, and is used only to retrieve files. If
you do not download files using `putio-cli`, then you don't need to fill this
section in.
section in.
You can add limiting bandwith with curl. If 0 it is not limited. The value is in bytes.

## Commands

Expand Down
12 changes: 9 additions & 3 deletions putio-cli
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
import sys, os, ConfigParser, time
import putio

Expand Down Expand Up @@ -131,6 +131,8 @@ def fetch_via_curl(url, target, item_name):
file_id = open(target, 'wb')

c.setopt(pycurl.USERPWD, dl_creds['user']+':'+dl_creds['password'])
if dl_creds['limitrate']:
c.setopt(c.MAX_RECV_SPEED_LARGE, dl_creds['limitrate'])
c.setopt(pycurl.WRITEDATA, file_id)
c.setopt(pycurl.NOPROGRESS, 0)
c.setopt(pycurl.FOLLOWLOCATION, 1)
Expand Down Expand Up @@ -214,8 +216,11 @@ def fetch(url, target, item_name):
def info(api, args=[]):
"""Display user information about available bandwidth and disk space"""
me = api.get_user_info()

print "Available bandwidth : %s/%s" % (putio.human_size(me.bw_quota_available), putio.human_size(me.bw_quota))

#print me.bw_quota
print "Name: %s" % (me.name)
print "Friends: %d" % (me.friends_count)
print "Your shared items: %d" % (me.shared_items)
print "Available disk space: %s/%s" % (putio.human_size(me.disk_quota_available), putio.human_size(me.disk_quota))

#-----
Expand Down Expand Up @@ -458,6 +463,7 @@ if __name__ == '__main__':
try:
dl_creds['user'] = config.get('download', 'user')
dl_creds['password'] = config.get('download', 'password')
dl_creds['limitrate'] = config.getint('download','limitrate')
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
dl_creds = {}

Expand Down
25 changes: 10 additions & 15 deletions putio.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,17 +341,13 @@ def __str__(self):
class User(BaseObj):
"""
Sample user:

u.name : 'aft'
u.friends_count : 497
u.bw_avail_last_month : '0'
u.bw_quota : '161061273600'
u.shared_items : 3
u.bw_quota_available : '35157040261'
u.disk_quota : '206115891200'
u.disk_quota_available : '158153510402'
u.shared_space : 0

u.shared_items : 3
u.mp4_rss : 'http://put.io/rss/mp4/...'
u.disk_quota : '206115891200'
u.disk_quota_available : '158153510402'
u.friends_count : 497
"""

def __init__(self, api, dictionary=None, **args):
Expand Down Expand Up @@ -845,14 +841,13 @@ def get_user_info(self):

Returned Attributes:

info.bw_quota
info.disk_quota
info.bw_quota_available
info.disk_quota_available
info.name
info.shared_space
info.friends_count
info.shared_items
info.mp4_rss
info.disk_quota
info.disk_quota_available
info.friends_count

"""

Expand Down Expand Up @@ -1974,4 +1969,4 @@ def __init__(self, api, dictionary=None, **args):
if __name__ == '__main__':

print "This file should not be executed."