extract_asrc.py 499 B

1234567891011121314151617181920212223
  1. import argparse
  2. import os
  3. import tarfile
  4. def parse_args():
  5. parser = argparse.ArgumentParser()
  6. parser.add_argument('--input', nargs='*', required=True)
  7. parser.add_argument('--output', required=True)
  8. return parser.parse_args()
  9. def main():
  10. args = parse_args()
  11. for asrc in [x for x in args.input if x.endswith('.asrc') and os.path.exists(x)]:
  12. with tarfile.open(asrc, 'r') as tar:
  13. tar.extractall(path=args.output)
  14. if __name__ == '__main__':
  15. main()