Minidlna 目录问题

Minidlna 目录问题

我已经搜索过了,但找不到这个特定问题的答案。我已经设置并运行了 minidlna - 但设置得并不好。

首先,当我在蓝光播放器上打开服务器时,我的所有电影都会列出两次 - 而它们肯定不会在我的外部设备上保存两次。

其次,当我打开服务器时,它不会读取“电影”、“电视”、“音乐”等,而是将我所有的电影、电视和其他文件夹混在一起,没有任何组织。当我设置 Windows 时,我从未遇到过这个问题,所以我知道这是配置不当造成的,而不是我的外部驱动器给我带来的问题。

这是我的 minidlna.conf 文件:

    # This is the configuration file for the MiniDLNA daemon, a DLNA/UPnP-AV media
# server.
#
# Unless otherwise noted, the commented out options show their default value.
#
# On Debian, you can also refer to the minidlna.conf(5) man page for
# documentation about this file.

media_dir=/media/somnambulist/Ghost In You
# This option can be specified more than once if you want multiple directories
# scanned.
#
# If you want to restrict a media_dir to a specific content type, you can
# prepend the directory name with a letter representing the type (A, P or V),
# followed by a comma, as so:
#   * "A" for audio    (eg. media_dir=A,/var/lib/minidlna/music)
#   * "P" for pictures (eg. media_dir=P,/var/lib/minidlna/pictures)
#   * "V" for video    (eg. media_dir=V,/var/lib/minidlna/videos)
#
# WARNING: After changing this option, you need to rebuild the database. Either
#          run minidlna with the '-R' option, or delete the 'files.db' file
#          from the db_dir directory (see below).
#          On Debian, you can run, as root, 'service minidlna force-reload' instead.
#media_dir=/var/lib/minidlna
media_dir=V,/media/somnambulist/Ghost In You/Movies
media_dir=V,/media/somnambulist/Ghost In You/TV
media_dir=P,/home/somnambulist/Pictures


# Path to the directory that should hold the database and album art cache.
db_dir=/home/somnambulist/serverart

# Path to the directory that should hold the log file.
log_dir=/home/somnambulist/serverlog

# Minimum level of importance of messages to be logged.
# Must be one of "off", "fatal", "error", "warn", "info" or "debug".
# "off" turns of logging entirely, "fatal" is the highest level of importance
# and "debug" the lowest.
#log_level=warn

# Use a different container as the root of the directory tree presented to
# clients. The possible values are:
#   * "." - standard container
#   * "B" - "Browse Directory"
#   * "M" - "Music"
#   * "P" - "Pictures"
#   * "V" - "Video"
# if you specify "B" and client device is audio-only then "Music/Folders" will be used as root
root_container=B

# Network interface(s) to bind to (e.g. eth0), comma delimited.
#network_interface=

# IPv4 address to listen on (e.g. 192.0.2.1).
#listening_ip=

# Port number for HTTP traffic (descriptions, SOAP, media transfer).
port=8200

# URL presented to clients.
# The default is the IP address of the server on port 80.
#presentation_url=http://example.com:80

# Name that the DLNA server presents to clients.
friendly_name=Somnambulist Media Server

# Serial number the server reports to clients.
serial=12345678

# Model name the server reports to clients.
#model_name=Windows Media Connect compatible (MiniDLNA)

# Model number the server reports to clients.
model_number=1

# Automatic discovery of new files in the media_dir directory.
#inotify=yes

# List of file names to look for when searching for album art. Names should be
# delimited with a forward slash ("/").
album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg

# Strictly adhere to DLNA standards.
# This allows server-side downscaling of very large JPEG images, which may
# decrease JPEG serving performance on (at least) Sony DLNA products.
#strict_dlna=no

# Support for streaming .jpg and .mp3 files to a TiVo supporting HMO.
#enable_tivo=no

# Notify interval, in seconds.
#notify_interval=895

# Path to the MiniSSDPd socket, for MiniSSDPd support.
#minissdpdsocket=/run/minissdpd.sock`

这是我运行时在终端中出现的错误:

sudo service minidlna restart
sudo service minidlna force-reload

强制重启错误:

Restarting DLNA/UPnP-AV media server minidlna                                
[2013/08/12 21:19:27] minidlna.c:474: error: Media directory "/media/somnambulist/Ghost In You/Movies" not accessible! [Permission denied]
[2013/08/12 21:19:27] minidlna.c:474: error: Media directory "/media/somnambulist/Ghost In You/TV" not accessible! [Permission denied]

强制重新加载错误:

