forked from shibing624/python-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoperation.py
More file actions
45 lines (36 loc) · 1.09 KB
/
operation.py
File metadata and controls
45 lines (36 loc) · 1.09 KB
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
# -*- coding: utf-8 -*-
"""
@author:XuMing([email protected])
@description:
"""
import os
import time
from multiprocessing import Process
def pull_screenrecord(a, b):
time.sleep(10)
print(a, b)
def add_friend(a, b, c):
time.sleep(5)
print(a, b, c)
class SyncProcess(Process):
def __init__(self, username, userid='', search_pic_path='', pic_path='', video_path='', time_limit=60,
is_video=False):
super().__init__()
self.username = username
self.userid = str(userid)
self.search_pic_path = search_pic_path
self.pic_path = pic_path
self.video_path = video_path
self.time_limit = time_limit
self.is_video = is_video
def run(self):
print(os.getpid())
if self.is_video:
pull_screenrecord(self.video_path, self.time_limit)
else:
add_friend(self.username, self.search_pic_path, self.pic_path)
if __name__ == '__main__':
friend_p = SyncProcess('ll', '123', 'a.png', 'out', 'out/a.mp4', is_video=False)
friend_p.start()
friend_p.join()
print('done')