Projects
Multimedia
welle-io
base_dir.patch
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File base_dir.patch of Package welle-io (Revision 6)
Currently displaying revision
6
,
Show latest
diff --git a/CMakeLists.txt b/CMakeLists.txt index 7dbdc9ca..d0ab53c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.2) +cmake_minimum_required(VERSION 3.10) project(Welle.Io LANGUAGES C CXX) @@ -13,7 +13,7 @@ if(NOT WELLE-IO_VERSION) endif() set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 17) option(BUILD_WELLE_IO "Build Welle.io" ON ) option(BUILD_WELLE_CLI "Build welle-cli" ON ) @@ -200,8 +200,8 @@ endif() if (SOAPYSDR) find_package(SoapySDR NO_MODULE REQUIRED) - # Note: SoapySDRConfig.cmake sets C++11 standard so it needs to be reset to C++14 - set(CMAKE_CXX_STANDARD 14) + # Note: SoapySDRConfig.cmake sets C++11 standard so it needs to be reset to C++17 + set(CMAKE_CXX_STANDARD 17) endif() include_directories( diff --git a/src/welle-cli/webradiointerface.cpp b/src/welle-cli/webradiointerface.cpp index 74c51425..d57ceecc 100644 --- a/src/welle-cli/webradiointerface.cpp +++ b/src/welle-cli/webradiointerface.cpp @@ -24,6 +24,7 @@ */ #include "welle-cli/webradiointerface.h" +#include <filesystem> #include <algorithm> #include <cmath> #include <complex> @@ -131,13 +132,15 @@ static bool send_http_response(Socket& s, const string& statuscode, WebRadioInterface::WebRadioInterface(CVirtualInput& in, int port, + const string &base_dir, DecodeSettings ds, RadioReceiverOptions rro) : dabparams(1), input(in), spectrum_fft_handler(dabparams.T_u), rro(rro), - decode_settings(ds) + decode_settings(ds), + base_dir(base_dir) { { // Ensure that rx always exists when rx_mut is free! @@ -563,7 +566,17 @@ bool WebRadioInterface::send_file(Socket& s, const std::string& filename, const std::string& content_type) { - FILE *fd = fopen(filename.c_str(), "r"); + std::filesystem::path path_name; + if (!base_dir.empty()) + { + path_name = base_dir; + path_name /= filename; + } + else + { + path_name = filename; + } + FILE *fd = fopen(path_name.c_str(), "r"); if (fd) { if (not send_http_response(s, http_ok, "", content_type)) { cerr << "Failed to send file headers" << endl; diff --git a/src/welle-cli/webradiointerface.h b/src/welle-cli/webradiointerface.h index f029e48b..81cae0ea 100644 --- a/src/welle-cli/webradiointerface.h +++ b/src/welle-cli/webradiointerface.h @@ -75,6 +75,7 @@ class WebRadioInterface : public RadioControllerInterface { WebRadioInterface( CVirtualInput& in, int port, + const std::string& base_dir, DecodeSettings cs, RadioReceiverOptions rro); ~WebRadioInterface(); @@ -215,4 +216,6 @@ class WebRadioInterface : public RadioControllerInterface { std::chrono::time_point<std::chrono::steady_clock> time_change; }; std::list<ActiveCarouselService> carousel_services_active; + + std::string base_dir; }; diff --git a/src/welle-cli/welle-cli.cpp b/src/welle-cli/welle-cli.cpp index cf84060e..c02f5106 100644 --- a/src/welle-cli/welle-cli.cpp +++ b/src/welle-cli/welle-cli.cpp @@ -275,6 +275,7 @@ class RadioInterface : public RadioControllerInterface { struct options_t { string soapySDRDriverArgs = ""; string antenna = ""; + string base_dir = ""; int gain = -1; string channel = "10B"; string iqsource = ""; @@ -314,6 +315,7 @@ static void usage() endl << "Web server mode:" << endl << " -w port Enable web server on port <port>." << endl << + " -b path Base directory of index.html and index.js files." << endl << " -C number Number of programmes to decode in a carousel" << endl << " (to be used with -w, cannot be used with -D)." << endl << " This is useful if your machine cannot decode all programmes" << endl << @@ -409,11 +411,14 @@ options_t parse_cmdline(int argc, char **argv) options.rro.decodeTII = true; int opt; - while ((opt = getopt(argc, argv, "A:c:C:dDf:F:g:hp:O:Ps:Tt:uvw:")) != -1) { + while ((opt = getopt(argc, argv, "A:b:c:C:dDf:F:g:hp:O:Ps:Tt:uvw:")) != -1) { switch (opt) { case 'A': options.antenna = optarg; break; + case 'b': + options.base_dir = optarg; + break; case 'c': options.channel = optarg; break; @@ -605,7 +610,7 @@ int main(int argc, char **argv) return 1; } - WebRadioInterface wri(*in, options.web_port, ds, options.rro); + WebRadioInterface wri(*in, options.web_port, options.base_dir, ds, options.rro); wri.serve(); } else {
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.