forked from DickyB/LANTV
-
Notifications
You must be signed in to change notification settings - Fork 0
/
func.py
50 lines (40 loc) · 1.14 KB
/
func.py
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/python
#
# func.py: Dicky B ([email protected])
#
# a couple of stupid functions to save some cut/paste later,
# and also make it easier to fix when I break it.
#
#
#
import datetime
import os
tmppath="/run/shm/"
def getDayOfWeek():
nowd=datetime.datetime.now()
dow=nowd.weekday() #0=Monday
return dow
def getCurrentHour():
CurrentTime=datetime.datetime.now()
return int(datetime.datetime.strftime(CurrentTime,'%H'))
def getCurrentMinute():
CurrentTime=datetime.datetime.now()
return int(datetime.datetime.strftime(CurrentTime,'%M'))
def getCurrentSecond():
CurrentTime=datetime.datetime.now()
return int(datetime.datetime.strftime(CurrentTime,'%S'))
def getTODMin():
CurrentTime=datetime.datetime.now()
ht=int(datetime.datetime.strftime(CurrentTime,'%H'))
mt=int(datetime.datetime.strftime(CurrentTime,'%M'))
return (ht*60)+mt
def isRunning(procname):
found=False
os.system("/bin/ps -A | /bin/grep "+procname+" > "+tmppath+"mondo."+procname)
siz = os.path.getsize(tmppath+"mondo."+procname)
if siz < 10:
found=False
else:
found=True
os.remove(tmppath+"mondo."+procname)
return found