diff --git a/config_webrx.py b/config_webrx.py index 12f9c14..eaba803 100644 --- a/config_webrx.py +++ b/config_webrx.py @@ -236,4 +236,6 @@ google_maps_api_key = "" # how long should positions be visible on the map? # they will start fading out after half of that # in seconds; default: 2 hours -map_position_retention_time = 2 * 60 * 60 \ No newline at end of file +map_position_retention_time = 2 * 60 * 60 + +temporary_directory = "/tmp" diff --git a/csdr.py b/csdr.py index 4f72c98..43bd0ac 100755 --- a/csdr.py +++ b/csdr.py @@ -74,6 +74,10 @@ class dsp(object): self.unvoiced_quality = 1 self.modification_lock = threading.Lock() self.output = output + self.temporary_directory = "/tmp" + + def set_temporary_directory(self, what): + self.temporary_directory = what def chain(self,which): chain = ["nc -v 127.0.0.1 {nc_port}"] @@ -468,7 +472,7 @@ class dsp(object): logger.debug(command_base) #create control pipes for csdr - self.pipe_base_path="/tmp/openwebrx_pipe_{myid}_".format(myid=id(self)) + self.pipe_base_path = "{tmp_dir}/openwebrx_pipe_{myid}_".format(tmp_dir=self.temporary_directory, myid=id(self)) self.try_create_pipes(self.pipe_names, command_base) diff --git a/owrx/source.py b/owrx/source.py index 3f1b2ac..7a37ef6 100644 --- a/owrx/source.py +++ b/owrx/source.py @@ -275,7 +275,7 @@ class SpectrumThread(csdr.output): self.props = props = self.sdrSource.props.collect( "samp_rate", "fft_size", "fft_fps", "fft_voverlap_factor", "fft_compression", - "csdr_dynamic_bufsize", "csdr_print_bufsizes", "csdr_through" + "csdr_dynamic_bufsize", "csdr_print_bufsizes", "csdr_through", "temporary_directory" ).defaults(PropertyManager.getSharedInstance()) self.dsp = dsp = csdr.dsp(self) @@ -295,6 +295,7 @@ class SpectrumThread(csdr.output): props.getProperty("fft_size").wire(dsp.set_fft_size), props.getProperty("fft_fps").wire(dsp.set_fft_fps), props.getProperty("fft_compression").wire(dsp.set_fft_compression), + props.getProperty("temporary_directory").wire(dsp.set_temporary_directory), props.collect("samp_rate", "fft_size", "fft_fps", "fft_voverlap_factor").wire(set_fft_averages) ] @@ -352,7 +353,7 @@ class DspManager(csdr.output): self.localProps = self.sdrSource.getProps().collect( "audio_compression", "fft_compression", "digimodes_fft_size", "csdr_dynamic_bufsize", "csdr_print_bufsizes", "csdr_through", "digimodes_enable", "samp_rate", "digital_voice_unvoiced_quality", - "dmr_filter" + "dmr_filter", "temporary_directory" ).defaults(PropertyManager.getSharedInstance()) self.dsp = csdr.dsp(self) @@ -380,7 +381,8 @@ class DspManager(csdr.output): self.localProps.getProperty("high_cut").wire(set_high_cut), self.localProps.getProperty("mod").wire(self.dsp.set_demodulator), self.localProps.getProperty("digital_voice_unvoiced_quality").wire(self.dsp.set_unvoiced_quality), - self.localProps.getProperty("dmr_filter").wire(self.dsp.set_dmr_filter) + self.localProps.getProperty("dmr_filter").wire(self.dsp.set_dmr_filter), + self.localProps.getProperty("temporary_directory").wire(self.dsp.set_temporary_directory) ] self.dsp.set_offset_freq(0) diff --git a/owrx/wsjt.py b/owrx/wsjt.py index 7bb10cc..fc07b10 100644 --- a/owrx/wsjt.py +++ b/owrx/wsjt.py @@ -8,6 +8,7 @@ import os from multiprocessing.connection import Pipe from owrx.map import Map, LocatorLocation import re +from owrx.config import PropertyManager import logging logger = logging.getLogger(__name__) @@ -16,6 +17,7 @@ logger = logging.getLogger(__name__) class Ft8Chopper(threading.Thread): def __init__(self, source): self.source = source + self.tmp_dir = PropertyManager.getSharedInstance()["temporary_directory"] (self.wavefilename, self.wavefile) = self.getWaveFile() self.switchingLock = threading.Lock() self.scheduler = sched.scheduler(time.time, time.sleep) @@ -25,7 +27,8 @@ class Ft8Chopper(threading.Thread): super().__init__() def getWaveFile(self): - filename = "/tmp/openwebrx-ft8chopper-{id}-{timestamp}.wav".format( + filename = "{tmp_dir}/openwebrx-ft8chopper-{id}-{timestamp}.wav".format( + tmp_dir = self.tmp_dir, id = id(self), timestamp = datetime.now().strftime("%Y%m%d-%H%M%S") ) @@ -70,7 +73,7 @@ class Ft8Chopper(threading.Thread): def decode(self): def decode_and_unlink(file): #TODO expose decoding quality parameters through config - decoder = subprocess.Popen(["jt9", "--ft8", "-d", "3", file], stdout=subprocess.PIPE) + decoder = subprocess.Popen(["jt9", "--ft8", "-d", "3", file], stdout=subprocess.PIPE, cwd=self.tmp_dir) while True: line = decoder.stdout.readline() if line is None or (isinstance(line, bytes) and len(line) == 0):