Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Confusion with os.popen os.spawnl and dvbstream

Reply
Thread Tools

Confusion with os.popen os.spawnl and dvbstream

 
 
Steve Homer
Guest
Posts: n/a
 
      04-29-2004
Hi everyone,

Appologies if this is the wrong forum for this post.

I am a little confused by the code below and any help would be much
appreciated.

import os,signal,time,sys

class Tzap:
tzap_exe = '/usr/local/bin/tzap'

def __init__(self, channel_string):
self.channel = channel_string

def SetChannel(self):
print "Tzap.SetChannel()"
self.channelpid = os.spawnlp(os.P_NOWAIT, self.tzap_exe,
self.tzap_exe, self.channel)
time.sleep(5)
os.kill(self.channelpid, signal.SIGKILL)
print "End Tzap.SetChannel()"

class Record:
dvbstream_exe = '/usr/local/bin/dvbstream'

def __init__(self, minutes_to_record):
self.duration = minutes_to_record

def Record(self):
commandline = ' -ps 600 601 -o > /Media/Movies/BBC.mpg'
print self.dvbstream_exe, commandline

# These are the confusing lines....

#self.dvbstream_pid = os.popen3(self.dvbstream_exe +
commandline)
self.dvbstream_pid = os.spawnl(os.P_NOWAIT,
self.dvbstream_exe, self.dvbstream_exe, commandline)

time.sleep(self.duration * 60)

os.kill(self.dvbstream_pid, signal.SIGKILL)


print "start tzap"
tzap = Tzap('BBC ONE')
tzap.SetChannel()
print "stop tzap"
print "start record"
recorder = Record(1)
recorder.Record()

using the popen3 function I get an mpg stream recording in BBC.mpg but
using spawnl I get the following

/usr/local/bin/dvbstream -ps 600 601 -o > /Media/Movies/BBC.mpg
dvbstream v0.5 - (C) Dave Chapman 2001-2004
Released under the GPL.
Latest version available from http://www.linuxstb.org/
Using 224.0.1.2:5004:2
version=2
Streaming 0 streams

and no data in the file. I guess this is something to do with the
different environment in each case, but I don't know where to start
debugging it. Any pointers would be much appreciated.

Thanks,
Steve

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
TexChanged event and Click event confusion Tommy ASP .Net 3 07-19-2005 01:57 PM
Confusion Over Postback, ViewState and Dynamically Added Controls =?Utf-8?B?Q2hyaXN0aWFuIE51bmNpYXRv?= ASP .Net 1 05-03-2005 12:02 AM
Managed and Unmanaged Code Confusion =?Utf-8?B?U2FuZHk=?= ASP .Net 2 10-26-2004 01:25 PM
ASP .NET and ASP style confusion. Immediate solution required =?Utf-8?B?TW9oaXQgR3VwdGE=?= ASP .Net 1 10-18-2004 01:52 PM
calls and code behind / response.write confusion =?Utf-8?B?ZXRyb3BpYw==?= ASP .Net 4 05-06-2004 03:11 AM



Advertisments