Share Pastebin
Guest
Public paste!

imagitronics

By: a guest | Feb 6th, 2009 | Syntax: Python | Size: 0.73 KB | Hits: 426 | Expires: Never
Copy text to clipboard
  1. host            = 'localhost'
  2. port            = '80'
  3. username        = 'admin'
  4. password        = 'admin'
  5. filename        = '../webui/ybox2.html'
  6.  
  7. from uTorrent import *
  8. #from zipfile import *
  9.  
  10. ut = uTorrent(host, port, username, password)
  11.  
  12. fn = open(filename, 'w')
  13. fn.write('\x0C')
  14. fn.write('\x04')
  15. fn.write('uTorrent download monitor'.center(40))
  16. fn.write('\x0C')
  17. fn.write('\x00')
  18. current_torrents = ut.webui_ls()
  19.  
  20. for torrent in current_torrents:
  21.         fn.write(torrent[UT_TORRENT_PROP_NAME][:35].ljust(36) + str(torrent[UT_TORRENT_STAT_P1000_DONE]/10).rjust(3) + '%')
  22.  
  23. for i in range(len(current_torrents), 10):
  24.         fn.write('                                        ')
  25.        
  26. fn.close()
  27.  
  28. #zipper = ZipFile('../webui.zip', 'a')
  29. #zipper.write(filename)
  30. #zipper.close()