mirror of https://github.com/yt-dlp/yt-dlp.git
parent
447afb9eaa
commit
d2e84d5eb0
|
@ -13,6 +13,7 @@ import optparse
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
import traceback
|
||||||
|
|
||||||
from .compat import compat_shlex_quote
|
from .compat import compat_shlex_quote
|
||||||
from .cookies import SUPPORTED_BROWSERS, SUPPORTED_KEYRINGS
|
from .cookies import SUPPORTED_BROWSERS, SUPPORTED_KEYRINGS
|
||||||
|
@ -937,6 +938,7 @@ def _real_main(argv=None):
|
||||||
if opts.rm_cachedir:
|
if opts.rm_cachedir:
|
||||||
ydl.cache.remove()
|
ydl.cache.remove()
|
||||||
|
|
||||||
|
try:
|
||||||
updater = Updater(ydl, opts.update_self if isinstance(opts.update_self, str) else None)
|
updater = Updater(ydl, opts.update_self if isinstance(opts.update_self, str) else None)
|
||||||
if opts.update_self and updater.update() and actual_use:
|
if opts.update_self and updater.update() and actual_use:
|
||||||
if updater.cmd:
|
if updater.cmd:
|
||||||
|
@ -945,6 +947,9 @@ def _real_main(argv=None):
|
||||||
# It makes sense to exit here, but the old behavior is to continue
|
# It makes sense to exit here, but the old behavior is to continue
|
||||||
ydl.report_warning('Restart yt-dlp to use the updated version')
|
ydl.report_warning('Restart yt-dlp to use the updated version')
|
||||||
# return 100, 'ERROR: The program must exit for the update to complete'
|
# return 100, 'ERROR: The program must exit for the update to complete'
|
||||||
|
except Exception:
|
||||||
|
traceback.print_exc()
|
||||||
|
ydl._download_retcode = 100
|
||||||
|
|
||||||
if not actual_use:
|
if not actual_use:
|
||||||
if pre_process:
|
if pre_process:
|
||||||
|
|
|
@ -16,6 +16,7 @@ from .utils import (
|
||||||
Popen,
|
Popen,
|
||||||
cached_method,
|
cached_method,
|
||||||
deprecation_warning,
|
deprecation_warning,
|
||||||
|
network_exceptions,
|
||||||
remove_end,
|
remove_end,
|
||||||
remove_start,
|
remove_start,
|
||||||
sanitized_Request,
|
sanitized_Request,
|
||||||
|
@ -258,8 +259,8 @@ class Updater:
|
||||||
self.ydl.to_screen((
|
self.ydl.to_screen((
|
||||||
f'Available version: {self._label(self.target_channel, self.latest_version)}, ' if self.target_tag == 'latest' else ''
|
f'Available version: {self._label(self.target_channel, self.latest_version)}, ' if self.target_tag == 'latest' else ''
|
||||||
) + f'Current version: {self._label(CHANNEL, self.current_version)}')
|
) + f'Current version: {self._label(CHANNEL, self.current_version)}')
|
||||||
except Exception:
|
except network_exceptions as e:
|
||||||
return self._report_network_error('obtain version info', delim='; Please try again later or')
|
return self._report_network_error(f'obtain version info ({e})', delim='; Please try again later or')
|
||||||
|
|
||||||
if not is_non_updateable():
|
if not is_non_updateable():
|
||||||
self.ydl.to_screen(f'Current Build Hash: {_sha256_file(self.filename)}')
|
self.ydl.to_screen(f'Current Build Hash: {_sha256_file(self.filename)}')
|
||||||
|
@ -303,7 +304,7 @@ class Updater:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
newcontent = self._download(self.release_name, self._tag)
|
newcontent = self._download(self.release_name, self._tag)
|
||||||
except Exception as e:
|
except network_exceptions as e:
|
||||||
if isinstance(e, urllib.error.HTTPError) and e.code == 404:
|
if isinstance(e, urllib.error.HTTPError) and e.code == 404:
|
||||||
return self._report_error(
|
return self._report_error(
|
||||||
f'The requested tag {self._label(self.target_channel, self.target_tag)} does not exist', True)
|
f'The requested tag {self._label(self.target_channel, self.target_tag)} does not exist', True)
|
||||||
|
|
Loading…
Reference in New Issue