Audiophile Linux与Cantata:显示专辑封面的步骤

最终,通过反复尝试,我成功地展示了无法在GMPC上显示的专辑封面。记录如下。

文献参考

    Accessing music files, and covers · CDrummond/cantata Wiki · GitHub

調整 Audiophile Linux (NGINX) 的配置

我在某处看到的一份文件中,最初,MPD并不是直接将音乐封面的数据传递给客户端,而是采用诸如HTTP等替代协议进行传输。然后,当我运行% which httpd nginx时,发现已经安装了NGINX。

httpd not found
/bin/nginx

在初始状态下,% sudo systemctl status nginx -l | cat 的结果显示未启动。

● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

在此处执行命令 % cd /etc/nginx; pwd 并执行 % ls -l,结果如下所示。

total 68
-rw-r--r-- 1 root root  1077 May  9 10:11 fastcgi.conf
-rw-r--r-- 1 root root  1007 May  9 10:11 fastcgi_params
-rw-r--r-- 1 root root  2837 May  9 10:11 koi-utf
-rw-r--r-- 1 root root  2223 May  9 10:11 koi-win
-rw-r--r-- 1 root root  3957 Apr 13  2017 mime.types
-rw-r--r-- 1 root root 32278 Nov 23  2017 mime.types.pacnew
-rw-r--r-- 1 root root  2687 May  9 10:11 nginx.conf
-rw-r--r-- 1 root root   636 May  9 10:11 scgi_params
-rw-r--r-- 1 root root   664 May  9 10:11 uwsgi_params
-rw-r--r-- 1 root root  3610 May  9 10:11 win-utf

提取并确认nginx.conf中处于有效状态的配置。

worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {
        listen       80;
        server_name  localhost;
        location / {
            root   /usr/share/nginx/html;
            index  index.html index.htm;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }
    }
}

几乎是初始状态?先备份一下。

% sudo cp -aiv nginx.conf nginx.conf.`date +%Y%m%d` 
'nginx.conf' -> 'nginx.conf.20190519'

% ls -l nginx.conf nginx.conf.`date +%Y%m%d`
-rw-r--r-- 1 root root 2687 May  9 10:11 nginx.conf
-rw-r--r-- 1 root root 2687 May  9 10:11 nginx.conf.20190519

请先在这里使用命令 % grep -E ‘^music_directory’ /etc/mpd.conf 确认设置为 NGINX 根目录的目录。

music_directory        "/home/muser/Music"

使用 % sudo vi nginx.conf 进行编辑后,可以使用 % diff -u nginx.conf.YYYYMMDD nginx.conf 来检查差异。

--- nginx.conf.20190520 2019-05-09 10:11:02.000000000 +0900
+++ nginx.conf  2019-05-20 23:34:52.086666658 +0900
@@ -41,7 +41,7 @@
         #access_log  logs/host.access.log  main;

         location / {
-            root   /usr/share/nginx/html;
+            root   /home/muser/Music;
             index  index.html index.htm;
         }

使用% sudo nginx -t命令来检查语法。

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

请在终端中输入以下命令来启用自动启动 NGINX: % sudo systemctl enable nginx。

Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /usr/lib/systemd/system/nginx.service.

用 `% sudo systemctl start nginx` 命令启动 NGINX,并使用 `% sudo systemctl status nginx -l | cat` 命令来检查状态。

● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2019-05-19 21:16:43 JST; 26s ago
  Process: 531 ExecStart=/usr/bin/nginx -g pid /run/nginx.pid; error_log stderr; (code=exited, status=0/SUCCESS)
 Main PID: 625 (nginx)
    Tasks: 2 (limit: 4687)
   Memory: 1.9M
   CGroup: /system.slice/nginx.service
           ├─625 nginx: master process /usr/bin/nginx -g pid /run/nginx.pid; error_log stderr;
           └─626 nginx: worker process

May 19 21:16:43 apl systemd[1]: Starting A high performance web server and a reverse proxy server...
May 19 21:16:43 apl systemd[1]: Started A high performance web server and a reverse proxy server.

启动Web浏览器,确认文件列表被显示出来。

合唱设定

※ 我正在尝试使用 v2.3.2 版本。

    1. 如果您能够连接到MPD,那么第一个向导就完成了。

 

    1. 请点击设置按钮,它位于设置界面右上角的汉堡图标旁边。

在集合设置界面中,在音乐文件夹字段中输入http://< NGINX主机名或IP地址>/。

点击应用按钮后,斜杠会转换为日元符号,但不要担心。

在界面设置的封面选项卡中,勾选“获取缺失封面”,在文件名字段中只输入“文件夹”。
此外,在预览选项卡中,勾选“背景图像”并选择“当前专辑封面”。

点击确定按钮,然后重新启动Cantata,应该能够看到专辑封面。

在存放音乐文件的目录中,最好也有存放着folder.jpg或者folder.png的文件。

突如背面击退。