make_issue_template.py 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 = '''
  9. - type: checkboxes
  10. id: verbose
  11. attributes:
  12. label: Provide verbose output that clearly demonstrates the problem
  13. description: |
  14. This is mandatory unless absolutely impossible to provide. If you are unable to provide the output, please explain why.
  15. options:
  16. - label: Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
  17. required: true
  18. - label: "If using API, add `'verbose': True` to `YoutubeDL` params instead"
  19. required: false
  20. - label: Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below
  21. required: true
  22. - type: textarea
  23. id: log
  24. attributes:
  25. label: Complete Verbose Output
  26. description: |
  27. It should start like this:
  28. placeholder: |
  29. [debug] Command-line config: ['-vU', 'https://www.youtube.com/watch?v=BaW_jenozKc']
  30. [debug] Encodings: locale cp65001, fs utf-8, pref cp65001, out utf-8, error utf-8, screen utf-8
  31. [debug] yt-dlp version nightly@... from yt-dlp/yt-dlp-nightly-builds [1a176d874] (win_exe)
  32. [debug] Python 3.10.11 (CPython AMD64 64bit) - Windows-10-10.0.20348-SP0 (OpenSSL 1.1.1t 7 Feb 2023)
  33. [debug] exe versions: ffmpeg 7.0.2 (setts), ffprobe 7.0.2
  34. [debug] Optional libraries: Cryptodome-3.21.0, brotli-1.1.0, certifi-2024.08.30, curl_cffi-0.5.10, mutagen-1.47.0, requests-2.32.3, sqlite3-3.40.1, urllib3-2.2.3, websockets-13.1
  35. [debug] Proxy map: {}
  36. [debug] Request Handlers: urllib, requests, websockets, curl_cffi
  37. [debug] Loaded 1838 extractors
  38. [debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
  39. Latest version: nightly@... from yt-dlp/yt-dlp-nightly-builds
  40. yt-dlp is up to date (nightly@... from yt-dlp/yt-dlp-nightly-builds)
  41. [youtube] Extracting URL: https://www.youtube.com/watch?v=BaW_jenozKc
  42. <more lines>
  43. render: shell
  44. validations:
  45. required: true
  46. '''.strip()
  47. NO_SKIP = '''
  48. - type: markdown
  49. attributes:
  50. value: |
  51. > [!IMPORTANT]
  52. > Not providing the required (*) information or removing the template will result in your issue being closed and ignored.
  53. '''.strip()
  54. def main():
  55. fields = {
  56. 'no_skip': NO_SKIP,
  57. 'verbose': VERBOSE,
  58. 'verbose_optional': re.sub(r'(\n\s+validations:)?\n\s+required: true', '', VERBOSE),
  59. }
  60. infile, outfile = get_filename_args(has_infile=True)
  61. write_file(outfile, read_file(infile) % fields)
  62. if __name__ == '__main__':
  63. main()