PVE-based tossing the road (4) audio-visual library cloud disk automation

Original link:https://uefeng.com/the-road-of-tossing-based-on-pve-4.html

foreword

The previous article [ PVE-Based Tossing Road (3) Audio-visual library automation ] has realized local automatic drama tracking. But now the popularity of Alibaba cloud disk and various projects can also realize automatic dumping and chasing dramas, and the emby video playback address is hijacked to the alist direct link through the njs module of nginx.

This article needs to install emby, alist, aliyundrive-subscribe, nginx, rclone in Synology Docker

After the completion, the basic process: TV dramas are updated -> aliyundrive-subscribe automatically dumps to the specified directory -> notify emby that there is a new video -> emby scrapes -> emby directly plays the video on the Alibaba cloud disk through nginx.

Why switch to Emby?

I have always used jellyfin before, because it is open source and free. But for some reason, many of the current 4k videos cannot be played normally, and the server is forced to transcode. At first, I thought it was because the TV model was too old to support decoding, so before downloading videos, I could only find a specific codec.

Occasionally, I switched to emby for testing on a whim. Except that the audio is TrueHD 7.1 or Dolby Atmos 7.1, which will cause the server to transcode, other 4K HEVC HDR10 or 4K HEVC HDR10+ are very smooth, so I switched to emby as the server.

1. Install emby

 docker run -d \ --name emby \ -e PUID=1026 \ -e PGID=100 \ -e TZ=Asia/Shanghai \ -p 8096:8096 \ -v /volume1/docker/emby:/config \ -v /volume1/video:/video \ --restart unless-stopped \ lovechen/embyserver:latest

2. Install alist (see wiki for alist configuration tutorial)

 docker run -d \ --name=alist \ --restart=unless-stopped \ -e PUID=1026 \ -e PGID=100 \ -e UMASK=022 \ -p 5244:5244 \ -v /volume1/video:/video \ -v /volume1/docker/alist:/opt/alist/data \ xhofe/alist:latest

3. Install aliyun drive-subscribe

 docker run -d \ --restart=unless-stopped \ --name=subscribe \ -e PUID=1026 \ -e PGID=100 \ -e TZ=Asia/Shanghai \ -p 19035:19035 \ -v /volume1/docker/subscribe:/app/conf \ looby/aliyundrive-subscribe:latest

4. Install nginx (please download the mapping file in Wiki in advance)

 docker run -d \ --name=nginx \ -e PUID=1026 \ -e PGID=100 \ -e TZ=Asia/Shanghai \ -p 8095:80 \ -v /volume1/docker/nginx/nginx.conf:/etc/nginx/nginx.conf \ -v /volume1/docker/nginx/conf.d:/etc/nginx/conf.d \ -v /volume1/docker/nginx/cache:/var/cache/nginx/emby \ nginx:alpine

configure alist

The default username is admin, and the password needs to be viewed in the console log. Log in to the background through the Synology IP: 5244 port, find the storage here, and click Add

image.png

Select Alibaba Cloud Disk Open

image.png

Mainly configure the mount path, that is, the local path on the NAS; there is also a refresh token.

Specific configuration tutorial can see Wiki

Configure aliyun drive-subscribe

Log in to subscribe through Synology IP: 8002 port, and set the account password and Alibaba cloud disk token in /volume1/docker/subscribe/config/app.ini.

aliyundrive-subscribe 配置

Specific configuration tutorial can see Wiki

aliyundrive-subscribe 配置

roclone mount alist to local

