qinfengge

qinfengge

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

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

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

Until Alibaba Cloud Drive emerged, with its optimization in China, active community (referring to many Telegram sharing channels), and the opening of the API, it became almost perfect.

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

Installing Alist and Configuring Alibaba Cloud Drive#

The official documentation is already very detailed.
It is recommended to use Docker for installation.

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 administrator account password.

docker exec -it alist ./alist admin

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

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

Note
Please select Local for the WebDAV Strategy, as webdav does not support redirection.
If not set or set incorrectly, Emby can scrape, but entering the resource library will keep spinning.
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:
Mounting Alibaba Cloud Drive on Synology/Linux to Achieve Emby Playback and Create Your Own Home Theater!

image

After configuring, 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, indicating that the cache is refreshed every 4 hours. If the cloud drive files are not modified frequently, this value can be set to 24h.
  • --cache-dir=/home/cache Cache path.
  • --header "Referer:" This is a required parameter for mounting Alibaba Cloud Drive 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, where LocalFolder represents the local mount path:

fusermount -qzu LocalFolder

To mount on startup, modify the following command to match the parameters you used in the previous manual command, except for 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

Enable auto-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 version Docker image, for demonstration purposes only. Please support the official version if you have the ability.

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 in 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, which 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.

Note
If your server has lower specifications 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 Alibaba Cloud 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 as fraudulent by Google as soon as I entered the website.
  3. Performance It also does not support direct links and uses local downloads and streaming.
  4. Stability There are cases where the mount is dropped.

image
I don't know if it's a false positive or what, but be cautious with closed source software.
Also, I don't understand why an application built locally requires a cloud-synced account 😅, and you have to register...

Currently, the Local webdav strategy is the best compatibility option. 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 Alibaba Cloud Drive, but cannot be used for scraping with Emby.

If you just want the convenience of watching, you can use the 302 redirection mode and mount webdav with nplayer, so it will use Alibaba Cloud's official traffic, and 4K won't be laggy.

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 nginx from Baota, it doesn't have the dependencies for nginx, even though I have recompiled the PCRE UTF module and specified it during nginx compilation 🙃, but it still reports an error of no UTF Support.

Page Beautification#

image
I think this style is much better than Emby's default 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 works with both Jellyfin and Emby.

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