make_issue_template.py 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. '''.strip()
  44. NO_SKIP = '''
  45. - type: checkboxes
  46. attributes:
  47. label: DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE
  48. description: Fill all fields even if you think it is irrelevant for the issue
  49. options:
  50. - label: I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\\* field
  51. required: true
  52. '''.strip()
  53. def main():
  54. fields = {'no_skip': NO_SKIP}
  55. fields['verbose'] = VERBOSE_TMPL % fields
  56. fields['verbose_optional'] = re.sub(r'(\n\s+validations:)?\n\s+required: true', '', fields['verbose'])
  57. infile, outfile = get_filename_args(has_infile=True)
  58. write_file(outfile, read_file(infile) % fields)
  59. if __name__ == '__main__':
  60. main()