]> jfr.im git - yt-dlp.git/blame - devscripts/make_issue_template.py
[extractor/youtube] More metadata for storyboards (#4334)
[yt-dlp.git] / devscripts / make_issue_template.py
CommitLineData
cc52de43 1#!/usr/bin/env python3
54007a45 2
3# Allow direct execution
4import os
5import sys
6
7sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
8
9
7710bdf4 10import optparse
ca9f1df2 11import re
7710bdf4
SO
12
13
c1714454 14def read(fname):
15 with open(fname, encoding='utf-8') as f:
16 return f.read()
17
18
54007a45 19# Get the version without importing the package
c1714454 20def read_version(fname):
21 exec(compile(read(fname), fname, 'exec'))
22 return locals()['__version__']
23
24
ca9f1df2 25VERBOSE_TMPL = '''
26 - type: checkboxes
27 id: verbose
28 attributes:
29 label: Provide verbose output that clearly demonstrates the problem
30 options:
31 - label: Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
32 required: true
33 - label: Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below
34 required: true
35 - type: textarea
36 id: log
37 attributes:
38 label: Complete Verbose Output
39 description: |
40 It should start like this:
41 placeholder: |
42 [debug] Command-line config: ['-vU', 'test:youtube']
43 [debug] Portable config "yt-dlp.conf": ['-i']
44 [debug] Encodings: locale cp65001, fs utf-8, pref cp65001, out utf-8, error utf-8, screen utf-8
45 [debug] yt-dlp version %(version)s [9d339c4] (win32_exe)
46 [debug] Python 3.8.10 (CPython 64bit) - Windows-10-10.0.22000-SP0
47 [debug] Checking exe version: ffmpeg -bsfs
48 [debug] Checking exe version: ffprobe -bsfs
49 [debug] exe versions: ffmpeg N-106550-g072101bd52-20220410 (fdk,setts), ffprobe N-106624-g391ce570c8-20220415, phantomjs 2.1.1
50 [debug] Optional libraries: Cryptodome-3.15.0, brotli-1.0.9, certifi-2022.06.15, mutagen-1.45.1, sqlite3-2.6.0, websockets-10.3
51 [debug] Proxy map: {}
52 [debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
53 Latest version: %(version)s, Current version: %(version)s
54 yt-dlp is up to date (%(version)s)
55 <more lines>
56 render: shell
57 validations:
58 required: true
59'''.strip()
60
61
7710bdf4 62def main():
3bf1df51 63 parser = optparse.OptionParser(usage='%prog INFILE OUTFILE')
ca9f1df2 64 _, args = parser.parse_args()
3bf1df51
S
65 if len(args) != 2:
66 parser.error('Expected an input and an output filename')
7710bdf4 67
ca9f1df2 68 fields = {'version': read_version('yt_dlp/version.py')}
69 fields['verbose'] = VERBOSE_TMPL % fields
70 fields['verbose_optional'] = re.sub(r'(\n\s+validations:)?\n\s+required: true', '', fields['verbose'])
71
3bf1df51 72 infile, outfile = args
86e5f3ed 73 with open(outfile, 'w', encoding='utf-8') as outf:
ca9f1df2 74 outf.write(read(infile) % fields)
7710bdf4 75
86e5f3ed 76
7710bdf4
SO
77if __name__ == '__main__':
78 main()