Commits

Anonymous committed 789e2a1

Check for update option cleaned up. Will show only a URL to download latest version, if available

  • Participants
  • Parent commits 12393cd

Comments (0)

Files changed (1)

 		# Function to update the program file with the latest version from bitbucket.org
 		def update_self(downloader, filename):
 			# Note: downloader only used for options
-			if not os.access (filename, os.W_OK):
-				sys.exit('ERROR: no write permissions on %s' % filename)
+			#if not os.access (filename, os.W_OK):
+			#	sys.exit('ERROR: no write permissions on %s' % filename)
 
-			downloader.to_stdout('Updating to latest stable version...')
+			downloader.to_stdout('Checking for latest stable version...')
+			version_current = '2010.06.06'
 			latest_url = 'http://bitbucket.org/rg3/youtube-dl/raw/tip/LATEST_VERSION'
 			latest_version = urllib.urlopen(latest_url).read().strip()
-			prog_url = 'http://bitbucket.org/rg3/youtube-dl/raw/%s/youtube-dl' % latest_version
-			newcontent = urllib.urlopen(prog_url).read()
-			stream = open(filename, 'w')
-			stream.write(newcontent)
-			stream.close()
-			downloader.to_stdout('Updated to version %s' % latest_version)
+			#prog_url = 'http://bitbucket.org/rg3/youtube-dl/raw/%s/youtube-dl' % latest_version
+			#newcontent = urllib.urlopen(prog_url).read()
+			#stream = open(filename, 'w')
+			#stream.write(newcontent)
+			#stream.close()
+			downloader.to_stdout('Latest available version is %s' % latest_version)
+			downloader.to_stdout('Installed version is %s' % version_current)
+			if latest_version == version_current:
+				downloader.to_stdout('Installed version is latest, no need to update')
+			else:
+				downloader.to_stdout('Please visit "http://go.himili.com/youtube-dl" to download latest version')
 
 		# General configuration
 		urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler()))