mirror of
https://github.com/brmlab/talknight-timer.git
synced 2025-06-07 11:06:11 +02:00
initial
This commit is contained in:
commit
628dff712f
11 changed files with 79 additions and 0 deletions
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
!.gitignore
|
||||
bin
|
||||
include
|
||||
lib
|
||||
local
|
8
Makefile
Normal file
8
Makefile
Normal 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
4
README.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
TalkNight timer
|
||||
===============
|
||||
|
||||
Small timer tool, that firmly notifies presenter. Requires python-virtualenv package.
|
BIN
continue.mp3
Normal file
BIN
continue.mp3
Normal file
Binary file not shown.
BIN
expired.mp3
Normal file
BIN
expired.mp3
Normal file
Binary file not shown.
BIN
finish.mp3
Normal file
BIN
finish.mp3
Normal file
Binary file not shown.
1
requirements.txt
Normal file
1
requirements.txt
Normal file
|
@ -0,0 +1 @@
|
|||
mpylayer
|
BIN
start.mp3
Normal file
BIN
start.mp3
Normal file
Binary file not shown.
BIN
test.mp3
Normal file
BIN
test.mp3
Normal file
Binary file not shown.
55
timer.py
Normal file
55
timer.py
Normal 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
6
timer.sh
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
DIR="$(dirname $0)"
|
||||
PYTHON=$DIR/bin/python
|
||||
TIMER=$DIR/timer.py
|
||||
$PYTHON $TIMER $*
|
Loading…
Add table
Add a link
Reference in a new issue