Restarting DLNA/UPnP-AV media server minidlna                                
[2013/08/12 21:19:46] minidlna.c:474: error: Media directory "/media/somnambulist/Ghost In You/Movies" not accessible! [Permission denied]
[2013/08/12 21:19:46] minidlna.c:474: error: Media directory "/media/somnambulist/Ghost In You/TV" not accessible! [Permission denied]
rm: cannot remove ‘/home/somnambulist/serverart/files.db’: Permission denied
rm: cannot remove ‘/home/somnambulist/serverart/art_cache/media/somnambulist/Ghost In You/Movies/Slumdog Millionaire/Slumdog.Millionaire.Cover.jpg’: Permission denied
rm: cannot remove ‘/home/somnambulist/serverart/art_cache/media/somnambulist/Ghost In You/Movies/Zack and Miri Make a Porno/ZackAndMiriMakeAPornoCover.jpg’: Permission denied
[2013/08/12 21:19:46] minidlna.c:744: warn: Failed to clean old file cache.
                                                                         [ OK ]

到目前为止,我已经花了几个小时在这上面,阅读了各种文件 - 甚至有一个对 Ubuntu 比较熟悉的朋友试图通过聊天来帮助我 - 但没有那么幸运。

在此先感谢您的帮助。

答案1

错误在这里

rm: cannot remove ‘/home/somnambulist/serverart/files.db’: Permission denied
rm: cannot remove ‘/home/somnambulist/serverart/art_cache/media/somnambulist/Ghost In You/Movies/Slumdog Millionaire/Slumdog.Millionaire.Cover.jpg’: Permission denied
rm: cannot remove ‘/home/somnambulist/serverart/art_cache/media/somnambulist/Ghost In You/Movies/Zack and Miri Make a Porno/ZackAndMiriMakeAPornoCover.jpg’: Permission denied
[2013/08/12 21:19:46] minidlna.c:744: warn: Failed to clean old file cache.

minidlna无法删除旧文件,因此失败。我遇到了同样的问题。删除旧Art_cache文件夹,然后重试。

答案2

我既不是 ubuntu 专家也不是 minidlna 专家 - 但我终于在 ubuntu server 12.04 上启动了我的 minidlna 服务器(今天!)并因此遇到了一些问题(并且知道如果你接近目标但却没有达到,你会有多么绝望)。

第一个怀疑:minidlna 混淆了其内部数据库中的某些内容。因此删除 files.db,在 Ubuntu 12.04 下,您需要类似以下内容(可能还需要 sudo):

rm /var/lib/minidlna/files.db

然后重新启动 minidlna + 等待(它将重新创建文件)

第二个嫌疑人:你的路径中有一些空格:

/media/somnambulist/Ghost In You

Linux 和一些编程语言对此有点挑剔——如果没有正确处理,这可能会在 minidlna 内部引起一些问题。

请尝试:

/media/somnambulist/Ghost_In_You

(即更改目录的名称minidlna.conf 文件中的设置)

对于第二个嫌疑人,您可能还需要再次删除 files.db。

无论第二名嫌疑人的结果如何 - 请发布结果,以便其他人也能从中受益。人们已经可以在网上找到第一名嫌疑人/线索。

没有保证——但值得一试。

答案3

您的问题是文件权限。如果您是 Linux 新手,那么您应该花一点时间了解文件权限如何工作

minidlna 服务器作为单独的进程运行,并且通常会在 minidlna.conf 文件中指定用户名 minidlna。

# Specify the user name or uid to run as.
user=minidlna

数据库通常位于目录中

# Path to the directory that should hold the database and album art cache.
db_dir=/var/cache/minidlna

检查此目录的权限和所有者

~$ stat /var/cache/minidlna
  File: /var/cache/minidlna
  Size: 4096        Blocks: 8          IO Block: 4096   directory
Device: 801h/2049d  Inode: 1967306     Links: 3
Access: (0750/drwxr-x---)  Uid: (  127/minidlna)   Gid: (  134/minidlna)
Access: 2020-04-26 11:39:36.340582338 +0100
Modify: 2020-07-07 08:35:11.796748628 +0100
Change: 2020-07-07 08:35:11.796748628 +0100
 Birth: 2020-04-26 11:39:36.340582338 +0100

在 Access 中,第一个 rwx 是所有者权限,rx 是组权限,最后一个 --- 是全局权限。因此 minidlna 用户可以读取、写入和执行此文件,执行位意味着当应用于目录时,您可以执行文件列表。要查看实际效果,请尝试:

~$ ll /var/cache/minidlna/
ls: cannot open directory '/var/cache/minidlna/': Permission denied
~$ sudo ls -l /var/cache/minidlna/
total 4504
drwxr-xr-x 3 minidlna root    4096 Jul  7 08:35 art_cache
-rw-r--r-- 1 minidlna root 4603904 Nov  8 01:47 files.db

在第一个 ll 命令中,我的普通用户没有此目录的 x 权限。但数据库文件的权限设置正确。

您提到的另一个问题是目录结构的压缩。这部分是客户端的功能,但如果客户端支持,请选择基于文件夹的呈现方式。默认情况下,minidlna 应该设置这些选项。

# URL presented to clients (e.g. http://example.com:80).
presentation_url=/
# Set this to merge all media_dir base contents into the root container
# (The default is no.)
merge_media_dirs=no

答案4

尝试将 umask=007 更改为 umask=002 并重新挂载分区。这样对您有用。

相关内容