mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-10-31 06:35:12 +00:00 
			
		
		
		
	[update] Check for new version even if not updateable
This commit is contained in:
		| @@ -99,23 +99,6 @@ def run_update(ydl): | |||||||
|                 h.update(mv[:n]) |                 h.update(mv[:n]) | ||||||
|         return h.hexdigest() |         return h.hexdigest() | ||||||
|  |  | ||||||
|     ERRORS = { |  | ||||||
|         'exe': None, |  | ||||||
|         'zip': None, |  | ||||||
|         'dir': 'Auto-update is not supported for unpackaged windows executable. Re-download the latest release', |  | ||||||
|         'source': 'You cannot update when running from source code', |  | ||||||
|         'unknown': 'It looks like you installed yt-dlp with a package manager, pip, setup.py or a tarball. Use that to update', |  | ||||||
|     } |  | ||||||
|     err = ERRORS.get(detect_variant(), ERRORS['unknown']) |  | ||||||
|     if err: |  | ||||||
|         return report_error(err, expected=True) |  | ||||||
|  |  | ||||||
|     # sys.executable is set to the full pathname of the exe-file for py2exe |  | ||||||
|     # though symlinks are not followed so that we need to do this manually |  | ||||||
|     # with help of realpath |  | ||||||
|     filename = compat_realpath(sys.executable if hasattr(sys, 'frozen') else sys.argv[0]) |  | ||||||
|     ydl.to_screen('Current Build Hash %s' % calc_sha256sum(filename)) |  | ||||||
|  |  | ||||||
|     # Download and check versions info |     # Download and check versions info | ||||||
|     try: |     try: | ||||||
|         version_info = ydl._opener.open(JSON_URL).read().decode('utf-8') |         version_info = ydl._opener.open(JSON_URL).read().decode('utf-8') | ||||||
| @@ -128,10 +111,27 @@ def run_update(ydl): | |||||||
|  |  | ||||||
|     version_id = version_info['tag_name'] |     version_id = version_info['tag_name'] | ||||||
|     if version_tuple(__version__) >= version_tuple(version_id): |     if version_tuple(__version__) >= version_tuple(version_id): | ||||||
|         ydl.to_screen('yt-dlp is up to date (%s)' % __version__) |         ydl.to_screen(f'yt-dlp is up to date ({__version__})') | ||||||
|         return |         return | ||||||
|  |  | ||||||
|     ydl.to_screen('Updating to version ' + version_id + ' ...') |     ERRORS = { | ||||||
|  |         'exe': None, | ||||||
|  |         'zip': None, | ||||||
|  |         'dir': 'Auto-update is not supported for unpackaged windows executable. Re-download the latest release', | ||||||
|  |         'source': 'You cannot update when running from source code', | ||||||
|  |         'unknown': 'It looks like you installed yt-dlp with a package manager, pip, setup.py or a tarball. Use that to update', | ||||||
|  |     } | ||||||
|  |     err = ERRORS.get(detect_variant(), ERRORS['unknown']) | ||||||
|  |     if err: | ||||||
|  |         ydl.to_screen(f'Latest version: {version_id}, Current version: {__version__}') | ||||||
|  |         return report_error(err, expected=True) | ||||||
|  |  | ||||||
|  |     # sys.executable is set to the full pathname of the exe-file for py2exe | ||||||
|  |     # though symlinks are not followed so that we need to do this manually | ||||||
|  |     # with help of realpath | ||||||
|  |     filename = compat_realpath(sys.executable if hasattr(sys, 'frozen') else sys.argv[0]) | ||||||
|  |     ydl.to_screen(f'Current version {__version__}; Build Hash {calc_sha256sum(filename)}') | ||||||
|  |     ydl.to_screen(f'Updating to version {version_id} ...') | ||||||
|  |  | ||||||
|     version_labels = { |     version_labels = { | ||||||
|         'zip_3': '', |         'zip_3': '', | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 pukkandan
					pukkandan