I am aware of the "finetune" when you are switching frequency, but that's something that original author might improve properly.
I removed the "retry" since it didn't work. Once channel change occured, it will sleep for 2 seconds (instead of 20 that it was before).
So we might need to "retry" on same channel.
diff --git a/src/welle-cli/webradiointerface.cpp b/src/welle-cli/webradiointerface.cpp index 1372b94..9e9818b 100644 --- a/src/welle-cli/webradiointerface.cpp +++ b/src/welle-cli/webradiointerface.cpp @@ -439,10 +439,10 @@ bool WebRadioInterface::dispatch_client(Socket&& client) else { if (req.is_get) { if (req.url == "/") { - success = send_file(s, "index.html", http_contenttype_html); + success = send_file(s, "/usr/share/welle-io/html/index.html", http_contenttype_html); } else if (req.url == "/index.js") { - success = send_file(s, "index.js", http_contenttype_js); + success = send_file(s, "/usr/share/welle-io/html/index.js", http_contenttype_js); } else if (req.url == "/mux.json") { success = send_mux_json(s); @@ -474,9 +474,29 @@ bool WebRadioInterface::dispatch_client(Socket&& client) const regex regex_slide(R"(^[/]slide[/]([^ ]+))"); std::smatch match_slide; + const regex regex_tune_mp3(R"(^[/]mp3[/]([56789][A-D]|1[123][A-D]|13[EF]|L[A-P])[/]([^ ]+))"); const regex regex_mp3(R"(^[/]mp3[/]([^ ]+))"); std::smatch match_mp3; - if (regex_search(req.url, match_mp3, regex_mp3)) { + if (regex_search(req.url, match_mp3, regex_tune_mp3)) { + cerr << "GET channel: " << match_mp3[1] << endl; + try { + const auto freq = input.getFrequency(); + const auto chan = channels.getChannelForFrequency(freq); + const auto newchan = match_mp3[1]; + if (newchan != chan) { + retune(newchan); + this_thread::sleep_for(chrono::seconds(2)); + } + else { + cerr << "Retune not required..." << endl; + } + } + catch (const out_of_range& e) { + cerr << "Failed to retune " << e.what() << endl; + } + success = send_mp3(s, match_mp3[2]); + } + else if (regex_search(req.url, match_mp3, regex_mp3)) { success = send_mp3(s, match_mp3[1]); } else if (regex_search(req.url, match_slide, regex_slide)) {
In the meanwhile i did opened two issues on gihub: https://github.com/A...e.io/issues/559 and https://github.com/A...e.io/issues/560
If you just like to hear music, then it works great. If you like to zap on stations, that will be problematic every time you are moving on different channel.
Attached Files
Edited by athoik, 24 May 2020 - 19:05.