-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclock-in.py
More file actions
37 lines (31 loc) · 909 Bytes
/
clock-in.py
File metadata and controls
37 lines (31 loc) · 909 Bytes
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
'''
@Author: Yao Lu
@Date: 2019-11-12 20:01:43
@Description: Clock in github.
'''
import os
import time
import threading
day_second = 60 * 60 * 24
git_pull = 'git pull'
git_add = 'git add .'
git_commit = 'git commit -m '
git_push = 'git push -u origin master'
def clock_in():
os.system(git_pull)
clock_in_file = './clock-in.txt'
with open(clock_in_file, 'a') as f:
timeStamp = time.time()
localTime = time.localtime(timeStamp)
strTime = time.strftime("%Y-%m-%d %H:%M:%S", localTime)
clock_in_content = strTime + " I have clocked in.\n"
f.write(clock_in_content)
print(clock_in_content)
os.system(git_add)
os.system(git_commit + '\'' + strTime + '\'')
os.system(git_push)
timer = threading.Timer(day_second, clock_in)
timer.start()
if __name__ == "__main__":
timer = threading.Timer(day_second, clock_in)
clock_in()