为什么 minidlna 关闭与客户端的连接?

为什么 minidlna 关闭与客户端的连接?

操作系统:NixOS 不稳定 应用程序:迷你迪纳

我在 Debian 和我的电视上成功使用了 minidlna。但我在使用 NixOS 时遇到了问题。

这是我的 NixOS 配置(/etc/nixos/configuration.nix):

#DLNA
services.minidlna.enable = true;
services.minidlna.settings = {
  friendly_name = "PCMEDIA";
  media_dir = ["V,/mnt/ORION/DLNA/"];
  log_level = "debug";
};

这是我尝试用电视连接 DLNA 服务器时的日志:

$ sudo journalctl --unit minidlna -r
May 06 08:08:54 nixos minidlnad[40642]: EXT:
May 06 08:08:54 nixos minidlnad[40642]: Date: Sat, 06 May 2023 02:38:54 GMT
May 06 08:08:54 nixos minidlnad[40642]: Server: 5.15.93 DLNADOC/1.50 UPnP/1.0 MiniDLNA/1.3.1
May 06 08:08:54 nixos minidlnad[40642]: Content-Length: 2196
May 06 08:08:54 nixos minidlnad[40642]: Connection: close
May 06 08:08:54 nixos minidlnad[40642]: Content-Type: text/xml; charset="utf-8"
May 06 08:08:54 nixos minidlnad[40642]: upnphttp.c:1277: debug: HTTP RESPONSE: HTTP/1.1 200 OK
May 06 08:08:54 nixos minidlnad[40642]: 
May 06 08:08:54 nixos minidlnad[40642]: X-PANASONIC-DMP-Profile: MPEG_PS_PAL JPEG_SM PV_DIVX_DIV3 PV_DIVX_DIV4 PV_DIVX_DIVX PV_DIVX_DX50 PV_DRM_DIVX_DIV3 PV_DRM_DIVX_DIV4 PV_DRM_DIVX_DIVX P>
May 06 08:08:54 nixos minidlnad[40642]: X-PANASONIC-Registration: (hexadecimal number)
May 06 08:08:54 nixos minidlnad[40642]: Host: 192.168.1.180:8200
May 06 08:08:54 nixos minidlnad[40642]: User-Agent: Panasonic MIL DLNA CP UPnP/1.0 DLNADOC/1.50
May 06 08:08:54 nixos minidlnad[40642]: upnphttp.c:916: debug: HTTP REQUEST: GET /rootDesc.xml HTTP/1.1
May 06 08:08:54 nixos minidlnad[40642]: clients.c:357: debug: Client found in cache. [Panasonic/entry 0]
May 06 08:08:54 nixos minidlnad[40642]: minidlna.c:170: debug: HTTP connection from 192.168.1.184:58601
May 06 08:08:53 nixos minidlnad[40642]: minissdp.c:710: debug: SSDP M-SEARCH from 192.168.1.184:50051 ST: urn:schemas-upnp-org:device:MediaServer:2, MX: 1, MAN: "ssdp:discover"
May 06 08:08:53 nixos minidlnad[40642]: minissdp.c:710: debug: SSDP M-SEARCH from 192.168.1.184:50051 ST: urn:schemas-upnp-org:device:MediaServer:2, MX: 1, MAN: "ssdp:discover"
May 06 08:08:53 nixos minidlnad[40642]: minissdp.c:265: debug: Sending M-SEARCH response to 192.168.1.184:50050 ST: urn:schemas-upnp-org:device:MediaServer:
May 06 08:08:53 nixos minidlnad[40642]: minissdp.c:710: debug: SSDP M-SEARCH from 192.168.1.184:50050 ST: urn:schemas-upnp-org:device:MediaServer:1, MX: 1, MAN: "ssdp:discover"
May 06 08:08:53 nixos minidlnad[40642]: minissdp.c:265: debug: Sending M-SEARCH response to 192.168.1.184:50050 ST: urn:schemas-upnp-org:device:MediaServer:
May 06 08:08:53 nixos minidlnad[40642]: minissdp.c:710: debug: SSDP M-SEARCH from 192.168.1.184:50050 ST: urn:schemas-upnp-org:device:MediaServer:1, MX: 1, MAN: "ssdp:discover"
May 06 08:07:54 nixos minidlnad[40642]: <root xmlns="urn:schemas-upnp-org:device-1-0"><specVersion><major>1</major><minor>0</minor></specVersion><device><deviceType>urn:schemas-upnp-org:dev>
May 06 08:07:54 nixos minidlnad[40642]: <?xml version="1.0"?>

如何让 minidlna 工作?不仅仅是我的电视,它不能与 VLC 或任何其他支持 DLNA 的应用程序配合使用。

答案1

/mnt/ORION/DLNA/使用类似 的内容检查名称和权限ls -ld /mnt/ORION/DLNA

另外,代替

media_dir = ["V,/mnt/ORION/DLNA/"];

尝试

media_dir = V,/mnt/ORION/DLNA

(没有括号,没有引号,也没有尾部斜杠,按照联机帮助页),否则您最终可能会没有有效的路径,这可能是提前关闭的原因。

答案2

minidlna无法访问指定的“媒体目录”。 NixOSminidlna以用户身份运行minidlna。因此,需要将用户minidlna添加到有权访问媒体目录中指定位置的用户组。

/etc/nixos/configuration.nix:

services.minidlna.enable = true;
services.minidlna.settings = {
  friendly_name = "Movies";
  media_dir = ["V,/mnt/ORION/DLNA/"];

  # so changes in media dirs are updates in the server listing
  # also make sure "inotify-tools" packages is installed
  inotify = "yes"; 
  #log_level = "debug";
};

users.users.minidlna = {
  extraGroups = [ "users" ];
};

另外,如果您尝试minidlna以系统用户身份运行,您可能需要清除/var/cache/minidlnadb_dir一般。

相关内容