]> jfr.im git - yt-dlp.git/blob - devscripts/make_issue_template.py
[cleanup] Misc
[yt-dlp.git] / devscripts / make_issue_template.py
1 #!/usr/bin/env python3
2
3 # Allow direct execution
4 import os
5 import sys
6
7 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
8
9
10 import re
11
12 from devscripts.utils import (
13 get_filename_args,
14 read_file,
15 read_version,
16 write_file,
17 )
18
19 VERBOSE_TMPL = '''
20 - type: checkboxes
21 id: verbose
22 attributes:
23 label: Provide verbose output that clearly demonstrates the problem
24 options:
25 - label: Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
26 required: true
27 - label: "If using API, add `'verbose': True` to `YoutubeDL` params instead"
28 required: false
29 - label: Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below
30 required: true
31 - type: textarea
32 id: log
33 attributes:
34 label: Complete Verbose Output
35 description: |
36 It should start like this:
37 placeholder: |
38 [debug] Command-line config: ['-vU', 'test:youtube']
39 [debug] Portable config "yt-dlp.conf": ['-i']
40 [debug] Encodings: locale cp65001, fs utf-8, pref cp65001, out utf-8, error utf-8, screen utf-8
41 [debug] yt-dlp version %(version)s [9d339c4] (win32_exe)
42 [debug] Python 3.8.10 (CPython 64bit) - Windows-10-10.0.22000-SP0
43 [debug] Checking exe version: ffmpeg -bsfs
44 [debug] Checking exe version: ffprobe -bsfs
45 [debug] exe versions: ffmpeg N-106550-g072101bd52-20220410 (fdk,setts), ffprobe N-106624-g391ce570c8-20220415, phantomjs 2.1.1
46 [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
47 [debug] Proxy map: {}
48 [debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
49 Latest version: %(version)s, Current version: %(version)s
50 yt-dlp is up to date (%(version)s)
51 <more lines>
52 render: shell
53 validations:
54 required: true
55 '''.strip()
56
57 NO_SKIP = '''
58 - type: checkboxes
59 attributes:
60 label: DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE
61 description: Fill all fields even if you think it is irrelevant for the issue
62 options:
63 - label: I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\\* field
64 required: true
65 '''.strip()
66
67
68 def main():
69 fields = {'version': read_version(), 'no_skip': NO_SKIP}
70 fields['verbose'] = VERBOSE_TMPL % fields
71 fields['verbose_optional'] = re.sub(r'(\n\s+validations:)?\n\s+required: true', '', fields['verbose'])
72
73 infile, outfile = get_filename_args(has_infile=True)
74 write_file(outfile, read_file(infile) % fields)
75
76
77 if __name__ == '__main__':
78 main()