Skip to content

Commit f4317e0

Browse files
committed
- remote control server will not disable individual buttons, all buttons will be disabled/enabled on slow operations
- Updating win mplayer link
1 parent 866b09d commit f4317e0

File tree

2 files changed

+33
-16
lines changed

2 files changed

+33
-16
lines changed

pyradio/server.py

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ class PyRadioServer(object):
212212
<div class="col-xs-4 col-lg-4">
213213
<div class="text-center">
214214
<button id="rb" onclick="js_toggle_radio_browser();" type="button" class="btn btn-info">Radio<br>Browser</button>
215-
<button id="next" onclick="js_send_simple_command_with_stop('/html/next', 1500);" type="button" class="btn btn-warning">Play<br>Next</button>
216-
<button id="prev" onclick="js_send_simple_command_with_stop('/html/previous', 1500);" type="button" class="btn btn-warning">Play<br>Previous</button>
215+
<button id="next" onclick="js_play_next();" type="button" class="btn btn-warning">Play<br>Next</button>
216+
<button id="prev" onclick="js_play_previous();" type="button" class="btn btn-warning">Play<br>Previous</button>
217217
<button id="hnext" onclick="js_send_simple_command_with_stop('/html/histnext', 1500);" type="button" class="btn btn-success">Play Hist.<br> Next</button>
218218
<button id="hprev" onclick="js_send_simple_command_with_stop('/html/histprev', 1500);" type="button" class="btn btn-success">Play Hist.<br>Previous</button>
219219
<button id="tplay" onclick="js_send_simple_command_with_stop('/html/toggle', 1500);" type="button" class="btn btn-danger">Toggle<br>Playback</button>
@@ -370,7 +370,7 @@ class PyRadioServer(object):
370370
}
371371
372372
function js_send_simple_command(the_command, the_timeout){
373-
373+
// js_disable_all_buttons(true);
374374
console.log("the_command =", the_command);
375375
if ( ( the_command == "/html/open_radio_browser" ) || ( the_command == "/html/close_radio_browser" ) ) {
376376
clearTimeout(msg_timeout);
@@ -435,6 +435,7 @@ class PyRadioServer(object):
435435
result = '<div class="alert alert-success">Player mute state <b>toggled!</b></div>'
436436
} else if ( the_command == "/html/open_radio_browser" ) {
437437
result = '<div class="alert alert-success">Connection to <b>Radio Browser</b> established!</div>'
438+
js_fix_radio_browser();
438439
} else if ( the_command == "/html/close_radio_browser" ) {
439440
result = '<div class="alert alert-success"><b>Local</b> Playlist restored</div>'
440441
} else if ( ( the_command.startsWith("/html/search_radio_browser") ) || ( the_command.startsWith("/html/srb") ) ) {
@@ -504,9 +505,20 @@ class PyRadioServer(object):
504505
}
505506
}
506507
// console.log("--------");
508+
js_disable_all_buttons(false);
507509
});
508510
}
509511
512+
function js_play_next(){
513+
js_disable_all_buttons(true);
514+
js_send_simple_command_with_stop('/html/next', 1500)
515+
}
516+
517+
function js_play_previous(){
518+
js_disable_all_buttons(true);
519+
js_send_simple_command_with_stop('/html/previous', 1500)
520+
}
521+
510522
function js_set_title(a_tag, a_title, the_command=''){
511523
// console.log(" ", last_title);
512524
// console.log("a_title.length < last_title.length :", a_title.length < last_title.length);
@@ -576,15 +588,15 @@ class PyRadioServer(object):
576588
577589
function js_disable_group_button(enable){
578590
var element = document.getElementById("group");
579-
element.disabled = enable;
591+
// DIS element.disabled = enable;
580592
}
581593
582594
function js_disable_buttons_on_stopped(enable){
583595
let b_id = ["vu", "vd", "vs", "mute", "like" ];
584596
for (let i in b_id) {
585597
var element = document.getElementById(b_id[i]);
586598
// console.log("async:", data);
587-
element.disabled = enable;
599+
// DIS element.disabled = enable;
588600
}
589601
}
590602
@@ -598,7 +610,7 @@ class PyRadioServer(object):
598610
element.disabled = true;
599611
}
600612
}else{
601-
let b_id = ["rb", "next", "prev", "hnext", "hprev", "tplay", "st", "info", "vu", "vd", "vs", "group", "like", "pl"];
613+
let b_id = ["rb", "next", "prev", "hnext", "hprev", "tplay", "vu", "vd", "vs", "mute", "st", "group", "pl", "info", "logging", "like"];
602614
for (let i in b_id) {
603615
var element = document.getElementById(b_id[i]);
604616
// console.log("async:", data);
@@ -615,14 +627,14 @@ class PyRadioServer(object):
615627
var el_p = document.getElementById("hprev");
616628
var s = document.getElementById("pl");
617629
if ( window.radio_browser == 0 ){
618-
el_n.disabled = false;
619-
el_p.disabled = false;
630+
// DIS el_n.disabled = false;
631+
// DIS el_p.disabled = false;
620632
//s.disabled = true
621633
s.innerHTML = "Show<br>Playlists";
622634
// s.className = "btn btn-primary";
623635
}else{
624-
el_n.disabled = true;
625-
el_p.disabled = true;
636+
// DIS el_n.disabled = true;
637+
// DIS el_p.disabled = true;
626638
//s.disabled = false
627639
s.innerHTML = "Show<br>Searches";
628640
// s.className = "btn btn-danger";
@@ -633,15 +645,17 @@ class PyRadioServer(object):
633645
js_hide_msg();
634646
js_disable_all_buttons(true);
635647
var element = document.getElementById("rb");
636-
element.disabled = true;
648+
// DIS element.disabled = true;
637649
if ( window.radio_browser == 0 ){
638650
js_send_simple_command('/html/open_radio_browser', 1500)
639651
}else{
640652
js_send_simple_command('/html/close_radio_browser', 1500)
641653
}
642-
element.disabled = true;
643-
js_disable_all_buttons(false);
644-
js_fix_history_buttons();
654+
// DIS element.disabled = true;
655+
//js_disable_all_buttons(false);
656+
//js_fix_logging_titles();
657+
//js_fix_muted();
658+
//js_fix_history_buttons();
645659
}
646660
647661
function js_toggle_titles_logging(){
@@ -702,8 +716,11 @@ class PyRadioServer(object):
702716
window.radio_browser = 1
703717
}
704718
console.log("set radio_browser: ", radio_browser);
719+
js_disable_all_buttons(false);
720+
js_fix_muted();
705721
js_fix_history_buttons();
706-
element.disabled = false;
722+
js_fix_logging_titles();
723+
// DIS element.disabled = false;
707724
}
708725
getRadioBrowser();
709726
}

pyradio/win.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
https://sourceforge.net/projects/mpv-player-windows/files/latest/download
3939
'''
4040
zurl = [
41-
'https://sourceforge.com/projects/mpv-player-windows/files/64bit/mpv-x86_64-20231112-git-7cab30c.7z/download',
41+
'https://sourceforge.com/projects/mpv-player-windows/files/64bit/mpv-x86_64-20231231-git-abc2a74.7z/download',
4242
'https://sourceforge.net/projects/mplayerwin/files/MPlayer-MEncoder/r38151/mplayer-svn-38151-x86_64.7z/download'
4343
]
4444

0 commit comments

Comments
 (0)