check for csdr & digiham python bindings

This commit is contained in:
Jakob Ketterl 2022-06-01 16:43:18 +02:00
parent f018ef1d81
commit 843dde1a68

View File

@ -52,7 +52,7 @@ class FeatureCache(object):
class FeatureDetector(object): class FeatureDetector(object):
features = { features = {
# core features; we won't start without these # core features; we won't start without these
"core": ["csdr", "pycsdr"], "core": ["csdr"],
# different types of sdrs and their requirements # different types of sdrs and their requirements
"rtl_sdr": ["rtl_connector"], "rtl_sdr": ["rtl_connector"],
"rtl_sdr_soapy": ["soapy_connector", "soapy_rtl_sdr"], "rtl_sdr_soapy": ["soapy_connector", "soapy_rtl_sdr"],
@ -171,27 +171,24 @@ class FeatureDetector(object):
except FileNotFoundError: except FileNotFoundError:
return False return False
_required_csdr_version = LooseVersion("0.18.0")
def has_csdr(self): def has_csdr(self):
""" """
OpenWebRX uses the demodulator and pipeline tools provided by the csdr project. Please check out [the project OpenWebRX uses the demodulator and pipeline tools provided by the csdr project. Please check out [the project
page on github](https://github.com/jketterl/csdr) for further details and installation instructions. page on github](https://github.com/jketterl/csdr) for further details and installation instructions.
In addition, the [pycsdr](https://github.com/jketterl/pycsdr) package must be installed to provide
python bindings for the csdr library.
""" """
required_version = LooseVersion("0.18.0")
try: try:
from pycsdr.modules import csdr_version from pycsdr.modules import csdr_version
return LooseVersion(csdr_version) >= FeatureDetector._required_csdr_version
except ImportError:
return False
def has_pycsdr(self):
"""
OpenWebRX uses the csdr python bindings from the pycsdr package to build its demodulator pipelines.
Please visit [the project page](https://github.com/jketterl/pycsdr) for further details.
"""
try:
from pycsdr.modules import version as pycsdr_version from pycsdr.modules import version as pycsdr_version
return LooseVersion(pycsdr_version) >= FeatureDetector._required_csdr_version
return (
LooseVersion(csdr_version) >= required_version and
LooseVersion(pycsdr_version) >= required_version
)
except ImportError: except ImportError:
return False return False
@ -226,15 +223,23 @@ class FeatureDetector(object):
To use digital voice modes, the digiham package is required. You can find the package and installation To use digital voice modes, the digiham package is required. You can find the package and installation
instructions [here](https://github.com/jketterl/digiham). instructions [here](https://github.com/jketterl/digiham).
In addition, the [pydigiham](https://github.com/jketterl/pydigiham) package must be installed to provide
python bindings for the digiham library.
Please note: there is close interaction between digiham and openwebrx, so older versions will probably not work. Please note: there is close interaction between digiham and openwebrx, so older versions will probably not work.
If you have an older verison of digiham installed, please update it along with openwebrx. If you have an older verison of digiham installed, please update it along with openwebrx.
As of now, we require version 0.3 of digiham. As of now, we require version 0.6 of digiham.
""" """
required_version = LooseVersion("0.5") required_version = LooseVersion("0.6")
try: try:
from digiham.modules import version as digiham_version from digiham.modules import digiham_version as digiham_version
return LooseVersion(digiham_version) >= required_version from digiham.modules import version as pydigiham_version
return (
LooseVersion(digiham_version) >= required_version
and LooseVersion(pydigiham_version) >= required_version
)
except ImportError: except ImportError:
return False return False
@ -469,6 +474,7 @@ class FeatureDetector(object):
required_version = StrictVersion("0.1") required_version = StrictVersion("0.1")
try: try:
from js8py.version import strictversion from js8py.version import strictversion
return strictversion >= required_version return strictversion >= required_version
except ImportError: except ImportError:
return False return False
@ -545,6 +551,7 @@ class FeatureDetector(object):
server = config["digital_voice_codecserver"] server = config["digital_voice_codecserver"]
try: try:
from digiham.modules import MbeSynthesizer from digiham.modules import MbeSynthesizer
return MbeSynthesizer.hasAmbe(server) return MbeSynthesizer.hasAmbe(server)
except ImportError: except ImportError:
return False return False