Lockfile for analyse process.
This commit is contained in:
parent
32a2335821
commit
821e3f713c
16
analyse.py
16
analyse.py
@ -4,10 +4,21 @@
|
||||
from subprocess import check_output
|
||||
import configparser
|
||||
import os
|
||||
import os.path
|
||||
import re
|
||||
import sys
|
||||
import MosDb
|
||||
|
||||
LOCKFILE = "/tmp/n24-loudness-analyse-running.$$$"
|
||||
|
||||
if os.path.isfile(LOCKFILE):
|
||||
print("ERROR: Lockfile found! Previous process seems to be still running.", file=sys.stderr)
|
||||
print("ERROR: If you are sure no other analyse.py is running, delete: {}".format(LOCKFILE), file=sys.stderr)
|
||||
sys.exit(100)
|
||||
|
||||
# Create lockfile
|
||||
open(LOCKFILE, "a").close()
|
||||
|
||||
c = configparser.ConfigParser()
|
||||
c.read("config.ini")
|
||||
|
||||
@ -33,6 +44,10 @@ for f in todo:
|
||||
|
||||
objFile = objPath.replace(CLIP_PATH_TRANSFORM_FROM, CLIP_PATH_TRANSFORM_TO).replace("\\", "/")
|
||||
|
||||
if not os.path.isfile(objFile):
|
||||
print("ERROR: File not found: {}".format(objFile), file=sys.stderr)
|
||||
continue
|
||||
|
||||
cmd = [LOUDNESS_SCANNER, "scan", "-l", objFile]
|
||||
output = check_output(cmd, stderr=devnull)
|
||||
output = output.decode('utf-8')
|
||||
@ -67,3 +82,4 @@ for f in todo:
|
||||
|
||||
db.finish()
|
||||
|
||||
os.remove(LOCKFILE)
|
||||
|
Loading…
x
Reference in New Issue
Block a user