Beispiel #1
0
 def do_status(self, *args):
     "Display rtorrent status"
     status = RTorrent().get_status()
     if status['rpc']:
         print "Version    rtorrent %s/%s" % (status['client_version'], status['library_version'])
         print "Server     %s" % status['server']
         print "Rate       \xe2\x86\x93%s/s \xe2\x86\x91%s/s" % (filesizeformat(status['down_rate']), filesizeformat(status['up_rate']))
         print "UP Time    %s" % duration(status['up_time'])
         print "Space Left %s on %s" % (filesizeformat(status['free']), config.root_dir)
     else:
         print "No rtorrent found on %(server)s" % status
Beispiel #2
0
 def do_list(self, args):
     "List current torrents"
     torrents, _ = RTorrent().today()
     for t in torrents:
         print "%s (%s)" % (t.name, "%s..%s" % (t.hash[:5], t.hash[-5:]))
         print "  %5s %3d%%" % (t.status.upper(), t.percent),
         if t.complete:
             print "%s" % filesizeformat(t.size),
         else:
             print "%s of %s" % (filesizeformat(t.completed), filesizeformat(t.size)),
         if hasattr(t, 'files') and len(t.files) > 1:
             print "in %d files" % len(t.files),
         if t.complete and t.is_active:
             print "\xe2\x86\x91%s/s to %d peers" % (filesizeformat(t.up_rate), t.peers_connected),
         if t.is_active and not (t.complete or t.hashing):
             print "\xe2\x86\x93%s/s from %d peers%s" % (filesizeformat(t.down_rate), t.peers_connected, " - %s left" % t.eta if hasattr(t, 'eta') else '')
         else:
             print "- Completed %s" % as_age(t.finished) if hasattr(t, 'finished') else ("- Started %s" % as_age(t.inserted_new) if hasattr(t, 'inserted_new') else '')
Beispiel #3
0
def about():
    """Render about page."""
    stats = {}
    stats['created'] = 0
    stats['downloaded'] = 0
    stats['active'] = 0
    stats['data_upload'] = 0
    for stat in db.session.query(models.Stat):
        stats[stat.name] = stat.value
    stats['data_upload'] = filesizeformat(stats['data_upload'])
    if stats['active'] == 0:
        stats['active'] = "Idle"

    return render_template('about.html', stats=stats)
Beispiel #4
0
 def display_history(self, history):
     for t in history:
         print "%(name)s" % t
         file_size = ""
         if 'total_size' in t:
             file_size = "%s" % filesizeformat(t['total_size'])
             if len(t['files']) > 1:
                 file_size += " in %d files" % len(t['files'])
         if 'finished' in t:
             print "   %s%sCompleted %s" % (file_size, " - " if file_size else '', as_age(t['finished']))
         elif 'inserted_new' in t:
             print "   %s%sStarted %s" % (file_size, " - " if file_size else '', as_age(t['inserted_new']))
         elif file_size:
             print "   %s" % file_size
Beispiel #5
0
 def do_queue(self, args):
     "Handle the torrent queue\nqueue [push <torrent>|remove <torrent>]"
     args = shlex.split(args)
     if not args:
         for t in RTorrent().get_queue():
             print "%s" % t.basename
             print "  %s%s - %s old" % (filesizeformat(t.total_size), ' in %d files' % len(t.files) if len(t.files) > 1 else '', duration(t.date))
     elif len(args) == 2 and args[0] == 'push':
         RTorrent().push(args[1])
         print "Pushed '%s'" % args[1]
     elif len(args) == 2 and args[0] == 'remove':
         RTorrent().unqueue(args[1])
         print "Removed '%s' from queue" % args[1]
     else:
         self.error("malformed command, try 'help queue'")