Skip to content

Commit

Permalink
Merge pull request #939 from rern/UPDATE
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
rern authored Jun 10, 2022
2 parents 0e30eac + d0a87e4 commit e457cb4
Show file tree
Hide file tree
Showing 28 changed files with 673 additions and 277 deletions.
74 changes: 20 additions & 54 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@

alias=r1

# 20220610
if [[ -e /usr/bin/camilladsp && ! -e /srv/http/settings/camillagui/build/colors.css ]]; then
ln -sf /srv/http/assets/css/colors.css /srv/http/settings/camillagui/build
ln -sf /srv/http/assets/img/icon.png /srv/http/settings/camillagui/build
fi

sed -i -e 's/\s*Flat/Flat/
' -e '/Flat^/ d
' /srv/http/data/system/equalizer.presets &> /dev/null

file=/srv/http/data/camilladsp/configs/default_config.yml
if grep -q 'format: *$' $file; then
format=$( grep 'format: .\+$' /srv/http/data/camilladsp/configs/camilladsp.yml \
| tail -1 \
| awk '{print $NF}' )
sed -i "s/format: *$/format: $format/" $file
fi

# 20220527
if [[ $( pacman -Q camilladsp 2> /dev/null ) == 'camilladsp 0.6.3-1' ]]; then
systemctl stop camilladsp camillagui
Expand All @@ -16,71 +34,19 @@ if grep -q 'force user = mpd' /etc/samba/smb.conf; then
systemctl try-restart smb
fi

# 20220505
[[ ! -e /srv/http/data/system/asoundcard && ! -e /srv/http/data/shm/nosound ]] && cp /srv/http/data/{shm,system}/asoundcard

