2021-06-03 09:43:42 +00:00
|
|
|
#!/usr/bin/env python3
|
2014-12-15 23:22:38 +00:00
|
|
|
import optparse
|
2021-10-09 01:08:01 +00:00
|
|
|
import re
|
2014-12-12 15:42:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
def main():
|
2021-10-09 01:08:01 +00:00
|
|
|
return # This is unused in yt-dlp
|
|
|
|
|
2014-12-15 23:22:38 +00:00
|
|
|
parser = optparse.OptionParser(usage='%prog INFILE OUTFILE')
|
|
|
|
options, args = parser.parse_args()
|
|
|
|
if len(args) != 2:
|
|
|
|
parser.error('Expected an input and an output filename')
|
2020-09-03 03:38:02 +00:00
|
|
|
|
2021-10-09 01:08:01 +00:00
|
|
|
infile, outfile = args
|
2014-12-15 23:22:38 +00:00
|
|
|
|
2022-04-11 15:10:28 +00:00
|
|
|
with open(infile, encoding='utf-8') as inf:
|
2014-12-12 15:42:40 +00:00
|
|
|
readme = inf.read()
|
|
|
|
|
2021-10-09 01:08:01 +00:00
|
|
|
bug_text = re.search(
|
|
|
|
r'(?s)#\s*BUGS\s*[^\n]*\s*(.*?)#\s*COPYRIGHT', readme).group(1)
|
|
|
|
dev_text = re.search(
|
|
|
|
r'(?s)(#\s*DEVELOPER INSTRUCTIONS.*?)#\s*EMBEDDING yt-dlp', readme).group(1)
|
2014-12-12 15:42:40 +00:00
|
|
|
|
|
|
|
out = bug_text + dev_text
|
|
|
|
|
2022-04-11 15:10:28 +00:00
|
|
|
with open(outfile, 'w', encoding='utf-8') as outf:
|
2021-10-09 01:08:01 +00:00
|
|
|
outf.write(out)
|
|
|
|
|
2016-11-17 11:42:56 +00:00
|
|
|
|
2014-12-12 15:42:40 +00:00
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|