]> git.parisson.com Git - telecaster-client.git/commitdiff
avoid 'LIVE' telecaster process to be parsed by get_id()
authoryomguy <>
Mon, 21 Sep 2009 21:20:39 +0000 (21:20 +0000)
committeryomguy <>
Mon, 21 Sep 2009 21:20:39 +0000 (21:20 +0000)
station.py
telecaster.py
tools/tools.py

index a97fdf123175b3de4440475b2928aff3ab7c478a..63b4a7df606c85ab698ea3cab8125b40c53dfd95 100644 (file)
@@ -81,7 +81,7 @@ class Station(Conference):
         self.output_dir = self.media_dir + os.sep + self.department + os.sep + self.date
         self.file_dir = self.output_dir + os.sep + self.ServerName
         self.uid = os.getuid()
-        self.odd_pid = get_pid('^oddcastv3 -n [^LIVE]', self.uid)
+        self.odd_pid = get_pid('^oddcastv3\ -n', self.uid)
         self.rip_pid = get_pid('streamripper ' + self.url + self.mount_point, self.uid)
         self.new_title = clean_string('_-_'.join(self.server_name)+'_-_'+self.session+'_-_'+self.professor+'_-_'+self.comment)
         self.short_title = clean_string('_-_'.join(self.conference)+'_-_'+self.session+'_-_'+self.professor+'_-_'+self.comment)
index 4b14edb37bf5d4d353cee258e79aeeb5835964d3..43732d8c2252a91d27eada3776a3622bf075d066 100755 (executable)
@@ -58,7 +58,7 @@ class TeleCaster:
         self.uid = os.getuid()
 
     def main(self):
-        odd_pid = get_pid('^oddcastv3 -n [^LIVE]', self.uid)
+        odd_pid = get_pid('^oddcastv3\ -n', self.uid)
         rip_pid = get_pid('streamripper ', self.uid)
         writing = False
         casting = False
index 89fcfa17349176d05f1bb6fcbf8ed9f65a783504..9e840505dd64d9337c89aada489fb613959b69a9 100644 (file)
@@ -63,12 +63,15 @@ def xml2dict(conf_file):
 
 def get_pid(proc,uid):
     """Get a process pid filtered by arguments and uid"""
-    (list1, list2) = os.popen4('pgrep -n -f -U '+str(uid)+' '+'"'+proc+'"')
-    pids = list2.readlines()
-    if pids != '':
-        for pid in pids:
-            index = pids.index(pid)
-            pids[index] = pid[:-1]
+    (list1, list2) = os.popen4('pgrep -fl -U '+str(uid)+' '+'"'+proc+'"')
+    procs = list2.readlines()
+    pids = []
+    if procs != '':
+        for proc in procs:
+            pid = proc.split(' ')[0]
+            command = ' '.join(proc.split(' ')[1:])[:-1]
+            if not 'LIVE' in command:
+                pids.append(pid)
     return pids
 
 def get_params_from_lock(lock_file):