PageRenderTime 31ms CodeModel.GetById 36ms RepoModel.GetById 1ms app.codeStats 0ms

/ARCHIVE/gradual-prg.py

https://github.com/litdream/Metronome
Python | 43 lines | 38 code | 4 blank | 1 comment | 0 complexity | 9ceb0342d366245ba961582be37c1516 MD5 | raw file
  1. #!/usr/bin/env python
  2. import os
  3. import sys
  4. import time
  5. import getopt
  6. bump_up = 0
  7. sa = "hU:"
  8. la = ('help', 'bump-up=')
  9. o,argv = getopt.getopt(sys.argv[1:], sa, la)
  10. def usage():
  11. print '''\
  12. USAGE: %s [options] DAT_FILE
  13. -h, --help help screen
  14. -U, --bump-up=INT bump up speed
  15. ''' % sys.argv[0]
  16. if len(o) + len(argv) == 0: usage(); sys.exit(1)
  17. for k,v in o:
  18. if k in ('-h','--help'):
  19. usage(); sys.exit(0)
  20. if k in ('-U','--bump-up'):
  21. bump_up = int(v)
  22. prgfile=argv[0]
  23. for line in open(prgfile):
  24. line = line.strip()
  25. if len(line) == 0: continue
  26. working, dura, rest = tuple(line.split())
  27. cur_speed = int(working) + bump_up
  28. os.system("python Metronome.py -t %d --gradual-dura=%s" % (cur_speed, dura))
  29. print '''
  30. WORKING : %d
  31. ''' % cur_speed
  32. os.system("mplayer a.wav > /dev/null")
  33. time.sleep( int(rest))