]>
Commit | Line | Data |
---|---|---|
1 | #!/usr/bin/env python3 | |
2 | import optparse | |
3 | import re | |
4 | ||
5 | ||
6 | def main(): | |
7 | return # This is unused in yt-dlp | |
8 | ||
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') | |
13 | ||
14 | infile, outfile = args | |
15 | ||
16 | with open(infile, encoding='utf-8') as inf: | |
17 | readme = inf.read() | |
18 | ||
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) | |
23 | ||
24 | out = bug_text + dev_text | |
25 | ||
26 | with open(outfile, 'w', encoding='utf-8') as outf: | |
27 | outf.write(out) | |
28 | ||
29 | ||
30 | if __name__ == '__main__': | |
31 | main() |