Skip to content

Commit

Permalink
Revert "fix: alarm.py, initial volume issue"
Browse files Browse the repository at this point in the history
This reverts commit b5628747d0a9f17c6f625fd6c0c49dbd9f6b0fb5.

Since mpd was configured to use 'softvol', hack no longer needed.
  • Loading branch information
marbu committed Jan 13, 2013
1 parent 5f9f6d3 commit de52bd0
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions alarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

CMD_ALARM = "mpc clear; mpc load alarm; mpc play"
CMD_VOLUME_UP = "mpc volume %d"
CMD_ALARM_INIT_VOLUME = "%s; sleep 0.1; %s" % (CMD_ALARM, CMD_VOLUME_UP)

def run_at(time_str, sched_cmd, debug=False):
"""
Expand All @@ -52,16 +51,12 @@ def sched_alarm(when_str, volume_list=None, period=1, debug=False):
# schedule alarm
time_st = time.strptime(when_str, "%H:%M")
time_obj = datetime.datetime(2012, 1, 1, time_st.tm_hour, time_st.tm_min, 0)
if len(volume_list) == 0:
run_at(time_obj.strftime("%H:%M"), CMD_ALARM, debug)
else:
init_volume = volume_list.pop(0)
run_at(time_obj.strftime("%H:%M"), CMD_ALARM_INIT_VOLUME % init_volume, debug)
run_at(time_obj.strftime("%H:%M"), CMD_ALARM, debug)
# gradually increase volume if required
time_delta = datetime.timedelta(seconds=period*60)
for volume in volume_list:
time_obj = time_obj + time_delta
run_at(time_obj.strftime("%H:%M"), CMD_VOLUME_UP % volume, debug)
time_obj = time_obj + time_delta

def main():
op = OptionParser(usage="usage: %prog [options]")
Expand Down

0 comments on commit de52bd0

Please sign in to comment.