extract_asrc.py 641 B

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