2021-06-03 11:43:42 +02:00
|
|
|
#!/usr/bin/env python3
|
2022-06-24 13:06:16 +02:00
|
|
|
|
2014-12-16 00:22:38 +01:00
|
|
|
import optparse
|
2021-10-09 03:08:01 +02:00
|
|
|
import re
|
2014-12-12 16:42:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
def main():
|
2021-10-09 03:08:01 +02:00
|
|
|
return # This is unused in yt-dlp
|
|
|
|
|
2014-12-16 00:22:38 +01: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 05:38:02 +02:00
|
|
|
|
2021-10-09 03:08:01 +02:00
|
|
|
infile, outfile = args
|
2014-12-16 00:22:38 +01:00
|
|
|
|
2022-04-11 17:10:28 +02:00
|
|
|
with open(infile, encoding='utf-8') as inf:
|
2014-12-12 16:42:40 +01:00
|
|
|
readme = inf.read()
|
|
|
|
|
2021-10-09 03:08:01 +02: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 16:42:40 +01:00
|
|
|
|
|
|
|
out = bug_text + dev_text
|
|
|
|
|
2022-04-11 17:10:28 +02:00
|
|
|
with open(outfile, 'w', encoding='utf-8') as outf:
|
2021-10-09 03:08:01 +02:00
|
|
|
outf.write(out)
|
|
|
|
|
2016-11-17 12:42:56 +01:00
|
|
|
|
2014-12-12 16:42:40 +01:00
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|