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