Code as Fast as You Can Think
"I have only proved my code correct, not tested it" - Donald Knuth
Search This Blog
Friday, July 2, 2010
Python Alarm Clock
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import
time
import
subprocess
def
getTotalMinutes
():
s
=
raw_input
(
'input format: xxhxxm\n'
)
hour
=
s
[
0
:
s
.
find
(
'h'
)]
minute
=
s
[
s
.
find
(
'h'
)+
1
:
s
.
find
(
'm'
)]
return
int
(
hour
)*
60
+
int
(
minute
)
def
run
():
command
=
[
'vlc'
,
'county_load.flv'
]
print
"run command:"
,
command
subprocess
.
call
(
command
)
if
__name__
==
'__main__'
:
minutes
=
getTotalMinutes
()
print
"Count Down Total Minutes:"
+
str
(
minutes
)
while
minutes
>
0
:
time
.
sleep
(
60
)
minutes
=
minutes
-
1
print
str
(
minutes
)
+
" minute(s) left"
run
()
http://code.google.com/p/mixtools/source/browse/trunk/subprocess/alarm.py
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
About Me
Unknown
View my complete profile
No comments:
Post a Comment