2014-12-12 08:42:40 -07:00
|
|
|
#!/usr/bin/env python
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
2014-12-15 16:22:38 -07:00
|
|
|
import optparse
|
2014-12-12 08:42:40 -07:00
|
|
|
import re
|
|
|
|
|
2023-07-24 17:22:54 -06:00
|
|
|
from utils import read_file, write_file
|
|
|
|
|
2014-12-12 08:42:40 -07:00
|
|
|
|
|
|
|
def main():
|
2014-12-15 16:22:38 -07: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')
|
|
|
|
|
|
|
|
infile, outfile = args
|
|
|
|
|
2023-07-24 17:22:54 -06:00
|
|
|
readme = read_file(infile)
|
2014-12-12 08:42:40 -07:00
|
|
|
|
|
|
|
bug_text = re.search(
|
|
|
|
r'(?s)#\s*BUGS\s*[^\n]*\s*(.*?)#\s*COPYRIGHT', readme).group(1)
|
|
|
|
dev_text = re.search(
|
2014-12-12 08:47:22 -07:00
|
|
|
r'(?s)(#\s*DEVELOPER INSTRUCTIONS.*?)#\s*EMBEDDING YOUTUBE-DL',
|
|
|
|
readme).group(1)
|
2014-12-12 08:42:40 -07:00
|
|
|
|
|
|
|
out = bug_text + dev_text
|
|
|
|
|
2023-07-24 17:22:54 -06:00
|
|
|
write_file(outfile, out)
|
2014-12-12 08:42:40 -07:00
|
|
|
|
2016-11-17 04:42:56 -07:00
|
|
|
|
2014-12-12 08:42:40 -07:00
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|