Compare commits

..

2 Commits

Author SHA1 Message Date
bashonly
ba05b740ef
[update] Update yt_dlp/update.py 2023-11-12 00:12:46 +00:00
bashonly
b8ed155aac
[update] Apply suggestions from code review 2023-11-12 00:10:56 +00:00

View File

@ -279,16 +279,14 @@ class Updater:
def _get_version_info(self, tag: str) -> tuple[str | None, str | None]:
if _VERSION_RE.fullmatch(tag):
return tag, None
elif self._exact and tag != 'latest':
return None, None
api_info = self._call_api(tag)
if tag == 'latest':
requested_version = api_info['tag_name']
else:
match = _VERSION_RE.search(api_info.get('name', ''))
requested_version = match[0] if match else None
match = re.search(rf'\s+(?P<version>{_VERSION_RE.pattern})$', api_info.get('name', ''))
requested_version = match.group('version') if match else None
if re.fullmatch(_HASH_PATTERN, api_info.get('target_commitish', '')):
target_commitish = api_info['target_commitish']
@ -376,7 +374,7 @@ class Updater:
elif target_commitish:
has_update = target_commitish != self.current_commit
else:
has_update = True
has_update = False
current_label = _make_label(ORIGIN, CHANNEL.partition("@")[2] or self.current_version, self.current_version)
if not has_update:
@ -445,8 +443,6 @@ class Updater:
return False
self.ydl.to_screen(f'Current Build Hash: {_sha256_file(self.filename)}')
if not update_info.checksum:
self._block_restart('Automatically restarting into unverified builds is disabled for security reasons')
update_label = _make_label(self.requested_repo, update_info.tag, update_info.version)
self.ydl.to_screen(f'Updating to {update_label} ...')