make_issue_template.py 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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-nightly-builds [1a176d874] (win_exe)
  30. [debug] Python 3.10.11 (CPython AMD64 64bit) - Windows-10-10.0.20348-SP0 (OpenSSL 1.1.1t 7 Feb 2023)
  31. [debug] exe versions: ffmpeg 7.0.2 (setts), ffprobe 7.0.2
  32. [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
  33. [debug] Proxy map: {}
  34. [debug] Request Handlers: urllib, requests, websockets, curl_cffi
  35. [debug] Loaded 1838 extractors
  36. [debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
  37. Latest version: nightly@... from yt-dlp/yt-dlp-nightly-builds
  38. yt-dlp is up to date (nightly@... from yt-dlp/yt-dlp-nightly-builds)
  39. [youtube] Extracting URL: https://www.youtube.com/watch?v=BaW_jenozKc
  40. <more lines>
  41. render: shell
  42. validations:
  43. required: true
  44. - type: markdown
  45. attributes:
  46. value: |
  47. > [!CAUTION]
  48. > ### GitHub is experiencing a high volume of malicious spam comments.
  49. > ### If you receive any replies asking you download a file, do NOT follow the download links!
  50. >
  51. > Note that this issue may be temporarily locked as an anti-spam measure after it is opened.
  52. '''.strip()
  53. NO_SKIP = '''
  54. - type: checkboxes
  55. attributes:
  56. label: DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE
  57. description: Fill all fields even if you think it is irrelevant for the issue
  58. options:
  59. - label: I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\\* field
  60. required: true
  61. '''.strip()
  62. def main():
  63. fields = {'no_skip': NO_SKIP}
  64. fields['verbose'] = VERBOSE_TMPL % fields
  65. fields['verbose_optional'] = re.sub(r'(\n\s+validations:)?\n\s+required: true', '', fields['verbose'])
  66. infile, outfile = get_filename_args(has_infile=True)
  67. write_file(outfile, read_file(infile) % fields)
  68. if __name__ == '__main__':
  69. main()