Skip to content

Commit

Permalink
Merge pull request #1672 from rern/UPDATE
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
rern authored May 18, 2024
2 parents 2a6a53b + 6edfb00 commit 9859359
Show file tree
Hide file tree
Showing 28 changed files with 348 additions and 283 deletions.
40 changes: 22 additions & 18 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,19 @@ alias=r1

. /srv/http/bash/settings/addons.sh

# 20240315
[[ -e /usr/bin/iwctl ]] && groupadd -f netdev

# 20240303
file=/etc/udev/rules.d/bluetooth.rules
if [[ -e $file ]] && grep -q bluetoothcommand $file; then
sed -i 's|bluetoothcommand|settings/networks-bluetooth|' $file
udevadm control --reload-rules
udevadm trigger
fi

file=/usr/lib/systemd/system/camilladsp.service
if [[ -e $file ]] && ! grep -q {CONFIG} $file; then
sed -i 's/CONFIG/{CONFIG}/' $file
systemctl daemon-reload
# 20240517
! grep -q cmdsh /srv/http/bash/websocket-server.py && restartws=1

file=/srv/http/data/mpdconf/conf/snapserver.conf
if grep -q snapcast $file; then
echo 'audio_output {
name "SnapServer"
type "fifo"
path "/tmp/snapfifo"
format "48000:16:2"
}' > $file
[[ -e $dirmpdconf/snapserver.conf ]] && restart=snapserver
[[ -e $dirsystem/snapclient ]] && restart+=' snapclient'
fi

#-------------------------------------------------------------------------------
Expand All @@ -33,8 +31,14 @@ dirPermissions
cacheBust
[[ -e $dirsystem/color ]] && $dirbash/cmd.sh color

# 20240315
echo "$bar Restart MPD ..."
$dirsettings/player-conf.sh
# 20240517
[[ $restartws ]] && systemctl restart websocket

for snap in $restart; do
$dirsettings/features.sh $snap
$dirsettings/features.sh "$snap
true
CMD ON"
done

installfinish
2 changes: 1 addition & 1 deletion srv/http/assets/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

