Mysql database repair

/opt/local/bin/mysqlcheck -c piwigo piwigo_history -u root -p

/opt/local/bin/mysqlcheck -r piwigo piwigo_history -u root -p

piwigo_history ==> Database table name

piwigo ==> Database name

myMPD Local Playback

Add a httpd audio output in mpd.conf, refer to https://jcorporation.github.io/myMPD/references/local-playback

# myMPD local playback
audio_output {
    type        "httpd"
    name        "HTTP Stream"
    encoder     "vorbis"
    port        "8000"
    quality     "10.0"
    format      "44100:16:1"
    always_on   "yes"
    tags        "yes"
}

Enable Local playback in mympd menu:

Settings/Features/Local playback/Enable

Launch browser, play the selected music by both:

play button: control the mpd play

local button: link to the httpd output

Test Environment:

mpd: v0.23.15

mympd: v14.1.1

server os: Ubuntu 18.04.1

client os: Android 13

client browse: chrome/firefox

Tailscale vpn bypass firewall

Sometime, we need to bypass the firewall.

Suppose there are two linux box, a local box and a remote box, the local box unable to access some URL, due to the firewall limitation, while the remote box have no limitation.

We setup one tailscale vpn between these two nodes, as describe in https://tailscale.com/kb/1017/install

Now we config a exit node, to bypass the firewall of the local linux box.

Remore linux: Enable IP forward & Add exit-node:

sudo sed -i “s/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/” /etc/sysctl.conf

sudo sed -i “s/#net.ipv6.conf.all.forwarding=1/net.ipv6.conf.all.forwarding=1/” /etc/sysctl.conf

sudo sysctl -p /etc/sysctl.conf
sudo tailscale up --advertise-exit-node

Tailscale admin webpage: Approve the exit node

Local linux:  Use exit-node:

sudo sed -i "s/#net.ipv4.conf.all.rp_filter=1/net.ipv4.conf.all.rp_filter=2/"  /etc/sysctl.conf


sudo sysctl -p /etc/sysctl.conf

sudo tailscale up --accept-routes --exit-node-allow-lan-access --exit-node=RemoteIP

Where RemoteIP is the vpn ip of remote node, say 100.113.189.45

Setup Home WiFi Audio System

Build home MPD wifi audio system, by combine:

  • Active Speaker
  • Wifi Router with usb port, and support openwrt
  • USB sound card

Upgrade openwrt to the latest version

SSH log into openwrt

######################################
######### Repository #################

cp /etc/opkg/distfeeds.conf  /etc/opkg/distfeeds.conf.bak
sed -i "s#downloads.openwrt.org#mirrors.ustc.edu.cn/openwrt#g" /etc/opkg/distfeeds.conf
#sed -i "s#downloads.openwrt.org#mirrors.tuna.tsinghua.edu.cn/openwrt#g" /etc/opkg/distfeeds.conf
#sed -i "s#downloads.openwrt.org#mirrors.aliyun.com/openwrt#g" /etc/opkg/distfeeds.conf
#sed -i "s#downloads.openwrt.org#mirrors.cloud.tencent.com/openwrt#g" /etc/opkg/distfeeds.conf

opkg update


######################################
########## pulseaudio ################

opkg install kmod-input-core
opkg install kmod-sound-core
opkg install kmod-usb-audio
opkg install pulseaudio-daemon


#########################################
########## Sound Blaster ################
# opkg install kmod-ac97
# opkg install kmod-sound-ens1371


########## AC 97 ########################
#opkg install kmod-sound-cs5535audio 


####### Motherboard Sound Card ##########
#opkg install  kmod-sound-i8x0

############ Soc Sound Card #############
#opkg install  kmod-sound-soc-core 



##### Editor ############################ 
# opkg install nano


###########  Utility  ###################
#opkg install usbutils
#opkg install alsa-utils


### Allow module load ###
sed -i "s/--disallow-module-loading//"   /etc/init.d/pulseaudio

### Load TCP module ###
sed -i "s/load-module module-native-protocol-unix/load-module module-native-protocol-tcp auth-anonymous=1/"  /etc/pulse/system.pa





### Firewall ###
sh -c " cat >/etc/config/firewall " << EOF


######  ssh port ##################
config redirect
       option src              wan
       option src_dport        22
       option dest             lan
       option dest_ip          192.168.1.1
       option dest_port        22
       option proto            tcp

###### pulseaudio port ############
config redirect
       option src              wan
       option src_dport        4713
       option dest             lan
       option dest_ip          192.168.1.1
       option dest_port        4713
       option proto            tcp

###### Http Port ##################
onfig redirect
        option src 'wan'
        option src_dport '80'
        option dest 'lan'
        option dest_ip '192.168.1.1'
        option dest_port '80'
        option proto 'tcp'

EOF



/etc/init.d/firewall   restart
/etc/init.d/pulseaudio restart




######################################
######################################
########## WiFI Relay ################
opkg install relayd
opkg install luci-proto-relay


# From web admin portal, setup new wireless wan port for 5G and 2G separately:
# http://192.168.1.1/cgi-bin/luci/
### Network
### Wireless
### Scan
### Selected your existed SSID, Joining Network
### ## Replace wireless configuration  = yes
### ## Create / Assign firewall-zone   = LAN
### Go to Network/Interface
### Set the IP of  wireless wan, as normal

Login into your MPD system, add the following block into the the mpd.conf file:

audio_output {

 type "pulse"

 name " Wifi Router"

 server "IP_OF_WIFI_ROUTER:4713" 

}

Now, you can find the “Wifi Router” option item, from Outputs/Server properties/M.A.L.P, suppose M.A.L.P apk installed android handset