------------------------------------------------------------------------
 DirettaMemoryPlay WebUI / mpddirettamp                 2025/03/10
------------------------------------------------------------------------
mpdwebの拡張機能としての，DirettaMemoryPlayのWebUIです。

同封ファイル
  Readme.txt
  mpddirettamp.pdf
  mpddirettamp.php

動作環境
  ArchLinux
  Oliospec社MemoryPlay/Direttaが動作している(MusicArchはインストール済)
  ・Diretta:MemoryPlayControllerSDK
  ・Diretta:MemoryPlayHostLinux
  httpd(nginx推奨)/php7以上が動作している環境
    # pacman -S nginx
    # pacman -S php php-fpm
  下記、環境作成のときのメモかmpddirettamp.pdf参照
  
セットアップ
  ・WebRoot Directoryから見える適当なDirectory
    ※mpdwebをインストールしている場合,/{root Diretory}/mpdweb/になります。
  ・mpddirettamp.phpをWeb下のDirectoryにコピー(同封のモジュール)
  ・chmod 0666 mpddirettamp.php
  ・mpdweb連携の場合
   mpdweb1.47以降のmpdmyset.xml.sampleの下部 <memoryplay-frm>,<memoryplar-wind>何れかを使用する

実行
  http:{host}/{Directory}/mpddirettamp.php {?frame=on&path={Path}:連携モード,省略可}
  mpdweb連携の場合，mpdwebの拡張Favoritesから起動

  設定を保存すると，設定File:mpddiretta_config.phpが Directory:./settingまたは，直下に保存される。

ほとんどの説明は"mpddirettamp.pdf"に盛り込んだつもりです。
拡張モジュールなので、インストーラなどありません。


以下はインストールしたときの参考メモです。

参考メモ

環境作成のときのメモです。
------------------------------------------------------------------------
1.MemoryPlayインストール
------------------------------------------------------------------------

 # cd /home/share/

 # tar xvf MemoryPlayControllerSDK_xxx.tar.zst
 # cd MemoryPlayControllerSDK
 # rm -rf flac
 # wget https://ftp.osuosl.org/pub/xiph/releases/flac/flac-1.4.3.tar.xz
 # cd flac
 # ./autogen.sh
 # ./configure --host=$HOST --disable-ogg --enable-static
 # make
 # cd ..

 $ ls -al libFind_aarch64*
-rw-r--r-- 1 ms01 ms01 178790 10月 18 13:10 libFind_aarch64-16k-linux-gcc12.a
-rw-r--r-- 1 ms01 ms01 186364 10月 18 13:10 libFind_aarch64-16k-linux.a
-rw-r--r-- 1 ms01 ms01 171230 10月 18 13:10 libFind_aarch64-linux-14.a
-rw-r--r-- 1 ms01 ms01 171230 10月 18 13:10 libFind_aarch64-linux-14k16.a
-rw-r--r-- 1 ms01 ms01 179198 10月 18 13:10 libFind_aarch64-linux-gcc12.a
-rw-r--r-- 1 ms01 ms01 186932 10月 18 13:10 libFind_aarch64-linux.a

 # make ARCH_NAME=x64-linux-14


----------------
今津さん(アドバイス)版
tar xvf MemoryPlayControllerSDK_xxx.tar.zst
cd MemoryPlayControllerSDK
rm -rf flac
git clone https://github.com/xiph/flac.git
cd flac
apt install libtool
ln -s /usr/bin/libtoolize /usr/bin/libtool

./autogen.sh
./configure --host=$HOST --disable-ogg --enable-static
make -j8
cd ..
make -j8 ARCH_NAME=x64-linux-14v3
(-j8コア数)
----------------


------------------------------------------------------------------------
2.MemoryPlayHost インストール
------------------------------------------------------------------------

 # cd /home/share/

 # tar xvf MemoryPlayHostLinux_xxxx.tar.zst
 # cd MemoryPlay
 MemoryPlayHostの選択 適当に選んで実行して決定
 # ./MemoryPlayHost_gcc14_x64_v1
 # ln -s MemoryPlayHost_gcc14_x64_v1 MemoryPlayHostLinux

 # vi diretta_memoryplay_host.service
[Unit]
Description = Diretta Alsa Host
After=network-online.target
ConditionPathExists=/home/share/MemoryPlay ←修正

[Service]
ExecStart=/home/share/MemoryPlay/MemoryPlayHostLinux　 ←修正
Restart=always
Type=simple

User=root

[Install]
WantedBy=multi-user.target

 # systemctl enable /home/share/MemoryPlay/diretta_memoryplay_host.service
 # systemctl start diretta_memoryplay_host

------------------------------------------------------------------------
3.実行&テスト
------------------------------------------------------------------------

# cd /home/share/MemoryPlayControllerSDK#

 # ./MemoryPlayHost_gcc14_x64_v1
 Play内容を表示
 
