From 7e64abefcae7d00f124f914d02f26e2a745a68de Mon Sep 17 00:00:00 2001 From: rern Date: Sun, 9 Feb 2025 10:53:48 +0700 Subject: [PATCH] u --- README.md | 22 +++++---- install.sh | 77 ++++++------------------------- srv/http/assets/js/addons.js | 2 +- srv/http/assets/js/camilla.js | 22 ++++++--- srv/http/bash/settings/camilla.py | 16 ------- 5 files changed, 42 insertions(+), 97 deletions(-) delete mode 100644 srv/http/bash/settings/camilla.py diff --git a/README.md b/README.md index 6b5650157..2881357f6 100644 --- a/README.md +++ b/README.md @@ -98,16 +98,18 @@ Audio player for - Manjaro: `pacman -Sy rpi-imager` - Others: [Build and install](https://github.com/raspberrypi/rpi-imager) - Download an image file. - - `CHOOSE OS` > Use custom (OR right click the image file > Open with > Raspberry Pi Imager) - - `CHOOSE STORAGE`: - - Select SD card - normal boot - - Select USB drive - boot from USB drive without SD card - - For Raspberry Pi 2B v1.2, 3A+, 3B, 3B+, 4B - - [USB mass storage boot](https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/msd.md) must be set. - - Should be used only when USB drive is faster than SD card. - - Do not set anything in `Advance options` - - `WRITE` - - Verify is optional. + - **Raspberry Pi Imager:** + - `CHOOSE DEVICE` - (No need) + - `CHOOSE OS` > Use custom + - `CHOOSE STORAGE`: + - Select SD card - normal boot + - Select USB drive - boot from USB drive without SD card + - For Raspberry Pi 2B v1.2, 3A+, 3B, 3B+, 4B + - [USB mass storage boot](https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/msd.md) must be set. + - Should be used only when USB drive is faster than SD card. + - Do not set anything in `Advance options` + - `WRITE` + - Verify is optional. - Existing users: - Keep current setup SD card. - Try with a spare one before moving forward. diff --git a/install.sh b/install.sh index bc356a35c..410057d17 100644 --- a/install.sh +++ b/install.sh @@ -14,64 +14,29 @@ fi if [[ -e /usr/bin/camilladsp && $( camilladsp -V ) != 'CamillaDSP 3.0.0' ]]; then echo "$bar CamillaDSP - Upgrade ..." systemctl -q is-active camilladsp && pacman stop camilladsp && camillaactive=1 - pacman -Sy --noconfirm camilladsp yq + pacman -Sy --noconfirm camilladsp readarray -t files <<< $( ls $dircamilladsp/configs/* ) for file in "${files[@]}"; do - config=$( yq < "$file" ) - pipeline=$( jq .pipeline <<< $config ) - [[ $pipeline == null ]] && sed -i 's/"//g' "$file" && continue - - linenew= - lineprev= - pipelinenew= - pL=$( jq length <<< $pipeline ) - for (( i=0; i <= pL; i++ )); do - if (( $i == $pL )); then - [[ $linenew ]] && pipelinenew+=,$linenew - break - fi - - line=$( jq -c .[$i] <<< $pipeline ) - if [[ $( jq -r .type <<< $line ) == Mixer ]]; then - [[ $linenew ]] && pipelinenew+=,$linenew - pipelinenew+=,$line - linenew= - lineprev= - continue - - fi - ch=$( jq .channel <<< $line ) - if [[ ! $lineprev ]]; then - lineprev=$( jq 'del(.channel)' <<< $line ) - linenew=$( jq "del(.channel) | . += { channels: [$ch] }" <<< $line ) - continue - - fi - if [[ $( jq 'del(.channel)' <<< $line ) == "$lineprev" ]]; then - linenew=$( jq ".channels += [$ch]" <<< $linenew ) - else - pipelinenew+=,$linenew - lineprev=$( jq 'del(.channel)' <<< $line ) - linenew=$( jq "del(.channel) | . += { channels: [$ch] }" <<< $line ) - fi - done - jq ".pipeline = [${pipelinenew:1}]" <<< $config | yq -y > "$file" + if sed -n '/^pipeline/,$ p' "$file" | grep -q 'channel:'; then + sed -i '/^pipeline/,$ d' "$file" + echo 'pipeline: []' >> "$file" + fi done [[ $camillaactive ]] && pacman start camilladsp fi # 20250111 if [[ -e /boot/kernel.img ]]; then - if [[ $( pacman -Q cava ) != 'cava 0.7.4-1' ]]; then + if [[ $( pacman -Q cava ) < 'cava 0.7.4-1' ]]; then wget https://github.com/rern/rern.github.io/raw/refs/heads/main/armv6h/cava-0.7.4-1-any.pkg.tar.xz pacman -U --noconfirm cava-0.7.4-1-any.pkg.tar.xz rm cava-0.7.4-1-any.pkg.tar.xz fi else - [[ $( pacman -Q cava ) != 'cava 0.10.3-2' ]] && pacman -Sy --noconfirm cava + [[ $( pacman -Q cava ) < 'cava 0.10.3-2' ]] && pacman -Sy --noconfirm cava fi -if [[ $( pacman -Q python-rpi-gpio ) != 'python-rpi-gpio 0.7.1-3' ]]; then +if [[ $( pacman -Q python-rpi-gpio ) < 'python-rpi-gpio 0.7.1-4' ]]; then pacman -R --noconfirm python-rpi-gpio pacman -Sy --noconfirm python-rpi-gpio fi @@ -89,26 +54,6 @@ if [[ -e $dirsystem/lcdchar.conf ]]; then rm -f $file fi -# 20241208 -rm -f $dirshm/playlist* - -dir=/srv/http/assets/img/guide -if [[ -e $dir/58.jpg ]]; then - rm $dir/* - curl -skL https://github.com/rern/_assets/raw/master/guide/guide.tar.xz | bsdtar xf - -C $dir -fi - -file=/etc/pacman.conf -if ! grep -q linux-rpi $file; then - [[ -e /boot/kernel7.img ]] && ignore='libunwind mesa' - sed -i -e '/^#*IgnorePkg/ d' -e "/^#*IgnoreGroup/ i\IgnorePkg = linux-rpi $ignore" $file -fi -if [[ -e /boot/kernel7.img ]] && ! grep -q mesa $file; then - sed -i '/^IgnorePkg/ s/$/ mesa/' $file -fi - -[[ ! -e /boot/kernel.img ]] && sed -i '/^brightness/ d' $dirsystem/localbrowser.conf - #------------------------------------------------------------------------------- installstart "$1" @@ -122,3 +67,9 @@ $dirbash/cmd.sh cachebust [[ -e $dirsystem/color ]] && $dirbash/cmd.sh color installfinish + +# 20250208 +if [[ $camillaactive ]]; then + echo "$info CamillaDSP - Pipeline was reset." + echo 'Need reconfiguration.' +fi diff --git a/srv/http/assets/js/addons.js b/srv/http/assets/js/addons.js index 5c4495ab9..13b13288e 100644 --- a/srv/http/assets/js/addons.js +++ b/srv/http/assets/js/addons.js @@ -1,6 +1,6 @@ V = {} // var global var icon = 'addons'; -var keys = [ 'installurl', 'postinfo', 'title', 'uninstall', 'version' ]; +var keys = [ 'installurl', 'postmessage', 'title', 'uninstall', 'version' ]; $( '.helphead' ).remove(); if ( [ 'localhost', '127.0.0.1' ].includes( location.hostname ) ) $( 'a' ).removeAttr( 'href' ); diff --git a/srv/http/assets/js/camilla.js b/srv/http/assets/js/camilla.js index ebc801863..a50b0a4a5 100644 --- a/srv/http/assets/js/camilla.js +++ b/srv/http/assets/js/camilla.js @@ -1148,6 +1148,8 @@ var render = { } //----------------------------------------------------------------------------------- , filters : () => { var data = render.dataSort(); + if ( ! data ) return + var li = ''; $.each( data, ( k, v ) => li += render.filter( k, v ) ); $( '#'+ V.tab +' .entries.main' ).html( li ); @@ -1202,7 +1204,9 @@ var render = { } //----------------------------------------------------------------------------------- , mixers : () => { var data = render.dataSort(); - var li = ''; + if ( ! data ) return + + var li = ''; $.each( data, ( k, v ) => li += render.mixer( k, v ) ); $( '#'+ V.tab +' .entries.main' ).html( li ); render.toggle(); @@ -1214,7 +1218,6 @@ var render = { +'' } , mixersSub : name => { - console.log(name) var iconadd = max => ico( max ? 'add disabled' : 'add' ); var data = MIX[ name ].mapping; var chin = DEV.capture.channels; @@ -1260,7 +1263,9 @@ var render = { } //----------------------------------------------------------------------------------- , processors : () => { var data = render.dataSort(); - var li = ''; + if ( ! data ) return + + var li = ''; $.each( data, ( k, v ) => { var param = jsonClone( v.parameters ); [ 'channels', 'monitor_channels', 'process_channels' ].forEach( k => delete param[ k ] ); @@ -1273,7 +1278,10 @@ var render = { render.toggle(); } //----------------------------------------------------------------------------------- , pipeline : () => { - $( '.i-flowchart' ).toggleClass( 'disabled', PIP.length === 0 ); + var nopip = ! PIP || ! PIP.length; + $( '.i-flowchart' ).toggleClass( 'disabled', nopip ); + if ( nopip ) return + var li = ''; PIP.forEach( ( el, i ) => li += render.pipe( el, i ) ); $( '#'+ V.tab +' .entries.main' ).html( li ); @@ -1386,10 +1394,10 @@ var render = { } //----------------------------------------------------------------------------------- , dataSort : () => { var kv = S.config[ V.tab ]; - if ( ! kv ) return + var keys = Object.keys( kv ); + if ( ! keys.length ) return false var data = {}; - var keys = Object.keys( kv ); keys.sort().forEach( k => data[ k ] = kv[ k ] ); return data } @@ -1745,7 +1753,7 @@ var setting = { S.config.processors = {} PRO = S.config.processors; } - PRO[ namenew ] = { type: v.type, parameters: val } + PRO[ namenew ] = { type: typenew, parameters: val } if ( name in PRO && name !== namenew ) delete PRO[ name ]; setting.save( title, name ? 'Change ...' : 'Save ...' ); render.processors(); diff --git a/srv/http/bash/settings/camilla.py b/srv/http/bash/settings/camilla.py deleted file mode 100644 index c8220e048..000000000 --- a/srv/http/bash/settings/camilla.py +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/python - -import json -import sys - -args = json.loads( sys.argv[ 1 ].replace( '\\"', '"' ) ) - -if 'index' in args: # pipeline - from camilladsp_plot import eval_filterstep - data = eval_filterstep( args, args[ 'index' ] ) -else: # filter - from camilladsp_plot import eval_filter - data = eval_filter( args ) - -print( json.dumps( data ) ) - \ No newline at end of file