Miscellaneous scripts
This repository contains miscellaneous scripts that does not fit in one repository, yet I will use them sometimes for my personal use. Note that some of the scripts might contain hardcoded paths and opinionated presets, and you are advised to inspect them before actually using.
Loading...
Searching...
No Matches
versioninfo.py
Go to the documentation of this file.
1"""
2This file is used to generate the version information for the Windows executable.
3"""
4import os
5# get current UTC+8 time
6from datetime import datetime
7
8# get the current version from the __version__ variable in __init__.py
9from yt_dlp.version import __version__
10
11# Writes the version information to a file named versioninfo.txt
12with open(os.path.join(os.path.dirname(__file__), 'versioninfo.txt'), 'w', encoding='utf-8') as f:
13 # filevers should be always a tuple with four items: (1, 0, 0, 0)
14 # it will be year, month, day, UTC+8 time in format of Hour+Minute (e.g. 2021, 8, 1, 1200)
15 f.write(f"""VSVersionInfo(
16 ffi=FixedFileInfo(
17 filevers=({datetime.now().year}, {datetime.now().month}, {datetime.now().day}, {str(datetime.now().strftime('%H%M')).lstrip('0')})
18 ),
19 kids=[
20 StringFileInfo(
21 [
22 StringTable(
23 u'040904B0',
24 [StringStruct(u'CompanyName', u'github.com/yt-dlp/yt-dlp'),
25 StringStruct(u'FileDescription', u'A feature-rich command-line audio/video downloader'),
26 StringStruct(u'FileVersion', u'{__version__}'),
27 StringStruct(u'InternalName', u'yt-dlp'),
28 StringStruct(u'LegalCopyright', u'This is free and unencumbered software released into the public domain.'),
29 StringStruct(u'OriginalFilename', u'yt-dlp.exe'),
30 StringStruct(u'ProductName', u'yt-dlp'),
31 StringStruct(u'ProductVersion', u'{__version__}')])
32 ]),
33 VarFileInfo([VarStruct(u'Translation', [1033, 1200])])
34 ]
35 )""")
36
37print('Version information written to versioninfo.txt')