#!/usr/bin/python from math import * from sys import * from string import * def message(): print "Usage: amplify \n" exit() if len(argv)<2: message() try: factor=float(argv[1]) except ValueError: message() chunk=stdin.readlines() for line in chunk: words=line.split() try: if len(words) == 1: out_line=join(words) stdout.write("%s\n" % out_line) elif words[1] == 'On' and words[4] != 'v=0': current_vol=float(words[4].split('=')[1]) new_vol=int(current_vol*factor) words[4]= 'v=%i' % new_vol out_line=join(words) stdout.write("%s\n" % out_line) else: out_line=join(words) stdout.write("%s\n" % out_line) except: continue