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)
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
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):