alist汇聚了各种网盘,局域网的Windows共享。jellyfin是安装在openwrt下的docker里。

为了方便jellyfin访问alist上的各种视频资源,将alist以webdva的形式挂载到openwrt内。方便jellyfin进行索引及访问。

安装rclone

openwrt下的rclone实际上是提供了webUI界面的,但是UI似乎有各种问题,在经过各种查找之后,基本看到的都是通过命令来实现的。

rclone配置WebDAV官方教程

openwrt控制台:

rclone config

跟着官方教程来就可以了(bearer_token选项时,为空即可)

No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> remote
Type of storage to configure.
Choose a number from below, or type in your own value
[snip]
XX / WebDAV
   \ "webdav"
[snip]
Storage> webdav
URL of http host to connect to
Choose a number from below, or type in your own value
 1 / Connect to example.com
   \ "https://example.com"
url> https://example.com/remote.php/webdav/
Name of the WebDAV site/service/software you are using
Choose a number from below, or type in your own value
 1 / Fastmail Files
   \ (fastmail)
 2 / Nextcloud
   \ (nextcloud)
 3 / Owncloud
   \ (owncloud)
 4 / Sharepoint Online, authenticated by Microsoft account
   \ (sharepoint)
 5 / Sharepoint with NTLM authentication, usually self-hosted or on-premises
   \ (sharepoint-ntlm)
 6 / rclone WebDAV server to serve a remote over HTTP via the WebDAV protocol
   \ (rclone)
 7 / Other site/service or software
   \ (other)
vendor> 5
User name
user> user
Password.
y) Yes type in my own password
g) Generate random password
n) No leave this optional password blank
y/g/n> y
Enter the password:
password:
Confirm the password:
password:
Bearer token instead of user/pass (e.g. a Macaroon)
bearer_token>
Remote config
--------------------
[remote]
type = webdav
url = https://example.com/remote.php/webdav/
vendor = nextcloud
user = user
pass = *** ENCRYPTED ***
bearer_token =
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y

配置完成之后,可通过(alist替换为配置remote时候的name)

rclone lsd alist:

如果能够显示webdva的目录内容,则表示前面的配置没有问题。

下一步就是将这个webdva到合适的参数挂载到挂载点。

rclone mount alist: /mnt/alist --allow-other --allow-non-empty --vfs-cache-mode full --file-perms 0777 --buffer-size 512M --cache-dir /mnt/sda1/RcloneTemp

1、rclone mount Aliyun: /mnt/mydisk/Aliyun:
rclone mount: 使用 rclone 挂载云存储。
Aliyun:: 这是你配置的 Aliyun OSS bucket 的名字。Aliyun 是你在 rclone.conf 配置文件中为这个 bucket 设置的名字。
/mnt/mydisk/Aliyun: 这是你在本地文件系统中想要挂载 bucket 的目录。
2、--config /root/.config/rclone/rclone.conf:
指定 rclone 配置文件的路径。这个配置文件包含了你的 Aliyun OSS 的认证信息和其他相关设置。
3、--header "Referer:":
发送一个 HTTP Referer 头。在某些情况下,云存储服务可能要求这个头来验证请求的来源。这里,它看起来是一个空值,可能需要根据实际情况填写。
4、--multi-thread-streams 8:
使用 8 个并行流来处理文件传输。这可以提高大量文件的上传和下载速度。
5、--buffer-size 512M:
设置 I/O 操作的缓冲区大小为 512MB。这可以影响性能和内存使用。
6、--vfs-fast-fingerprint:
使用更快的文件指纹算法。这可以加快文件列表的生成速度,但可能不如默认算法准确。
7、--vfs-cache-mode full:
使用完全的缓存模式。这意味着 rclone 会尝试缓存尽可能多的文件数据,以提高性能。
8、--no-modtime:
不尝试保持文件的修改时间。这可以加快挂载速度,但本地文件的修改时间不会反映其在云存储上的原始时间。
9、--file-perms 0777:
设置挂载的文件和目录的权限为 0777,即所有用户都可以读、写和执行。
10、--copy-links:
复制符号链接而不是跟随它们。这意味着在挂载的目录中,符号链接会作为文件被复制,而不是指向其目标。
11、--allow-other:
允许其他用户访问挂载点。这通常与 NFS 挂载一起使用,但在这里也可以用于使其他用户能够访问挂载的 bucket。
12、--allow-non-empty:
允许挂载到非空目录。这意味着如果 /mnt/mydisk/Aliyun 已经包含文件或目录,rclone 仍然会尝试挂载。
13、--umask 000:
设置 umask(用户文件创建掩码)为 000,以确保新创建的文件和目录具有最大的权限(在这里是 0777)。
14、--daemon:
在守护进程模式下运行 rclone。这意味着 rclone 将在后台运行,不会占用终端窗口。
15、-cache-dir /mnt/sda1/RcloneTemp
指定缓存文件的目录

当前问题:

alist挂载了阿里云盘的视频文件
也就是jellyfin获取文件的线路:jellyfin-openwrt-webdva-alist-阿里云盘
提示播放失败,控制台输出错误为:

2024/02/16 21:43:09 ERROR : aliyun/新建文件夹/Parasite.2019.KOREAN.2160p.BluRay.HEVC.DV.TrueHD.7.1.Atmos.mkv: vfs cache: failed to download: vfs reader: failed to write to cache file: 403 Forbidden

似乎是再说缓存下载失败,写入缓存文件失败,报错403拒绝请求。但在alist下访问,播放都是正常的。无论是alist挂载的本地磁盘文件,还是局域网共享文件,还是阿里云盘的文件,都是可以正常播放的。

下次继续研究......

有可能是rclone的原因,下次用CloudDrive2方案试试看。

2024年2月16日