Compare commits

..

2 Commits

Author SHA1 Message Date
Jakob Ketterl
57f55bbdd5
Merge pull request #342 from bd5rv/develop
Add --no-http-keep-alive to wget's arguments
2023-03-10 21:11:31 +01:00
Michael Chen
e8ba61bb81
Add --no-http-keep-alive to wget's arguments
When downloading SDRPlay API from sdrplay.com'server, it reports 403 forbidden error when the environment variable https_proxy is set. Adding --no-http-keep-live argument to wget will make the download working.
2023-03-11 00:31:19 +08:00
7 changed files with 39 additions and 73 deletions

View File

@ -38,7 +38,7 @@ case $ARCH in
;;
esac
wget https://www.sdrplay.com/software/$BINARY
wget --no-http-keep-alive https://www.sdrplay.com/software/$BINARY
sh $BINARY --noexec --target sdrplay
patch --verbose -Np0 < /install-lib.$ARCH.patch

View File

@ -11,7 +11,7 @@ function BookmarkBar() {
if (!b || !b.frequency || !b.modulation) return;
me.getDemodulator().set_offset_frequency(b.frequency - center_freq);
if (b.modulation) {
me.getDemodulatorPanel().setMode(b.modulation, b.underlying);
me.getDemodulatorPanel().setMode(b.modulation);
}
$bookmark.addClass('selected');
});

View File

