Update of /cvsroot/btplusplus/BT++/src/DlgAddTor
In directory sc8-pr-cvs1:/tmp/cvs-serv19487/src/DlgAddTor
Modified Files:
DlgAddTor.py
Log Message:
- Fixed core bug.
- Modified 'AddTorrent' downloading.
- History shows uploaded (transfered) MB.
- Fixed bug in right-click-menu of the history tab.
- Corrected some of the grid info display.
Index: DlgAddTor.py
===================================================================
RCS file: /cvsroot/btplusplus/BT++/src/DlgAddTor/DlgAddTor.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** DlgAddTor.py 28 Mar 2003 14:47:26 -0000 1.3
--- DlgAddTor.py 31 Mar 2003 14:15:27 -0000 1.4
***************
*** 5,8 ****
--- 5,9 ----
from urlparse import urlparse
from urllib import urlopen, unquote
+ from threading import Thread
class DlgAddTor(wxDialog):
***************
*** 64,105 ****
elif self.UrlRadio.GetValue() == true:
!
url = self.UrlText.GetLabel()
-
if url != '':
! try:
! while(1):
! url = unquote(url)
! if url == unquote(url):
! break
! h = urlopen(url)
! if url.startswith('http'):
! i = str(h.info())
! s = i.find('filename') + 9
! e = i.find('\n', s) - 1
! if s == 8:
! spl = urlparse(url)
! file = path.split(spl[2])[1]
! else:
! file = i[s:e]
! else:
! spl = urlparse(url)
! file = path.split(spl[2])[1]
! if file == '':
! raise
!
! data = h.read()
! h.close()
! f = open( path.join(Config.Get('Paths', 'Torrent'), file), 'wb' )
! f.write( data )
! f.close()
! except:
! wxMessageBox("Couldn't download the torrent to the BT++ torrent directory.")
! self.EndModal(0)
--- 65,113 ----
elif self.UrlRadio.GetValue() == true:
!
url = self.UrlText.GetLabel()
if url != '':
! thr = Thread( target = DownloadTorrent, args=[url] )
! thr.setDaemon(false)
! thr.start()
! else:
! wxMessageBox("Couldn't download the torrent to the BT++ torrent directory.")
!
! self.EndModal(0)
!
! def DownloadTorrent(url):
! try:
! while(1):
! url = unquote(url)
! if url == unquote(url):
! break
! h = urlopen(url)
! if url.startswith('http'):
! i = str(h.info())
! s = i.find('filename') + 9
! e = i.find('\n', s) - 1
! if s == 8:
! spl = urlparse(url)
! file = path.split(spl[2])[1]
! else:
! file = i[s:e]
!
! else:
! spl = urlparse(url)
! file = path.split(spl[2])[1]
! if file == '':
! raise
! data = h.read()
! h.close()
! f = open( path.join(Config.Get('Paths', 'Torrent'), file), 'wb' )
! f.write( data )
! f.close()
! except:
! wxMessageBox("Couldn't download the torrent to the BT++ torrent directory.")
|