This commit is contained in:
Peter Boráros 2013-07-10 18:26:44 +02:00
commit 628dff712f
11 changed files with 79 additions and 0 deletions

5
.gitignore vendored Normal file
View file

@ -0,0 +1,5 @@
!.gitignore
bin
include
lib
local

8
Makefile Normal file
View file

@ -0,0 +1,8 @@
initenv:
virtualenv .
virtualenv --relocatable .
bin/pip install -r requirements.txt
rmenv:
rm -fr bin lib include local

4
README.md Normal file
View file

@ -0,0 +1,4 @@
TalkNight timer
===============
Small timer tool, that firmly notifies presenter. Requires python-virtualenv package.

BIN
continue.mp3 Normal file

Binary file not shown.

BIN
expired.mp3 Normal file

Binary file not shown.

BIN
finish.mp3 Normal file

Binary file not shown.

1
requirements.txt Normal file
View file

@ -0,0 +1 @@
mpylayer

BIN
start.mp3 Normal file

Binary file not shown.

BIN
test.mp3 Normal file

Binary file not shown.

55
timer.py Normal file
View file

@ -0,0 +1,55 @@
from __future__ import print_function
def args(argv):
import argparse
parser = argparse.ArgumentParser(description='TalkNight timer.', epilog='example: %(prog)s --first 1200 --other 600 600 600')
parser.add_argument('--first', nargs=1, default=[1200], metavar='<secs>', help='specify first time limit')
parser.add_argument('--other', nargs='+', default=[600,600,600], metavar='<secs>', help='specify next time limit(s).')
return parser.parse_args(argv)
def wait(seconds):
from time import sleep
print('Waiting for %d minutes..'%(seconds/60))
sleep(seconds)
if __name__ == '__main__':
from sys import argv
import mpylayer
from itertools import chain, imap
a = args(argv[1:])
p = mpylayer.MPlayerControl()
while True:
p.loadfile('test.mp3')
if raw_input('Do you hear the voice? ') == 'y':
break
p.loadfile('start.mp3')
intervals = map(int,chain(a.first,a.other))
end = False
for t in intervals[:-1]:
wait(t)
p.loadfile('expired.mp3')
i = raw_input('Can continue? ')
if i == 'y':
# continue
print('Yeah, can continue')
p.loadfile('continue.mp3')
else:
end = True
break
if not end:
wait(intervals[-1])
# finish in 2 minutes
p.loadfile('finish.mp3')
wait(120) # some dealy for mplayer
print('Done')

6
timer.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
DIR="$(dirname $0)"
PYTHON=$DIR/bin/python
TIMER=$DIR/timer.py
$PYTHON $TIMER $*