@ -18,12 +18,7 @@ function DemodulatorPanel(el) {
el.on('click', '.openwebrx-demodulator-button', function() {
var modulation = $(this).data('modulation');
if (modulation) {
if (self.mode && self.mode.type === 'digimode' && self.mode.underlying.indexOf(modulation) >= 0) {
// keep the mode, just switch underlying modulation
self.setMode(self.mode.modulation, modulation)
} else {
self.setMode(modulation);
}
} else {
self.disableDigiMode();
}
@ -85,13 +80,12 @@ DemodulatorPanel.prototype.render = function() {
this.el.find(".openwebrx-modes").html(html);
};
DemodulatorPanel.prototype.setMode = function(requestedModulation, underlyingModulation) {
DemodulatorPanel.prototype.setMode = function(requestedModulation) {
var mode = Modes.findByModulation(requestedModulation);
if (!mode) {
return;
}
if (this.mode === mode && this.underlyingModulation === underlyingModulation) {
if (this.mode === mode) {
return;
}
if (!mode.isAvailable()) {
@ -99,16 +93,17 @@ DemodulatorPanel.prototype.setMode = function(requestedModulation, underlyingMod
return;
}
var modulation;
if (mode.type === 'digimode') {
if (underlyingModulation) {
modulation = underlyingModulation
} else {
modulation = mode.underlying[0];
}
} else {
if (this.mode && this.mode.type === 'digimode' && this.mode.underlying.indexOf(requestedModulation) >= 0) {
// keep the mode, just switch underlying modulation
mode = this.mode;
modulation = requestedModulation;
} else {
modulation = mode.modulation;
}
}
var current = this.collectParams();
if (this.demodulator) {
@ -147,7 +142,6 @@ DemodulatorPanel.prototype.setMode = function(requestedModulation, underlyingMod
this.demodulator.start();
this.mode = mode;
this.underlyingModulation = modulation;
this.updateButtons();
this.updatePanels();
@ -155,6 +149,8 @@ DemodulatorPanel.prototype.setMode = function(requestedModulation, underlyingMod
};
DemodulatorPanel.prototype.disableDigiMode = function() {
// just a little trick to get out of the digimode
delete this.mode;
this.setMode(this.getDemodulator().get_modulation());
};
@ -207,11 +203,7 @@ DemodulatorPanel.prototype.stopDemodulator = function() {
}
DemodulatorPanel.prototype._apply = function(params) {
if (params.secondary_mod) {
this.setMode(params.secondary_mod, params.mod)
} else {
this.setMode(params.mod);
}
this.getDemodulator().set_offset_frequency(params.offset_frequency);
this.getDemodulator().setSquelch(params.squelch_level);
this.updateButtons();
@ -231,9 +223,8 @@ DemodulatorPanel.prototype.onHashChange = function() {
DemodulatorPanel.prototype.transformHashParams = function(params) {
var ret = {
mod: params.mod
mod: params.secondary_mod || params.mod
};
if (typeof(params.secondary_mod) !== 'undefined') ret.secondary_mod = params.secondary_mod;
if (typeof(params.offset_frequency) !== 'undefined') ret.offset_frequency = params.offset_frequency;
if (typeof(params.sql) !== 'undefined') ret.squelch_level = parseInt(params.sql);
return ret;
@ -338,7 +329,7 @@ DemodulatorPanel.prototype.updateHash = function() {
freq: demod.get_offset_frequency() + self.center_freq,
mod: demod.get_modulation(),
secondary_mod: demod.get_secondary_demod(),
sql: demod.getSquelch()
sql: demod.getSquelch(),
}, function(value, key){
if (typeof(value) === 'undefined' || value === false) return undefined;
return key + '=' + value;

View File

@ -831,8 +831,7 @@ function on_ws_recv(evt) {
return {
name: d['mode'].toUpperCase(),
modulation: d['mode'],
frequency: d['frequency'],
underlying: d['underlying']
frequency: d['frequency']
};
});
bookmarks.replace_bookmarks(as_bookmarks, 'dial_frequencies');

View File

@ -1,4 +1,4 @@
from owrx.modes import Modes, DigitalMode
from owrx.modes import Modes
from datetime import datetime, timezone
import json
import os
@ -9,14 +9,14 @@ logger = logging.getLogger(__name__)
class Band(object):
def __init__(self, b_dict):
self.name = b_dict["name"]
self.lower_bound = b_dict["lower_bound"]
self.upper_bound = b_dict["upper_bound"]
def __init__(self, dict):
self.name = dict["name"]
self.lower_bound = dict["lower_bound"]
self.upper_bound = dict["upper_bound"]
self.frequencies = []
if "frequencies" in b_dict:
if "frequencies" in dict:
availableModes = [mode.modulation for mode in Modes.getAvailableModes()]
for (mode, freqs) in b_dict["frequencies"].items():
for (mode, freqs) in dict["frequencies"].items():
if mode not in availableModes:
logger.info(
'Modulation "{mode}" is not available, bandplan bookmark will not be displayed'.format(
@ -27,30 +27,14 @@ class Band(object):
if not isinstance(freqs, list):
freqs = [freqs]
for f in freqs:
f_dict = {"frequency": f} if not isinstance(f, dict) else f
f_dict["mode"] = mode
if not self.inBand(f_dict["frequency"]):
if not self.inBand(f):
logger.warning(
"Frequency for {mode} on {band} is not within band limits: {frequency}".format(
mode=mode, frequency=f_dict["frequency"], band=self.name
mode=mode, frequency=f, band=self.name
)
)
continue
if "underlying" in f_dict:
m = Modes.findByModulation(mode)
if not isinstance(m, DigitalMode):
logger.warning("%s is not a digital mode, cannot be used with \"underlying\" config", mode)
continue
if f_dict["underlying"] not in m.underlying:
logger.warning(
"%s is not a valid underlying mode for %s; skipping",
f_dict["underlying"],
mode
)
self.frequencies.append(f_dict)
self.frequencies.append({"mode": mode, "frequency": f})
def inBand(self, freq):
return self.lower_bound <= freq <= self.upper_bound

View File

@ -55,13 +55,6 @@ class DigitalMode(Mode):
def get_modulation(self):
return self.get_underlying_mode().get_modulation()
def for_underlying(self, underlying: str):
if underlying not in self.underlying:
raise ValueError("{} is not a valid underlying mode for {}".format(underlying, self.modulation))
return DigitalMode(
self.modulation, self.name, [underlying], self.bandpass, self.requirements, self.service, self.squelch
)
class AudioChopperMode(DigitalMode, metaclass=ABCMeta):
def __init__(self, modulation, name, bandpass=None, requirements=None):

View File

@ -123,11 +123,13 @@ class ServiceHandler(SdrSourceEventClient):
def updateServices(self):
def addService(dial, source):
mode = dial["mode"]
frequency = dial["frequency"]
try:
service = self.setupService(dial, source)
service = self.setupService(mode, frequency, source)
self.services.append(service)
except Exception:
logger.exception("Error setting up service {mode} on frequency {frequency}".format(**dial))
logger.exception("Error setting up service %s on frequency %d", mode, frequency)
with self.lock:
logger.debug("re-scheduling services due to sdr changes")
@ -245,26 +247,23 @@ class ServiceHandler(SdrSourceEventClient):
return None
return best["groups"]
def setupService(self, dial, source):
logger.debug("setting up service {mode} on frequency {frequency}".format(**dial))
def setupService(self, mode, frequency, source):
logger.debug("setting up service {0} on frequency {1}".format(mode, frequency))
modeObject = Modes.findByModulation(dial["mode"])
modeObject = Modes.findByModulation(mode)
if not isinstance(modeObject, DigitalMode):
logger.warning("mode is not a digimode: %s", dial["mode"])
logger.warning("mode is not a digimode: %s", mode)
return None
if "underlying" in dial:
modeObject = modeObject.for_underlying(dial["underlying"])
demod = self._getDemodulator(modeObject.get_modulation())
secondaryDemod = self._getSecondaryDemodulator(modeObject.modulation)
center_freq = source.getProps()["center_freq"]
sampleRate = source.getProps()["samp_rate"]
bandpass = modeObject.get_bandpass()
if isinstance(secondaryDemod, DialFrequencyReceiver):
secondaryDemod.setDialFrequency(dial["frequency"])
secondaryDemod.setDialFrequency(frequency)
chain = ServiceDemodulatorChain(demod, secondaryDemod, sampleRate, dial["frequency"] - center_freq)
chain = ServiceDemodulatorChain(demod, secondaryDemod, sampleRate, frequency - center_freq)
chain.setBandPass(bandpass.low_cut, bandpass.high_cut)
chain.setReader(source.getBuffer().getReader())