use lists for all command stuff

This commit is contained in:
Jakob Ketterl 2019-12-28 16:44:45 +01:00
parent 489d2390c8
commit 86ceb7a274
5 changed files with 8 additions and 12 deletions

View File

@ -135,7 +135,7 @@ class SdrSource(ABC):
# preexec_fn can go as soon as there's no piped commands left
# the os.killpg call must be replaced with something more reasonable at the same time
self.process = subprocess.Popen(shlex.split(cmd), preexec_fn=os.setpgrp)
logger.info("Started rtl source: " + cmd)
logger.info("Started sdr source: " + cmd)
available = False

View File

@ -36,21 +36,18 @@ class DirectSource(SdrSource, metaclass=ABCMeta):
"These depend on nmux_memory and samp_rate options in config_webrx.py"
)
return "nmux --bufsize %d --bufcnt %d --port %d --address 127.0.0.1" % (
return ["nmux --bufsize %d --bufcnt %d --port %d --address 127.0.0.1" % (
nmux_bufsize,
nmux_bufcnt,
self.port,
)
)]
def getCommand(self):
return super().getCommand() + [
self.getFormatConversion(),
self.getNmuxCommand(),
]
return super().getCommand() + self.getFormatConversion() + self.getNmuxCommand()
# override this in subclasses, if necessary
def getFormatConversion(self):
return None
return []
# override this in subclasses, if necessary
def sleepOnRestart(self):

View File

@ -13,4 +13,4 @@ class FifiSdrSource(DirectSource):
return super().getEventNames() + ["device"]
def getFormatConversion(self):
return "csdr convert_s16_f | csdr gain_ff 30"
return ["csdr convert_s16_f", "csdr gain_ff 30"]

View File

@ -22,4 +22,4 @@ class HackrfSource(DirectSource):
]
def getFormatConversion(self):
return "csdr convert_s8_f"
return ["csdr convert_s8_f"]

View File

@ -33,8 +33,7 @@ class Resampler(DirectSource):
"csdr fir_decimate_cc {decimation} {ddc_transition_bw} HAMMING".format(
decimation=self.decimation, ddc_transition_bw=self.transition_bw
),
self.getNmuxCommand(),
]
] + self.getNmuxCommand()
def activateProfile(self, profile_id=None):
logger.warning("Resampler does not support setting profiles")