A feature-rich command-line audio/video downloader
fixed a couple of Windows exe update bugs
Filippo Valsordaf36cd076850f
diff --git a/youtube-dl b/youtube-dlindex 3fc77f2068..80175ed6eb 100755Binary files a/youtube-dl and b/youtube-dl differdiff --git a/youtube-dl.exe b/youtube-dl.exeindex 287b78af52..6d19ef5eac 100755Binary files a/youtube-dl.exe and b/youtube-dl.exe differdiff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.pyindex 5e500d5e02..73590ecd6f 100644--- a/youtube_dl/__init__.py+++ b/youtube_dl/__init__.py@@ -60,13 +60,17 @@ def updateSelf(downloader, filename):urlv.close()if hasattr(sys, "frozen"): #py2exe- directory = os.path.dirname(filename)exe = os.path.abspath(filename)+ directory = os.path.dirname(exe)if not os.access(directory, os.W_OK):sys.exit('ERROR: no write permissions on %s' % directory)try:- urllib.urlretrieve(UPDATE_URL_EXE, exe + '.new')+ urlh = urllib2.urlopen(UPDATE_URL_EXE)+ newcontent = urlh.read()+ urlh.close()+ with open(exe + '.new', 'wb') as outf:+ outf.write(newcontent)except (IOError, OSError), err:sys.exit('ERROR: unable to download latest version')@@ -75,6 +79,7 @@ def updateSelf(downloader, filename):b = open(bat, 'w')print >> b, """+echo Updating youtube-dl...ping 127.0.0.1 -n 5 -w 1000 > NULmove /Y "%s.new" "%s"del "%s"@@ -95,11 +100,8 @@ del "%s"sys.exit('ERROR: unable to download latest version')try:- outf = open(filename, 'wb')- try:+ with open(filename, 'wb') as outf:outf.write(newcontent)- finally:- outf.close()except (IOError, OSError), err:sys.exit('ERROR: unable to overwrite current version')