Log in to Synology via ssh and get root

 # 安装rclone curl https://rclone.org/install.sh | sudo bash
 # 创建rclone 配置文件文件夹mkdir /volume1/docker/rclone # 创建rclone 配置文件,注意用户名和密码,建议alist 创建一个只读的用户用于挂载用途cat <<EOF >> /volume1/docker/rclone/rclone.conf [aliyunpan] type = webdav url = http://10.0.0.5:5244/dav vendor = other user = admin pass = Hg8GURjFFspmY0UJKImq5NnzhpW5 EOF
 # 创建rclone 挂载文件,注意修改下面挂载参数cat <<EOF >> /volume1/docker/rclone/rcloned #!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH NAME_BIN="rclone" NAME="aliyunpan" #和上面的rclone 文件一致REMOTE='' #远程文件夹,网盘里的挂载的一个文件夹,留空为整个网盘LOCAL='/volume1/video/aliyunpan' #挂载地址,VPS本地挂载目录LOG="/volume1/docker/rclone/log.txt" Green_font_prefix="\033[32m" && Red_font_prefix="\033[31m" && Green_background_prefix="\033[42;37m" && Red_background_prefix="\033[41;37m" && Font_color_suffix="\033[0m" Info="${Green_font_prefix}[信息]${Font_color_suffix}" Error="${Red_font_prefix}[错误]${Font_color_suffix}" RETVAL=0 check_running(){ PID="$(ps -C $NAME_BIN -o pid= |head -n1 |grep -o '[0-9]\{1,\}')" if [[ ! -z ${PID} ]]; then return 0 else return 1 fi } do_start(){ check_running if [[ $? -eq 0 ]]; then echo -e "${Info} $NAME_BIN (PID ${PID}) 正在运行..." && exit 0 else fusermount -zuq $LOCAL >/dev/null 2>&1 mkdir -p $LOCAL mkdir -p ${LOG%/*} sudo /usr/bin/rclone mount --config /volume1/docker/rclone/rclone.conf $NAME:$REMOTE $LOCAL --umask 000 --default-permissions --allow-non-empty --allow-other --buffer-size 32M --vfs-read-chunk-size 64M --vfs-read-chunk-size-limit 1G > "${LOG}" 2>&1 & sleep 2s check_running if [[ $? -eq 0 ]]; then echo -e "${Info} $NAME_BIN 启动成功!" else echo -e "${Error} $NAME_BIN 启动失败!" fi fi } do_stop(){ check_running if [[ $? -eq 0 ]]; then kill -9 ${PID} RETVAL=$? if [[ $RETVAL -eq 0 ]]; then echo -e "${Info} $NAME_BIN 停止成功!" else echo -e "${Error} $NAME_BIN 停止失败!" fi else echo -e "${Info} $NAME_BIN 未运行" RETVAL=1 fi fusermount -zuq $LOCAL >/dev/null 2>&1 } do_status(){ check_running if [[ $? -eq 0 ]]; then echo -e "${Info} $NAME_BIN (PID $(echo ${PID})) 正在运行..." else echo -e "${Info} $NAME_BIN 未运行!" RETVAL=1 fi } do_restart(){ do_stop sleep 2s do_start } case "$1" in start|stop|restart|status) do_$1 ;; *) echo "使用方法: $0 { start | stop | restart | status }" RETVAL=1 ;; esac exit $RETVAL EOF

Finally run rclone to mount locally

 # 使用方法: { start | stop | restart | status } bash /volume1/docker/rclone/rcloned strat

configure nginx

The main thing is to configure emby.js

 const embyHost = 'http://172.17.0.1:8096'; //默认emby的地址是宿主机ip const embyMountPath = '/video'; // rclone 的挂载目录, 例如将阿里云盘挂载到/volume1目录下: /volume1/video/aliyun,就填写/video const alistToken = 'alist-1c14e05d-b222-4307-9db7····'; //alist token, 在alist后台查看const alistAddr= 'http://172.17.0.1:5244'; //访问宿主机上5244端口的alist地址const embyApiKey = 'ab5bbc1f4233saedg2252e95fb53cbc4'; //emb api key, 在后台设置const alistPublicAddr = 'http://10.0.0.5:5244'; // alist公网地址

Specific configuration tutorial can see Wiki

Summarize

At this point, you can access the emby service via Synology IP: 8095 port. The emby media library is also the same as adding ordinary local files. It is recommended to store the scraped files and pictures locally instead of the folder where the media is located, so as not to access the api too frequently. The playback speed is no longer limited by the upload speed of the home broadband, and the video on the Alibaba Cloud disk is played directly on the client.

Combining the local automation in the previous article and the cloud disk automation in this article, the total storage space has reached about 42 T. However, it is recommended to store the favorites locally, and the cloud disk is only used for watching dramas, so as not to go bankrupt one day.

image.png

This article is transferred from:https://uefeng.com/the-road-of-tossing-based-on-pve-4.html
This site is only for collection, and the copyright belongs to the original author.