MemoryHostのListを表示
 # ./MemoryPlayController -c list 
   ::1,46811%0 MemoryPlayHost MP1    : Host

MemoryHostのListよりHostを選択
 #./MemoryPlayController -c target ::1,46811%0
fe80::da3a:ddff:fe44:6261,19644%2 TargetApp_4B3E(OPPO HA-1 USB AUDIO 2.0 DAC) : Direttaが帰ってくる

./MemoryPlayController -c upload  ::1,46811%0 "/mnt/NAS/music/Music3/DEODATO/DEODATO - 1988 - Deodato 2"
                                              "/mnt/NAS/music/Music3/ABBA/The Album"

Connect & Play
 # ./MemoryPlayController -c connect ::1,46811%0 fe80::da3a:ddff:fe44:6261,19644%2

 # ./MemoryPlayController -c status ::1,46811%0
Play

./MemoryPlayController -c  tag  ::1,34395%0
0 351 05:48 Eagle
1 596 04:05 Take a Chance on Me
2 869 04:33 One Man, One Woman
3 1162 04:53 The Name of the Game
4 1445 04:43 Move On
5 1671 03:46 Hole in Your Soul
6 1902 03:51 Thank You for the Music [From the Girl with the Golden Hair]
7 2175 04:33 I Wonder (Departure) [From the Girl with the Golden Hair]
8 2419 04:04 I'm a Marionette [From the Girl with the Golden Hair]
-1 2419 QUIT

# Tag Skip
./MemoryPlayController -c seektag ::1,34395%0 6

# Quit
./MemoryPlayController -c quit ::1,46811%0


# Status
./MemoryPlayController -c status ::1,46811%0
Disconnect

Error時のStandardout
 # ./MemoryPlayController -c upload ::1,35735%0 "/mnt/NAS/music/Music1/aiko/夏服"
detect:08 雨踏むオーバーオール.flac
Not a RIFF format /mnt/NAS/music/Music1/aiko/夏服/08 雨踏むオーバーオール.flac
wav read error

# ./MemoryPlayController -c upload  ::1,46811%0 "/mnt/NAS/music/Music3/ABBA/The Album"


detect:03 One Man, One Woman.flac
Title:One Man, One Woman
Index:3
detect:01 Eagle.flac
Title:Eagle
Index:1
detect:08 I Wonder (Departure) [From the Girl with the Golden Hair].flac

Title:I Wonder (Departure) [From the Girl with the Golden Hair]
Index:8
detect:06 Hole in Your Soul.flac
Title:Hole in Your Soul
Index:6
detect:04 The Name of the Game.flac
Title:The Name of the Game
Index:4
detect:02 Take a Chance on Me.flac
Title:Take a Chance on Me
Index:2
detect:09 I'm a Marionette [From the Girl with the Golden Hair].flac
Title:I'm a Marionette [From the Girl with the Golden Hair]
Index:9
detect:05 Move On.flac
Title:Move On
Index:5
detect:07 Thank You for the Music [From the Girl with the Golden Hair].flac
Title:Thank You for the Music [From the Girl with the Golden Hair]
Index:7
Host Connect to ::1,46811%0
Host Connect Error 111
root@ms01-archmpd:/home/share/MemoryPlayControllerSDK#

---------------------------------------------------------------------------------
  nginx /php install
---------------------------------------------------------------------------------

nginx Install
# pacman -Syu
# pacman -S nginx
# systemctl start nginx
# systemctl enable nginx

PHP(PHP8.3) Install 
# pacman -S php php-fpm
# systemctl start php-fpm
# systemctl enable php-fpm

# vi /etc/nginx/nginx.conf

 ////// PHPファイルを処理できるように設定 ////////////
   server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /var/www/html;     <---- 変更
            index  index.html index.htmi index.php; <---- index.phpを追加
        }

        location ~ \.php$ {           <---- phpの設定
        #   root           html;
        #   fastcgi_pass   127.0.0.1:9000;
            fastcgi_pass   unix:/run/php-fpm/php-fpm.sock;
            fastcgi_index  index.php;
        #   fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
            fastcgi_param  SCRIPT_FILENAME  /var/www/html$fastcgi_script_name;
            include        fastcgi_params;
        }

# vi fastcgi_params
//////////$SERVER["DOCUMENT_ROOT"] が正しくないので下記を設定 ///////////
fastcgi_param  DOCUMENT_ROOT      /var/www/html;
に設定

# mkdir /var/www
# mkdir /var/www/html
# chown -R http:http /var/www/html
# cp /usr/share/nginx/html/index.html /var/www/html/

# echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php

systemctl restart nginx

テストする

Nginx のパフォーマンスを向上させるため

# pacman -S php-cgi

# vi /etc/nginx/nginx.conf の該当部分を編集
sendfile on;
gzip on;

