Update of /cvsroot/btplusplus/BT++/src/DlgAddTor
In directory sc8-pr-cvs1:/tmp/cvs-serv4960/src/DlgAddTor
Modified Files:
DlgAddTor.py
Log Message:
- Fixed problem with spaces.
- Improved downloading code.
Index: DlgAddTor.py
===================================================================
RCS file: /cvsroot/btplusplus/BT++/src/DlgAddTor/DlgAddTor.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** DlgAddTor.py 19 Feb 2003 20:52:49 -0000 1.1
--- DlgAddTor.py 10 Mar 2003 18:44:51 -0000 1.2
***************
*** 4,9 ****
from shutil import copyfile
from urlparse import urlparse
! from urllib import unquote
! from urllib2 import urlopen
class DlgAddTor(wxDialog):
--- 4,8 ----
from shutil import copyfile
from urlparse import urlparse
! from urllib import urlopen, unquote
class DlgAddTor(wxDialog):
***************
*** 62,66 ****
copyfile(file, path.join(Config.Get('Paths', 'Torrent'), path.split(file)[1]))
except:
! wxMessageBox("Couldn't copy the torrent to the BT++ torren directory.")
elif self.UrlRadio.GetValue() == true:
--- 61,65 ----
copyfile(file, path.join(Config.Get('Paths', 'Torrent'), path.split(file)[1]))
except:
! wxMessageBox("Couldn't copy the torrent to the BT++ torrent directory.")
elif self.UrlRadio.GetValue() == true:
***************
*** 70,79 ****
if url != '':
try:
! url = unquote(url)
h = urlopen(url)
! spl = urlparse(url)
! file = path.split(spl[2])[1]
!
if file == '':
raise
--- 69,90 ----
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
!
! file = i[s:e]
! else:
! spl = urlparse(url)
! file = path.split(spl[2])[1]
!
if file == '':
raise
|