diff options
author | Cecil <knoppmyth@gmail.com> | 2011-12-22 01:57:32 (GMT) |
---|---|---|
committer | Cecil <knoppmyth@gmail.com> | 2011-12-22 01:57:32 (GMT) |
commit | 7c37daf6c751f73b0785bc6b851c7cc662f65447 (patch) | |
tree | c46d56f3c3c283dc3de31577befbea1ec9ed1bcf /abs/core/LinHES-system/myth_mtc.py | |
parent | 69701681f4cd221164da333d0ef0f1baf99bbf52 (diff) | |
parent | 02750b0fe64c4da69ff0dfc16178f1a79cec0b18 (diff) | |
download | linhes_pkgbuild-7c37daf6c751f73b0785bc6b851c7cc662f65447.zip linhes_pkgbuild-7c37daf6c751f73b0785bc6b851c7cc662f65447.tar.gz linhes_pkgbuild-7c37daf6c751f73b0785bc6b851c7cc662f65447.tar.bz2 |
Merge branch 'testing' of ssh://cesman@linhes.org/mount/repository/linhes_pkgbuild into testing
Diffstat (limited to 'abs/core/LinHES-system/myth_mtc.py')
-rwxr-xr-x | abs/core/LinHES-system/myth_mtc.py | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/abs/core/LinHES-system/myth_mtc.py b/abs/core/LinHES-system/myth_mtc.py index 5505b0a..1ed6c88 100755 --- a/abs/core/LinHES-system/myth_mtc.py +++ b/abs/core/LinHES-system/myth_mtc.py @@ -1,7 +1,7 @@ #!/usr/bin/python -import sys,popen2 +import sys, subprocess import optparse import re import socket @@ -10,11 +10,11 @@ import datetime,time -try: - from MythTV import MythTV - mythtv = MythTV() -except: - mythtv = None +#try: +from MythTV import MythBE +mythtv = MythBE() +#except: +# mythtv = None #print mythtv.db.getSetting( 'Theme', socket.gethostname()) @@ -86,14 +86,21 @@ def in_use(): return False def mfd_check(): - ismfd=popen2.Popen3('/bin/ps cax|/bin/grep -v grep |/bin/grep mythfilldatabase') - ismfd.wait() - mfdIdle=ismfd.poll() - if mfdIdle == 0: - print "mythfilldatabase is running" - return False - else: - return True + ps = subprocess.Popen("ps ax -o pid= -o args= ", shell=True, stdout=subprocess.PIPE) + ps_pid = ps.pid + output = ps.stdout.read() + ps.stdout.close() + ps.wait() + proc_name="mythfilldatabase" + for line in output.split("\n"): + res = re.findall("(\d+) (.*)", line) + if res: + pid = int(res[0][0]) + if proc_name in res[0][1] and pid != os.getpid() and pid != ps_pid: + print "mythfilldatabase is running" + return False + + return True |