]>
Commit | Line | Data |
---|---|---|
cc52de43 | 1 | #!/usr/bin/env python3 |
ccbfaa83 | 2 | import optparse |
8c6f4daa | 3 | import re |
e56190b3 PH |
4 | |
5 | ||
6 | def main(): | |
8c6f4daa | 7 | return # This is unused in yt-dlp |
8 | ||
ccbfaa83 PH |
9 | parser = optparse.OptionParser(usage='%prog INFILE OUTFILE') |
10 | options, args = parser.parse_args() | |
11 | if len(args) != 2: | |
12 | parser.error('Expected an input and an output filename') | |
139cb942 | 13 | |
8c6f4daa | 14 | infile, outfile = args |
ccbfaa83 | 15 | |
86e5f3ed | 16 | with open(infile, encoding='utf-8') as inf: |
e56190b3 PH |
17 | readme = inf.read() |
18 | ||
8c6f4daa | 19 | bug_text = re.search( |
20 | r'(?s)#\s*BUGS\s*[^\n]*\s*(.*?)#\s*COPYRIGHT', readme).group(1) | |
21 | dev_text = re.search( | |
22 | r'(?s)(#\s*DEVELOPER INSTRUCTIONS.*?)#\s*EMBEDDING yt-dlp', readme).group(1) | |
e56190b3 PH |
23 | |
24 | out = bug_text + dev_text | |
25 | ||
86e5f3ed | 26 | with open(outfile, 'w', encoding='utf-8') as outf: |
8c6f4daa | 27 | outf.write(out) |
28 | ||
582be358 | 29 | |
e56190b3 PH |
30 | if __name__ == '__main__': |
31 | main() |