dir=/srv/http/shareddata
if [[ -e $dir ]]; then
chown -h http:http $dir/*/
chown -h mpd:audio $dir $dir/{mpd,playlist} $dir/mpd/mpd.db $dir/playlists/* 2> /dev/null
fi

# 20220428
# /etc/udev/rules.d/bluetooth.rules
rm -f /etc/systemd/system/bluealsa-aplay.service

echo 'PATH+=:/srv/http/bash:/srv/http/bash/settings:/opt/vc/bin' > /root/.profile

# 20220422 - with /etc/*
if modinfo ntfs3 &> /dev/null; then
if pacman -Q ntfs-3g &> /dev/null; then
pacman -R --noconfirm ntfs-3g 2> /dev/null
modprobe ntfs3
echo ntfs3 > /etc/modules-load.d/ntfs3.conf
fi
else
rm -f /etc/modules-load.d/ntfs3.conf
fi

file=/srv/http/data/shm/wlan
if [[ ! -e $file ]]; then
wlandev=$( ip -br link \
| grep ^w \
| grep -v wlan \
| cut -d' ' -f1 )
[[ ! $wlandev ]] && wlandev=wlan0
echo $wlandev > /srv/http/data/shm/wlan
fi
rm -f /etc/udev/rules.d/wifi.rules

# 20220327
sed -i '/chromium/ d' /etc/pacman.conf

file=/srv/http/bash/cmd-listsort.php
if grep -q '/The' $file; then
sed -i 's/The.*s+/^The +|^A +|^An +/' $file
for mode in album albumartist artist composer conductor genre date; do
filemode=/srv/http/data/mpd/$mode
if [[ -s $filemode ]]; then
sed -i 's/^.^^//' $filemode
php $file $filemode
fi
done
fi

. /srv/http/bash/addons.sh

installstart "$1"

getinstallzip

# 20220422
# 20220522
if [[ -e /srv/http/bash/features.sh ]]; then
echo 'PATH+=:/srv/http/bash:/srv/http/bash/settings:/opt/vc/bin' > /root/.profile
rm -f /srv/http/bash/{features*,networks*,player*,relays.*,relays-data*,system*}
fi

# 20220428
# 20220528
chmod +x /srv/http/bash/cmd.sh
/srv/http/bash/cmd.sh dirpermissions

Expand Down
2 changes: 1 addition & 1 deletion srv/http/assets/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ input::-moz-focus-inner {
.fa-btreceiver::before { content: '\f595' }
.fa-btsender::before { content: '\f596' }
.fa-brush::before { content: '\f536' }
.fa-camilladsp::before {content: '\f59D'; position: absolute; color: var( --cg60 ); text-shadow: none; }
.fa-camilladsp::before {content: '\f59D'; position: absolute; color: var( --cg60 ); }
.fa-camilladsp::after {content: '\f59C'; position: relative; } /* position: relative - fix order */
.fa-capslock:before { content: '\f607' }
.fa-check::before { content: '\f51B' }
Expand Down
5 changes: 5 additions & 0 deletions srv/http/assets/css/equalizer.css
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
position: absolute;
width: 100% !important;
left: 50%;
line-height: 36px;
transform: translateX( -50% );
font-size: 0; /* force no space between inline-block */
z-index: 1;
Expand All @@ -73,6 +74,7 @@
content: '';
width: 1px;
height: 100%;
right: 138px;
background: var( --cgl );
}
#eq input {
Expand All @@ -96,3 +98,6 @@
#eqname {
position: relative;
}
#eq input[type=text] {
vertical-align: -5px;
}
62 changes: 24 additions & 38 deletions srv/http/assets/js/equalizer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
var vflat = '60'.repeat( 10 );
var freq = [ 31, 63, 125, 250, 500, 1, 2, 4, 8, 16 ];
var timeout;
var band = [];
Expand All @@ -16,14 +15,15 @@ var content = `
<i id="eqsave" class="fa fa-save"></i>
<input id="eqname" type="text" class="hide"><select id="eqpreset">PRESETS</select>
<i id="eqnew" class="fa fa-plus-circle"></i><i id="eqcancel" class="fa fa-times bl hide"></i>
<i id="eqflat" class="fa fa-set0"></i>
<i id="equndo" class="fa fa-undo"></i>
</div>
<div id="infoRange" class="vertical">${ '<input type="range" min="40" max="80">'.repeat( 10 ) }</div>
</div>`;
function equalizer() {
bash( [ 'equalizerget' ], function( data ) {
G.eqcurrent = data.current;
G.vcurrent = data.values.join( '' );
G.nameval = data.nameval;
var eqbuttons = {}
var changed = false;
var values = [ '', data.current, ...data.values ]; // [ #eqname, #eqpreset, ... ]
Expand All @@ -38,7 +38,6 @@ function equalizer() {
, values : values
, beforeshow : function() {
$( '#infoBox' ).css( 'width', 550 );
var notpreset = G.eqcurrent === '(unnamed)' || G.eqcurrent === 'Flat';
eqButtonSet();
if ( !/Android.*Chrome/i.test( navigator.userAgent ) ) { // fix: chrome android cannot drag
$( '#infoRange input' ).on( 'click input keyup', function() {
Expand Down Expand Up @@ -94,24 +93,19 @@ function equalizer() {
$( '#eqnew' ).click();
} );
$( '#eqsave' ).click( function() {
var cmd = '';
var eqname = $( '#eqname' ).val();
if ( $( '#eqrename' ).hasClass( 'hide' ) ) {
bash( [ 'equalizer', 'rename', G.eqcurrent, eqname ] );
G.eqcurrent = eqname;
$( '#eqcancel' ).click();
} else if ( $( '#eqnew' ).hasClass( 'hide' ) ) {
G.eqcurrent = eqname;
bash( [ 'equalizer', 'new', eqname ] );
$( '#eqcancel' ).click();
var eqname = $( '#eqname' ).hasClass( 'hide' ) ? $( '#eqpreset' ).val() : $( '#eqname' ).val();
if ( $( '#eqname' ).hasClass( 'hide' ) ) {
bash( [ 'equalizer', 'save', eqname ] );
} else {
bash( [ 'equalizer', 'save', G.eqcurrent ] );
bash( [ 'equalizer', 'rename', G.eqcurrent, eqname ] );
}
$( this ).addClass( 'disabled' );
$( '#eqcancel' ).click();
$( '#eqrename' ).removeClass( 'disabled' );
$( '#eqsave' ).addClass( 'disabled' );
} );
$( '#eqnew' ).click( function() {
eqbuttons = {};
[ 'eqrename', 'eqsave', 'eqflat' ].forEach( function( btn ) {
[ 'eqrename', 'eqsave', 'equndo' ].forEach( function( btn ) {
eqbuttons[ btn ] = $( '#'+ btn ).hasClass( 'disabled' );
} );
$( '#eqnew, #eq .selectric-wrapper' ).addClass( 'hide' );
Expand All @@ -123,42 +117,34 @@ function equalizer() {
$( '#eqrename, #eqnew, #eq .selectric-wrapper' ).removeClass( 'hide' );
$( '#eqname, #eqcancel, #eqdelete' ).addClass( 'hide' );
$( '#eqname' ).val( '' );
[ 'eqrename', 'eqsave', 'eqflat' ].forEach( function( btn ) {
[ 'eqrename', 'eqsave', 'equndo' ].forEach( function( btn ) {
$( '#'+ btn ).toggleClass( 'disabled', eqbuttons[ btn ] );
} );
} );
$( '#eqflat' ).click( function() {
G.eqcurrent = 'Flat';
bash( [ 'equalizer', 'preset', 'Flat' ] );
$( '#equndo' ).click( function() {
if ( G.eqcurrent === '(unnamed)' ) G.eqcurrent = 'Flat';
bash( [ 'equalizer', 'preset', G.eqcurrent ] );
} );
}
, buttonnoreset : 1
, okno : 1
} );
}, 'json' );
}
function eqButtonSet( changed ) {
var flat = G.eqcurrent === 'Flat';
var unnamed = G.eqcurrent === '(unnamed)';
var notpreset = flat || unnamed;
$( '#eqrename' ).toggleClass( 'disabled', notpreset );
$( '#eqsave' ).toggleClass( 'disabled', !changed );
$( '#eqnew' ).toggleClass( 'disabled', flat || !unnamed );
$( '#eqflat' ).toggleClass( 'disabled', flat );
function eqButtonSet() {
var current = $( '#eqpreset' ).val();
var flat = current === 'Flat';
var unnamed = current === '(unnamed)';
var changed = infoVal().slice( 2 ).join( ' ' ) !== G.nameval[ current ];
$( '#eqrename' ).toggleClass( 'disabled', unnamed || flat || changed );
$( '#eqsave' ).toggleClass( 'disabled', unnamed || flat || !changed );
$( '#equndo' ).toggleClass( 'disabled', G.eqcurrent === 'Flat' || !changed );
}
function eqValueSet( band, val ) {
clearTimeout( timeout );
bash( [ 'equalizerupdn', band, val ] );
eqButtonSet();
timeout = setTimeout( function() {
bash( [ 'equalizerget', 'pushstream', 'set' ] );
bash( [ 'equalizerget', 'pushstream', $( '#eqpreset' ).val() === 'Flat' ? 'set' : '' ] );
}, 1000 );
var vnew = infoVal().slice( 2 ).join( '' );
if ( vnew !== G.vcurrent ) {
changed = true;
G.eqcurrent = vnew === vflat ? 'Flat' : '(unnamed)';
} else {
changed = false;
G.eqcurrent = G.vcurrent;
}
eqButtonSet( changed );
}
24 changes: 24 additions & 0 deletions srv/http/assets/js/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,30 @@ $( '#setting-upmpdcli' ).click( function() {
}
} );
} );
$( '#setting-camilladsp' ).click( function() {
info( {
icon : 'camilladsp'
, title : 'CamillaGUI'
, textlabel : 'Status: Refresh <gr>(ms)</gr>'
, checkbox : [ 'Apply automatically' ]
, focus : 0
, checkblank : 1
, boxwidth : 100
, values : G.camillaguiconf
, boxwidth : 100
, checkchanged : ( G.camilladsp ? 1 : 0 )
, beforeshow : function() {
$( '#infoContent tr:eq( 1 ) td:eq( 0 )' ).text( 'Configurations:' )
}
, cancel : function() {
$( '#camilladsp' ).prop( 'checked', G.camilladsp );
}
, ok : function() {
bash( [ 'camillaguiset', ...infoVal() ] );
notify( 'CamillaDSP', G.camilladsp ? 'Change ...' : 'Enable ...', 'camilladsp' );
}
} );
} );
$( '#setting-hostapd' ).click( function() {
info( {
icon : 'accesspoint'
Expand Down
2 changes: 0 additions & 2 deletions srv/http/assets/js/function.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,7 @@ function displaySubMenu() {
submenu.forEach( function( el ) {
$( '#'+ el ).prev().toggleClass( 'sub', G.display[ el ] );
} ); // submenu toggled by css .settings + .submenu
//$( '#features' ).toggleClass( 'sub', G.display.camilladsp || G.display.equalizer );
if ( G.localhost ) $( '#power' ).addClass( 'sub' );
//if ( G.display.multiraudio ) $( '#displayplaylist' ).addClass( 'sub' );
}
/*function flag( iso ) { // from: https://stackoverflow.com/a/11119265
var iso0 = ( iso.toLowerCase().charCodeAt( 0 ) - 97 ) * -15;
Expand Down
10 changes: 7 additions & 3 deletions srv/http/assets/js/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,13 @@ function info( json ) {
var color = O.okcolor ? ' style="background-color:'+ O.okcolor +'"' : '';
htmlbutton += '<a id="infoOk"'+ color +' class="infobtn infobtn-primary">'+ ( O.oklabel || 'OK' ) +'</a>';
}
if ( htmlbutton ) $( '#infoButtons' )
.html( htmlbutton )
.removeClass( 'hide' );
if ( htmlbutton ) {
$( '#infoButtons' )
.html( htmlbutton )
.removeClass( 'hide' );
} else {
$( '#infoButtons' ).remove();
}
if ( O.button ) {
if ( typeof O.button !== 'object' ) O.button = [ O.button ];
$( '#infoButtons' ).on( 'click', '.extrabtn', function() {
Expand Down
2 changes: 1 addition & 1 deletion srv/http/assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ $( '.settings' ).click( function() {
$( '#settings' ).on( 'click', '.submenu', function() {
switch ( this.id ) {
case 'camilladsp':
bash( 'systemctl start camillagui', function() {
bash( [ 'camillagui' ], function() {
urlReachable( 'http://'+ location.host +':5000' );
} );
loader();
Expand Down
6 changes: 4 additions & 2 deletions srv/http/assets/js/passive.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,9 @@ function psDisplay( data ) {
}
}
function psEqualizer( data ) {
if ( O.title !== 'Equalizer' ) return

G.eqcurrent = data.current;
G.vcurrent = data.values.join( '' );
G.nameval = data.nameval;
O.values = [ '', data.current, ...data.values ];
var options = '';
data.presets.forEach( function( name ) {
Expand All @@ -307,6 +308,7 @@ function psEqualizer( data ) {
infoSetValues();
selectricRender();
eqButtonSet();
if ( !$( '#eqname' ).hasClass( 'hide' ) ) $( '#eq .selectric-wrapper' ).addClass( 'hide' )
}
function psMpdPlayer( data ) {
clearTimeout( G.debounce );
Expand Down
Loading

0 comments on commit e457cb4

Please sign in to comment.