-
Notifications
You must be signed in to change notification settings - Fork 5
/
runLidarrNow.py
44 lines (37 loc) · 1.02 KB
/
runLidarrNow.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
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File : runScans.py
@Time : 2023/10/24
@Author : Jacob Roy
@Version : 1.0
@Contact : [email protected]
@Desc :
'''
import multiprocessing
from time import gmtime, strftime
from tidalrr.workers import print_elapsed_time, tidalrrStart
from tidalrr.workers.syncLidarr import syncLidarr
@print_elapsed_time
def startLidarrSync():
print(strftime("%Y-%m-%d %H:%M:%S", gmtime())+" startLidarrSync")
tidalrrStart()
print('tidalrrStart')
syncLidarr()
def forkScans():
# Start foo as a process
print(strftime("%Y-%m-%d %H:%M:%S", gmtime())+" Starting scans")
p = multiprocessing.Process(target=startLidarrSync)
p.start()
p.join()
# If thread is active
if p.is_alive():
print(strftime("%Y-%m-%d %H:%M:%S", gmtime())+" Scans are running... let's kill it...")
# Terminate foo
p.terminate()
# Cleanup
p.join()
if __name__ == '__main__':
forkScans()
#main()
#mainSchedule()