Skip to content

Commit

Permalink
Merge pull request #1604 from rern/UPDATE
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
rern authored Feb 19, 2024
2 parents 80d3943 + 7e83d76 commit 6815274
Show file tree
Hide file tree
Showing 29 changed files with 334 additions and 276 deletions.
15 changes: 12 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,17 @@ alias=r1

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

# 20240218
[[ ! -e $dirshm/nosound && ! -e $dirshm/output ]] && restartmpd=1
# 20240219
readarray -t mixerfiles <<< $( ls $dirsystem/hwmixer-* 2> /dev/null )
if [[ $mixerfiles ]]; then
for f in "${mixerfiles[@]}"; do
mv "$f" "${f/hwmixer-/mixer-}"
done
fi

if [[ ! -e $dirshm/nosound ]]; then
( [[ ! -e $dirshm/output ]] || grep -q ^hwmixer $dirshm/output ) && restartmpd=1
fi

[[ -e $dirsystem/btoutputall ]] && mv $dirsystem/{btoutputall,devicewithbt}

Expand Down Expand Up @@ -118,5 +127,5 @@ cacheBust

installfinish

# 20240218
# 20240219
[[ $restartmpd ]] && $dirsettings/player-conf.sh
5 changes: 3 additions & 2 deletions 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=1707808685' );
src : url( '/assets/fonts/rern.woff2?v=1708267847' );
}
@font-face {
font-family : Lato;
Expand Down Expand Up @@ -107,6 +107,7 @@ i {
.i-hide::before { content: '\F575' }
.i-hostname::before { content: '\F590' }
.i-httpd::before { content: '\F55D' }
.i-i2s::before { content: '\F571' }
.i-i2smodule::before { content: '\F571' }
.i-info::before { content: '\F561' }
.i-input::before { content: '\F529' }
Expand Down Expand Up @@ -232,7 +233,7 @@ i {
.i-wifi2::before { content: '\F59A'; position: absolute; }
.i-wifi2::after { content: '\F59B'; color: var( --cga ); }
.i-wlan::before { content: '\F597' }
#divhwmixer .i-gear::before { content: '\F516' }
#divmixer .i-gear::before { content: '\F516' }

html {
height : 100%;
Expand Down
3 changes: 2 additions & 1 deletion srv/http/assets/css/settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,8 @@ heading i.disabled {
.entries li,
.entries li span,
.entries .li1,
.entries .li2 {
.entries .li2,
.select2-results__options li {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
Expand Down
39 changes: 18 additions & 21 deletions srv/http/assets/js/player.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
var typelist = { 'None / 0dB': 'none', 'Mixer device': 'hardware', 'MPD software': 'software' }
var warning = iconwarning +'<wh>Lower speakers / headphones volume<br><br>'
+'<gr>Signal will be set to original level at 0dB.</gr><br>'
+'Beware of too high volume.</wh>';

$( function() { // document ready start >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

$( '#audiooutput' ).on( 'input', function() {
$( '#device' ).on( 'input', function() {
var $this = $( this );
var aplayname = $this.val();
var output = $this.find( 'option:selected' ).text()
notify( 'volume', 'Audio Output Device', 'Change ...' );
bash( [ 'audiooutput', output, aplayname, 'CMD OUTPUT APLAYNAME' ] );
bash( [ 'device', output, aplayname, 'CMD OUTPUT APLAYNAME' ] );
} );
$( '#hwmixer' ).on( 'input', function() {
$( '#mixer' ).on( 'input', function() {
notify( 'volume', 'Hardware Mixer', 'Change ...' );
bash( [ 'hwmixer', $( this ).val(), 'CMD HWMIXER' ] );
bash( [ 'mixer', $( this ).val(), 'CMD MIXER' ] );
} );
$( '#setting-hwmixer, #setting-bluealsa' ).on( 'click', function() {
$( '#setting-mixer, #setting-bluealsa' ).on( 'click', function() {
if ( this.id.slice( -1 ) === 'a' ) {
var cmd = 'volumebt';
var cmd0db = 'volume0dbbt';
var control = S.btaplayname.replace( ' - A2DP', '' );
} else {
var cmd = 'volume';
var cmd0db = 'volume0db';
var control = S.output.hwmixer;
var control = S.output.mixer;
}
info( {
icon : SW.icon
Expand Down Expand Up @@ -76,9 +75,8 @@ $( '#mixertype' ).on( 'click', function() {
$( '#setting-mixertype' ).on( 'click', function() {
info( {
icon : SW.icon
, title : SW.title
, message : 'Type:'
, list : [ '', 'radio', { kv: { 'Mixer device <gr>(hardware)</gr>': 'hardware', 'MPD software': 'software' }, sameline: false } ]
, title : 'Volume Type'
, list : [ '', 'radio', { kv: { 'DAC hardware <gr>(Mixer Device)</gr>': 'hardware', 'MPD software': 'software' }, sameline: false } ]
, values : S.mixertype ? S.output.mixertype : 'hardware'
, cancel : switchCancel
, ok : () => setMixerType( infoVal() )
Expand Down Expand Up @@ -317,30 +315,29 @@ function renderPage() {
if ( icondsp ) $( '#divbluealsa .col-l' ).append( icondsp );
$( '#divbluealsa' ).removeClass( 'hide' );
$( '#btaplayname' ).html( '<option>'+ S.btaplayname.replace( / - A2DP$/, '' ) +'</option>' );
$( '#divaudiooutput, #divhwmixer, #divmixertype' ).toggleClass( 'hide', ! S.devicewithbt );
$( '#divdevice, #divmixer, #divmixertype' ).toggleClass( 'hide', ! S.devicewithbt );
} else {
if ( icondsp ) $( '#divbluealsa .col-l' ).append( icondsp );
$( '#divaudiooutput .col-l' ).html( $( '#divaudiooutput .col-l' ).html() + icondsp );
$( '#divdevice .col-l' ).html( $( '#divdevice .col-l' ).html() + icondsp );
$( '#divbluealsa' ).addClass( 'hide' );
$( '#divaudiooutput, #divhwmixer, #divmixertype' ).removeClass( 'hide' );
$( '#divdevice, #divmixer, #divmixertype' ).removeClass( 'hide' );
}
if ( S.asoundcard === -1 ) {
$( '#divoutput, #divbitperfect, #divvolume' ).addClass( 'hide' );
} else {
$( '#divoutput, #divbitperfect, #divvolume' ).removeClass( 'hide' );
$( '#audiooutput' )
$( '#device' )
.html( htmlOption( S.listdevice ) )
.val( S.output.aplayname );
if ( S.listmixer ) {
$( '#hwmixer' )
$( '#mixer' )
.html( htmlOption( S.listmixer ) )
.val( S.output.hwmixer );
$( '#divhwmixer' ).removeClass( 'hide' );
.val( S.output.mixer );
$( '#divmixer' ).removeClass( 'hide' );
} else {
$( '#divhwmixer' ).addClass( 'hide' );
delete typelist[ 'Mixer device' ];
$( '#divmixer' ).addClass( 'hide' );
}
$( '#setting-hwmixer' ).toggleClass( 'hide', ! S.volume );
$( '#setting-mixer' ).toggleClass( 'hide', ! S.volume );
$( '#divmixertype' ).toggleClass( 'hide', S.camilladsp );
$( '#setting-mixertype' ).toggleClass( 'hide', ! S.listmixer || ! S.mixertype );
$( '#divdevicewithbt' ).toggleClass( 'hide', ! S.bluetooth );
Expand All @@ -350,7 +347,7 @@ function renderPage() {
}
$.each( S.lists, ( k, v ) => $( '#divlists .subhead[data-status="'+ k +'"]' ).toggleClass( 'hide', ! v ) );
$( '#divlists' ).toggleClass( 'hide', ! Object.values( S.lists ).includes( true ) );
if ( I.range ) $( '#setting-'+ ( S.btaplayname ? 'bluealsa' : 'hwmixer' ) ).trigger( 'click' );
if ( I.range ) $( '#setting-'+ ( S.btaplayname ? 'bluealsa' : 'mixer' ) ).trigger( 'click' );
showContent();
}
function renderStatus() {
Expand Down
41 changes: 21 additions & 20 deletions srv/http/assets/js/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ $( 'body' ).on( 'click', function( e ) {
if ( e.target.id !== 'codehddinfo' ) $( '#codehddinfo' ).addClass( 'hide' );
$( 'li' ).removeClass( 'active' );
if ( ! $( e.target ).hasClass( 'select2-search__field' )
&& ! $( e.target ).parents( '#divi2smodule' ).length
&& ! $( e.target ).parents( '#divi2sselect' ).length
&& $( '#i2smodule' ).val() === 'none'
) {
i2sSelectHide();
Expand All @@ -133,16 +133,17 @@ $( '.close' ).off( 'click' ).on( 'click', function() { // off close in settings.
return
}

var line = '<wh>Reboot required for:</wh><p>';
list.split( '\n' ).forEach( id => line += ico( id ) + $( '#div'+ id +' .label' ).text() +'\n' );
var message = '<wh>Reboot required for:</wh>';
list.split( '\n' ).forEach( id => message += '<br>'+ ico( id ) + $( '#div'+ id +' .label' ).text() ); // i2smodule
info( {
icon : page
, title : 'System Setting'
, message : line +'</p>'
, cancel : () => location.href = '/'
, okcolor : orange
, oklabel : ico( 'reboot' ) +'Reboot'
, ok : () => infoPowerCommand( 'reboot' )
icon : page
, title : 'System Setting'
, message : message
, messagealign : 'left'
, cancel : () => location.href = '/'
, okcolor : orange
, oklabel : ico( 'reboot' ) +'Reboot'
, ok : () => infoPowerCommand( 'reboot' )
} );
} );
} );
Expand Down Expand Up @@ -309,10 +310,10 @@ $( '#setting-wlan' ).on( 'click', function() {
}, 'json' );
}
} );
$( '#divi2smodulesw' ).on( 'click', function() {
$( '#divi2ssw' ).on( 'click', function() {
setTimeout( i2sOptionSet, 0 );
} );
$( '#divi2s .col-r' ).on( 'click', function( e ) {
$( '#divi2smodule .col-r' ).on( 'click', function( e ) {
if ( $( e.target ).parents( '.select2' ).length ) i2sOptionSet();
} );
$( '#i2smodule' ).on( 'input', function() {
Expand All @@ -324,7 +325,7 @@ $( '#i2smodule' ).on( 'input', function() {
notify( icon, title, 'Enable ...' );
} else {
setTimeout( () => { notify( icon, title, 'Disable ...' ) }, 300 ); // fix - hide banner too soon
S.i2smodulesw = false;
S.i2ssw = false;
i2sSelectHide();
}
bash( [ 'i2smodule', aplayname, output, 'CMD APLAYNAME OUTPUT' ] );
Expand Down Expand Up @@ -682,7 +683,7 @@ $( '#i2smodule, #timezone' ).on( 'select2:opening', function () { // temp css fo

function i2sOptionSet() {
if ( $( '#i2smodule option' ).length > 2 ) {
if ( $( '#divi2smodule' ).hasClass( 'hide' ) ) {
if ( $( '#divi2sselect' ).hasClass( 'hide' ) ) {
i2sSelectShow();
$( '#i2smodule' ).select2( 'open' );
}
Expand All @@ -703,13 +704,13 @@ function i2sOptionSetSelect() {
} ).prop( 'selected', true );
}
function i2sSelectHide() {
$( '#i2smodulesw' ).prop( 'checked', S.i2smodulesw );
$( '#divi2smodulesw' ).removeClass( 'hide' );
$( '#divi2smodule' ).addClass( 'hide' );
$( '#i2ssw' ).prop( 'checked', S.i2ssw );
$( '#divi2ssw' ).removeClass( 'hide' );
$( '#divi2sselect' ).addClass( 'hide' );
}
function i2sSelectShow() {
$( '#divi2smodulesw' ).addClass( 'hide' );
$( '#divi2smodule, #setting-i2smodule' ).removeClass( 'hide' );
$( '#divi2ssw' ).addClass( 'hide' );
$( '#divi2sselect, #setting-i2smodule' ).removeClass( 'hide' );
}
function htmlOption( values ) {
var options = '';
Expand Down Expand Up @@ -1127,7 +1128,7 @@ function renderPage() {
} else {
$( '#divaudio' ).addClass( 'hide' );
}
if ( S.i2smodulesw ) {
if ( S.i2ssw ) {
if ( $( '#i2smodule option' ).length ) {
i2sOptionSetSelect();
} else {
Expand Down
15 changes: 8 additions & 7 deletions srv/http/bash/audiocd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,17 @@ if [[ ! -e $diraudiocd/$discid ]]; then # cd-info
discdata=$( sed -n '/^CD-TEXT for Disc/,/^\s*DISC_ID:/ {s/^\s*//; p}' <<< $cdinfo )
artist=$( grep ^PERFORMER <<< $discdata | cut -d' ' -f2- )
album=$( grep ^TITLE <<< $discdata | cut -d' ' -f2- )
readarray -t lines <<< $( sed -n '/^CD-TEXT for Track/,$ {s/^\s*//; p}' <<< $cdinfo | tail +2 )
lines+=( CD-TEXT- )
for l in "${lines[@]}"; do
if [[ $l == TITLE:* ]]; then
t=$( sed 's/^TITLE: //' <<< $l )
elif [[ $l == CD-TEXT* ]]; then
lines=$( sed -n '/^CD-TEXT for Track/,$ {s/^\s*//; p}' <<< $cdinfo | tail +2 )
lines+='
CD-TEXT-'
while read line; do
if [[ $line == TITLE:* ]]; then
t=$( sed 's/^TITLE: //' <<< $line )
elif [[ $line == CD-TEXT* ]]; then
titles+=( "$t" )
t=
fi
done
done <<< $lines
cdData
fi
fi
Expand Down
19 changes: 9 additions & 10 deletions srv/http/bash/cmd-list.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,21 @@ if [[ ! $mpclistall ]]; then # very large database
notify 'refresh-library blink' 'Library Database' 'Parse each album for large Library ...' 3000
echo 'max_output_buffer_size "8192"' > $dirmpdconf/outputbuffer.conf
systemctl restart mpd
readarray -t albums <<< $( mpc list album 2> /dev/null )
albums=$( mpc list album 2> /dev/null )
if [[ ! $albums ]]; then
buffer=8192
for (( i=0; i < 10; i++ )); do
buffer=$(( buffer + 8192 ))
echo 'max_output_buffer_size "'$buffer'"' > $dirmpdconf/outputbuffer.conf
systemctl restart mpd
readarray -t albums <<< $( mpc list album 2> /dev/null )
albums=$( mpc list album 2> /dev/null )
[[ $albums ]] && break
done
fi
if [[ $albums ]]; then
for a in "${albums[@]}"; do
while read a; do
albumlist+=$( mpc -f '%album%^^[%albumartist%|%artist%]^^%date^^%file%' find album "$a" | awk -F'/[^/]*$' 'NF {print $1|"sort -u"}' )$'\n'
done
done <<< albums
else
notify 'refresh-library blink' 'Library Database' 'Library is too large.<br>Album list will not be available.' 3000
fi
Expand All @@ -102,9 +102,9 @@ fi
if [[ $albumlist ]]; then # album^^artist^^date^^dir
filewav=$( grep \.wav$ <<< $mpclistall )
if [[ $filewav ]]; then # mpd not support *.wav albumartist
readarray -t dirwav <<< $( sed 's|.*\^||; s|/[^/]*$||' <<< $filewav | sort -u )
dirwav=$( sed 's|.*\^||; s|/[^/]*$||' <<< $filewav | sort -u )
if [[ $dirwav ]]; then
for dir in "${dirwav[@]}"; do
while read dir; do
dir=${dir//[/\\[/} # escape \[n-n] > not as range in grep
file=$( grep -m1 "$dir" <<< $mpclistall )
albumartist=$( kid3-cli -c 'get albumartist' "/mnt/MPD/${file/*^}" )
Expand All @@ -115,12 +115,11 @@ if [[ $albumlist ]]; then # album^^artist^^date^^dir
$( grep -v "$dir$" <<< $albumlist )
${tags[0]}^^$albumartist^^${tags[2]}^^$dir"
fi
done
done <<< $dirwav
fi
fi
albumignore=$( getContent $dirmpd/albumignore )
readarray -t lines <<< $albumlist
for line in "${lines[@]}"; do
while read line; do
readarray -t tags <<< $( echo -e "${line//^^/\\n}" )
tagalbum=${tags[0]}
tagartist=${tags[1]}
Expand All @@ -131,7 +130,7 @@ ${tags[0]}^^$albumartist^^${tags[2]}^^$dir"
album+="$tagalbum^^$tagartist^^$tagdir"$'\n'
albumbyartist+="$tagartist^^$tagalbum^^$tagdir"$'\n'
albumbyartistyear+="$tagartist^^$tagdate^^$tagalbum^^$tagdir"$'\n'
done
done <<< $albumlist
for mode in album albumbyartist albumbyartist-year; do
varname=${mode/-}
sort -u <<< ${!varname} > $dirmpd/$mode
Expand Down
Loading

0 comments on commit 6815274

Please sign in to comment.