@font-face {
font-family : rern;
src : url( '/assets/fonts/rern.woff2?v=1710720937' );
src : url( '/assets/fonts/rern.woff2?v=1715523326' );
}
@font-face {
font-family : Lato;
Expand Down
112 changes: 56 additions & 56 deletions srv/http/assets/img/gpio.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 8 additions & 3 deletions srv/http/assets/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ function info( json ) {
case 'hidden':
case 'number':
case 'text':
htmls.list += '<input type="'+ type +'"'+ ( param.updn ? ' disabled' : '' ) +'>';
htmls.list += '<input type="'+ type +'"'+ ( param.updn && ! param.updn.enable ? ' disabled' : '' ) +'>';
if ( param.suffix ) {
htmls.list += '<td>&nbsp;<gr>'+ param.suffix +'</gr>';
} else if ( param.updn ) {
Expand Down Expand Up @@ -890,7 +890,12 @@ function infoSetValues() {
type = $this.prop( 'type' );
val = I.values[ i ];
if ( type === 'radio' ) { // reselect radio by name
val ? $this.val( [ val ] ) : $this.eq( 0 ).prop( 'checked', true );
if ( val ) {
var name = $this.prop( 'name' );
$( 'input[name='+ name +']' ).val( [ val ] );
} else {
$this.eq( 0 ).prop( 'checked', true );
}
} else if ( type === 'checkbox' ) {
$this.prop( 'checked', val );
} else if ( $this.is( 'select' ) ) {
Expand Down Expand Up @@ -1184,7 +1189,7 @@ function volumeSetAt( val ) { // drag / press / updn
function websocketConnect( ip ) {
var url = 'ws://'+ ( ip || location.host ) +':8080';
if ( [ '', 'camilla', 'player' ].includes( page ) ) {
if ( ! websocketOk( wsvolume ) ) wsvolume = new WebSocket( url +'/volume' );
if ( ! websocketOk( wsvolume ) ) wsvolume = new WebSocket( url +'/cmdsh' );
}
if ( websocketOk( ws ) ) return

Expand Down
13 changes: 11 additions & 2 deletions srv/http/assets/js/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ function addToPlaylistCommand() {
if ( V.list.li.find( '.li2' ).length ) V.msg += '<a class="li2">'+ V.list.li.find( '.li2' ).text() +'</a>';
banner( 'playlist', V.title, V.msg );
bash( V.mpccmd );
if ( D.playbackswitch && V.action.slice( -4 ) === 'play' ) $( '#playback' ).trigger( 'click' );
if ( D.playbackswitch && V.action.slice( -4 ) === 'play' ) {
V.playbackswitch = true;
setTimeout( () => delete V.playbackswitch, 1000 );
switchPage( 'playback' );
}
}
function bookmarkNew() {
// #1 - track list - show image from licover
Expand Down Expand Up @@ -658,7 +662,12 @@ $( '.contextmenu a, .contextmenu .submenu' ).on( 'click', function() {
}
if ( [ 'play', 'pause', 'stop' ].includes( cmd ) ) {
$( '#pl-list li' ).eq( V.list.li.index() ).trigger( 'click' );
$( '#'+ cmd ).trigger( 'click' );
if ( S.player === 'mpd' || cmd !== 'play' ) {
$( '#'+ cmd ).trigger( 'click' );
} else {
$( '#stop' ).trigger( 'click' );
setTimeout( () => $( '#'+ cmd ).trigger( 'click' ), 2000 );
}
return
}

Expand Down
57 changes: 34 additions & 23 deletions srv/http/assets/js/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,23 @@ $( '.screenshot' ).on( 'click', function() {
} );
} );
$( '#setting-snapclient' ).on( 'click', function() {
info( {
icon : SW.icon
, title : SW.title
, message : 'Sync SnapClient with SnapServer:'
, list : [ 'Latency <gr>(ms)</gr>', 'number' ]
, focus : 0
, checkblank : true
, values : S.snapclientconf
, boxwidth : 100
, checkchanged : S.snapclient
, cancel : switchCancel
, ok : switchEnable
if ( S.snapserver ) {
$( '#setting-snapserver' ).trigger( 'click' );
return
}

notify( SW.icon, SW.title, 'Search for SnapServer ...' );
bash( [ 'snapserverip' ], ip => {
if ( ip ) {
window.open( 'http://'+ ip +':1780', '_blank' );
} else {
delete V.bannerdelay;
info( {
icon : SW.icon
, title : SW.title
, message : '<a class="helpmenu label">SnapServer<i class="i-snapcast"></i></a> not available.'
} );
}
} );
} );
$( '#setting-spotifyd' ).on( 'click', function() {
Expand Down Expand Up @@ -107,6 +112,9 @@ $( '#setting-spotifyd' ).on( 'click', function() {
} );
}
} );
$( '#setting-snapserver' ).on( 'click', function() {
window.open( 'http://'+ S.hostip +':1780', '_blank' );
} );
$( '#setting-ap' ).on( 'click', function() {
info( {
icon : SW.icon
Expand Down Expand Up @@ -231,24 +239,29 @@ $( '#setting-lyrics' ).on( 'click', function() {
} );
} );
$( '#setting-multiraudio' ).on( 'click', function() {
var list = [
[ '', '', { suffix: 'Name', sameline: true } ]
, [ '', '', { suffix: 'IP / URL' } ]
];
var listname = [ '', 'text', { sameline: true } ];
var listip = [ '', 'text', { suffix: ico( 'remove' ) } ];
if ( S.multiraudioconf ) {
var keys = Object.keys( S.multiraudioconf ).sort();
var keys = Object.keys( S.multiraudioconf ).sort();
var values = [];
keys.forEach( k => values.push( k, S.multiraudioconf[ k ] ) );
keys.forEach( k => {
list.push( listname, listip );
values.push( k, S.multiraudioconf[ k ] );
} );
var iL = values.length / 2 - 1;
} else {
values = [ S.hostname, S.hostip ];
list.push( listname, listip );
values = [ S.hostname, S.hostip ];
}
var check = infoCheckEvenOdd( values.length );
info( {
icon : SW.icon
, title : SW.title
, list : [
[ '', '', { suffix: 'Name', sameline: true } ]
, [ '', '', { suffix: 'IP / URL' } ]
, [ '', 'text', { sameline: true } ]
, [ '', 'text', { suffix: ico( 'remove' ) } ]
]
, list : list
, boxwidth : 160
, values : values
, checkchanged : S.multiraudio && values.length > 2
Expand Down Expand Up @@ -479,8 +492,6 @@ function passwordWrong() {
}
function renderPage() {
$( '#dabradio' ).toggleClass( 'disabled', ! S.dabdevice );
$( '#snapclient' ).parent().prev().toggleClass( 'single', ! S.snapclientactive );
$( '#snapserver' ).toggleClass( 'disabled', S.snapserveractive );
$( '#ap' ).toggleClass( 'disabled', S.wlanconnected );
$( '#smb' ).toggleClass( 'disabled', S.nfsserver );
if ( S.nfsconnected || S.shareddata || S.smb ) {
Expand Down
6 changes: 3 additions & 3 deletions srv/http/assets/js/function.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ function dirName( path ) {
return path.substring( 0, path.lastIndexOf( '/' ) )
}
function displayBars() {
if ( ! $( '#bio' ).hasClass( 'hide' ) ) return
if ( V.playbackswitch || ! $( '#bio' ).hasClass( 'hide' ) ) return

var smallscreen = V.wH < 590 || V.wW < 500;
var lcd = ( V.wH <= 320 && V.wW <= 480 ) || ( V.wH <= 480 && V.wW <= 320 );
Expand Down Expand Up @@ -1286,7 +1286,7 @@ function renderLibraryPadding() {
} )
}
function renderPlayback() {
if ( ! S.state ) return // suppress on reboot
if ( ! S.state || V.playbackswitch ) return // suppress on reboot

local();
if ( S.state === 'stop' ) setProgress( 0 );
Expand Down Expand Up @@ -1788,7 +1788,7 @@ function setPlaylistScroll() {
var $stationname = $this.find( '.li2 .stationname' );
var webradio = $this.hasClass( 'webradio' )
$stationname.addClass( 'hide' );
if ( S.state === 'stop' ) {
if ( S.state === 'stop' || S.player === 'snapcast' ) {
if ( webradio ) $name.text( $this.find( '.liname' ).text() );
$stationname.addClass( 'hide' );
} else {
Expand Down
Loading

0 comments on commit 9859359

Please sign in to comment.