mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-10-31 06:35:12 +00:00 
			
		
		
		
	Add version to infojson
This commit is contained in:
		| @@ -48,7 +48,7 @@ from .postprocessor import ( | ||||
|     get_postprocessor, | ||||
| ) | ||||
| from .postprocessor.ffmpeg import resolve_mapping as resolve_recode_mapping | ||||
| from .update import detect_variant | ||||
| from .update import REPOSITORY, current_git_head, detect_variant | ||||
| from .utils import ( | ||||
|     DEFAULT_OUTTMPL, | ||||
|     IDENTITY, | ||||
| @@ -3314,6 +3314,12 @@ class YoutubeDL: | ||||
|             return info_dict | ||||
|         info_dict.setdefault('epoch', int(time.time())) | ||||
|         info_dict.setdefault('_type', 'video') | ||||
|         info_dict.setdefault('_version', { | ||||
|             'version': __version__, | ||||
|             'current_git_head': current_git_head(), | ||||
|             'release_git_head': RELEASE_GIT_HEAD, | ||||
|             'repository': REPOSITORY, | ||||
|         }) | ||||
| 
 | ||||
|         if remove_private_keys: | ||||
|             reject = lambda k, v: v is None or k.startswith('__') or k in { | ||||
| @@ -3678,7 +3684,8 @@ class YoutubeDL: | ||||
|         if VARIANT not in (None, 'pip'): | ||||
|             source += '*' | ||||
|         write_debug(join_nonempty( | ||||
|             'yt-dlp version', __version__, | ||||
|             f'{"yt-dlp" if REPOSITORY == "yt-dlp/yt-dlp" else REPOSITORY} version', | ||||
|             __version__, | ||||
|             f'[{RELEASE_GIT_HEAD}]' if RELEASE_GIT_HEAD else '', | ||||
|             '' if source == 'unknown' else f'({source})', | ||||
|             delim=' ')) | ||||
| @@ -3694,18 +3701,8 @@ class YoutubeDL: | ||||
|         if self.params['compat_opts']: | ||||
|             write_debug('Compatibility options: %s' % ', '.join(self.params['compat_opts'])) | ||||
| 
 | ||||
|         if source == 'source': | ||||
|             try: | ||||
|                 stdout, _, _ = Popen.run( | ||||
|                     ['git', 'rev-parse', '--short', 'HEAD'], | ||||
|                     text=True, cwd=os.path.dirname(os.path.abspath(__file__)), | ||||
|                     stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||||
|                 if re.fullmatch('[0-9a-f]+', stdout.strip()): | ||||
|                     write_debug(f'Git HEAD: {stdout.strip()}') | ||||
|             except Exception: | ||||
|                 with contextlib.suppress(Exception): | ||||
|                     sys.exc_clear() | ||||
| 
 | ||||
|         if current_git_head(): | ||||
|             write_debug(f'Git HEAD: {current_git_head()}') | ||||
|         write_debug(system_identifier()) | ||||
| 
 | ||||
|         exe_versions, ffmpeg_features = FFmpegPostProcessor.get_versions_and_features(self) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 pukkandan
					pukkandan