qinfengge

qinfengge

醉后不知天在水,满船清梦压星河
github
email
telegram

Build a low-cost personal film and television library using Alist and EMBY.

Actually, I have also written an article about Emby + Google Drive before, but times have changed.
Google Drive has almost banned educational and team drives, and the TOS has become stricter, making it more difficult to transfer files.
On the other hand, OneDrive does not have the transfer function, only local uploads are possible.

Until Aliyun Drive emerged as a strong competitor, with domestic optimization and an active community (referring to many Telegram sharing channels), coupled with the fact that Aliyun Drive OPEN has opened its API, making it almost perfect.

Without further ado, this blog post will guide you on how to use Alist to add Aliyun Drive, mount webdav with rclone, and use Emby to scrape resources from Aliyun Drive.

Installing Alist and Configuring Aliyun Drive#

The official documentation is already very detailed.
It is recommended to install using Docker.

docker run -d --restart=always -v /etc/alist:/opt/alist/data -p 5244:5244 -e PUID=0 -e PGID=0 -e UMASK=022 --name="alist" xhofe/alist:latest

After installation, use the following command to view the admin account password.

docker exec -it alist ./alist admin

Access ip:5244 and log in with the admin account and password.

The official documentation for configuring Aliyun Drive is also very detailed.
The main steps are to select the Aliyun Drive OPEN driver and configure the refresh token.
Go to: https://alist.nn.ci/tool/aliyundrive/request
Use the Aliyun Drive mobile app to scan the QR code and obtain the refresh token.

Notes
Please select Local for the WebDAV Policy, as webdav does not support redirection.
If not set or set incorrectly, Emby can scrape, but entering the resource library will keep loading.
Related Issues:

image

Mounting WebDAV with Rclone#

sudo -v ; curl https://rclone.org/install.sh | sudo bash

After installation, use rclone config to create a new configuration.
Select webdav and configure as required.
You can refer to the following article for configuration:
Mount Aliyun Drive on Synology/Linux to Play with Emby and Create Your Own Home Theater!

image

After configuration, use the following command to mount it locally.

rclone mount alist: /home/webdav --use-mmap --umask 000 --network-mode --no-check-certificate --allow-other --allow-non-empty --dir-cache-time 4h --cache-dir=/home/cache --header "Referer:" --vfs-cache-mode full --buffer-size 512M --vfs-read-chunk-size 64M --vfs-read-chunk-size-limit 1G --vfs-cache-max-size 10G --daemon
  • alist: /home/webdav alist is the name of the rclone configuration, and /home/webdav is the local mount path.
  • --dir-cache-time 4h cache time, refresh cache every 4 hours. If the cloud drive files are not frequently modified, this value can be set to 24h.
  • --cache-dir=/home/cache cache path.
  • --header "Referer:" This is a required parameter for mounting Aliyun Drive, as mentioned in the issues, but it seems to work without it.

If there is an error when mounting with rclone mount

Fatal error: failed to mount FUSE fs: fusermount: exec: "fusermount": executable file not found

Install fuse

apt-get install fuse

Use df -h to check if the mount was successful.

To unmount, LocalFolder represents the local mount path.

fusermount -qzu LocalFolder

To mount on startup

# Modify the command to match the parameters you used in the previous manual command, excluding rclone
command="mount alist: /home/webdav --use-mmap --umask 000 --network-mode --no-check-certificate --allow-other --allow-non-empty --dir-cache-time 4h --cache-dir=/home/cache --header "Referer:" --vfs-cache-mode full --buffer-size 512M --vfs-read-chunk-size 64M --vfs-read-chunk-size-limit 1G --vfs-cache-max-size 10G --daemon"
# The following is a complete command, copy and run it in the SSH client
cat > /etc/systemd/system/rclone.service <<EOF
[Unit]
Description=Rclone
After=network-online.target

[Service]
Type=simple
ExecStart=$(command -v rclone) ${command}
Restart=on-abort
User=root

[Install]
WantedBy=default.target
EOF

Start the service:

systemctl start rclone

Set it to start on boot:

systemctl enable rclone

Other commands:

Restart: systemctl restart rclone
Stop: systemctl stop rclone
Status: systemctl status rclone

Emby Installation and Configuration#

Below is the Emby happy edition Docker image, for demonstration purposes only. Please support the official version if you have the capability.

docker run \
	--name EmbyServer \
	--net=host  \
	-v /docker/emby:/config \
	-v /aliyun:/aliyun \
	-e TZ="Asia/Shanghai" \
	--device /dev/dri:/dev/dri \
	-e UID=0 \
	-e GID=0 \
	-e GIDLIST=0 \
	--restart always \
	-d lovechen/embyserver:latest

If you need to configure the official version, just change "lovechen" to "emby" in the last line to configure the official Emby Docker source.
If the software router does not have the scientific Internet access mode enabled, you need to add the following to the Docker environment parameters:
HTTP_PROXY=http://proxyIP:proxyPort
HTTPS_PROXY=http://proxyIP:proxyPort
(This is to ensure that the scraper can work properly, as most scrapers have been blocked)
  • -v /docker/emby:/config Mapping of configuration files, with the former being the host path.
  • -v /aliyun:/aliyun Mapping of resource library paths, should be the path mounted by webdav.
  • --device /dev/dri:/dev/dri Configuring hardware decoding for Emby. If you don't have integrated graphics or don't need it, you can remove this.

Notes
If your server has low configuration and no integrated graphics, it is recommended to disable transcoding.
Go to Settings -> Users -> Configuration and disable the following three options:

image

Other Notes#

cloudDrive2#

Initially, I used cloudDrive2 to mount Aliyun Drive because it was simple.
In the end, I gave up and reinstalled it for various reasons:

  1. Closed Source This thing is completely closed source.
  2. Security Installed it twice, and each time I was flagged by Google for fraud as soon as I entered the website.
  3. Performance It also does not support direct links, and uses the method of downloading locally and then streaming.
  4. Stability There are cases where the mount is dropped.

image
I don't know if it's a false positive or something else, but be cautious with closed source software.
Also, I don't understand why an locally deployed program requires cloud synchronization for account registration...😅

Currently, the Local WebDAV policy is the most compatible way. When watching videos in Emby, it first downloads from webdav to the local machine and then streams it to Emby for playback, so it uses server traffic.
302 redirection can obtain direct links from Aliyun Drive, but cannot be used for scraping with Emby.

If you just want to watch conveniently, you can use the 302 redirection mode and mount webdav with nplayer, so it uses Aliyun's official traffic, and 4K videos won't lag.

If you insist on using Emby with direct links, it is possible, but you need to modify the nginx configuration.
You can refer to the following two articles:

Because I use the nginx of Baota, which does not have the dependencies of nginx, even though I have recompiled the PCRE UTF module and specified that nginx should use this version of PCRE during compilation 🙃, it still reports an error of no UTF Support.

Page Beautification#

image
I think this style is much better than the default Emby display. It is based on Emby Crx.
It provides two methods, one is a Chrome extension for local beautification, suitable for using other people's Emby servers. The other is server-side beautification for your own Emby.

# EmbyServer is the container name. If your container name is different, please change it accordingly!
docker exec EmbyServer /bin/sh -c 'cd /system/dashboard-ui && wget -O - https://tinyurl.com/2p97xcpd | sh'

Miss Sister 😍#

If you want to scrape movies produced by certain studios, you can use MetaTube, a plugin that is compatible with both Jellyfin and Emby.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.