make_issue_template.py 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/usr/bin/env python3
  2. # Allow direct execution
  3. import os
  4. import sys
  5. sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
  6. import re
  7. from devscripts.utils import get_filename_args, read_file, write_file
  8. VERBOSE_TMPL = '''
  9. - type: checkboxes
  10. id: verbose
  11. attributes:
  12. label: Provide verbose output that clearly demonstrates the problem
  13. options:
  14. - label: Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
  15. required: true
  16. - label: "If using API, add `'verbose': True` to `YoutubeDL` params instead"
  17. required: false
  18. - label: Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below
  19. required: true
  20. - type: textarea
  21. id: log
  22. attributes:
  23. label: Complete Verbose Output
  24. description: |
  25. It should start like this:
  26. placeholder: |
  27. [debug] Command-line config: ['-vU', 'https://www.youtube.com/watch?v=BaW_jenozKc']
  28. [debug] Encodings: locale cp65001, fs utf-8, pref cp65001, out utf-8, error utf-8, screen utf-8
  29. [debug] yt-dlp version nightly@... from yt-dlp/yt-dlp [b634ba742] (win_exe)
  30. [debug] Python 3.8.10 (CPython 64bit) - Windows-10-10.0.22000-SP0
  31. [debug] exe versions: ffmpeg N-106550-g072101bd52-20220410 (fdk,setts), ffprobe N-106624-g391ce570c8-20220415, phantomjs 2.1.1
  32. [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
  33. [debug] Proxy map: {}
  34. [debug] Request Handlers: urllib, requests
  35. [debug] Loaded 1893 extractors
  36. [debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp-nightly-builds/releases/latest
  37. yt-dlp is up to date (nightly@... from yt-dlp/yt-dlp-nightly-builds)
  38. [youtube] Extracting URL: https://www.youtube.com/watch?v=BaW_jenozKc
  39. <more lines>
  40. render: shell
  41. validations:
  42. required: true
  43. - type: markdown
  44. attributes:
  45. value: |
  46. > [!CAUTION]
  47. > ### GitHub is experiencing a high volume of malicious spam comments.
  48. > ### If you receive any replies asking you download a file, do NOT follow the download links!
  49. >
  50. > Note that this issue may be temporarily locked as an anti-spam measure after it is opened.
  51. '''.strip()
  52. NO_SKIP = '''
  53. - type: checkboxes
  54. attributes:
  55. label: DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE
  56. description: Fill all fields even if you think it is irrelevant for the issue
  57. options:
  58. - label: I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\\* field
  59. required: true
  60. '''.strip()
  61. def main():
  62. fields = {'no_skip': NO_SKIP}
  63. fields['verbose'] = VERBOSE_TMPL % fields
  64. fields['verbose_optional'] = re.sub(r'(\n\s+validations:)?\n\s+required: true', '', fields['verbose'])
  65. infile, outfile = get_filename_args(has_infile=True)
  66. write_file(outfile, read_file(infile) % fields)
  67. if __name__ == '__main__':
  68. main()