更新文件: README.txt, runwebdavsim.sh, rclonemount.sh, webdav_simulator.amd64, alistservers.template.txt 等8个文件

This commit is contained in:
ZJP Monitor
2025-07-02 10:40:08 +08:00
parent 1d0d035237
commit a45a368413
8 changed files with 106 additions and 11 deletions

View File

@ -19,11 +19,11 @@ cd embysim
4.按照emby.external目录中的alistservers.template.txt的样子自己生成alistservers.txt
cp emby.external/alistservers.template.txt emby.external/alistservers.txt
cp alistservers.template.txt alistservers.txt
5.执行runembysim.sh
./runembysim.sh
sh runembysim.sh
程序会自动探测本机IP如果探测失败需要到runembysim.sh和rclonemount.sh中修改SELFIP成为真实的ip

View File

@ -0,0 +1,3 @@
http://192.168.1.1:5678/,,
http://192.168.1.2:5678/,USER:PASS,
http://192.168.1.3:5678/,ALIST-TOKEN,

Binary file not shown.

View File

@ -14,6 +14,7 @@ while [ -h "${prog}" ]; do
done
progdir=`dirname "${prog}"`
cd "${progdir}"
progdir=$(pwd)
mkdir embysim
cd embysim
@ -28,9 +29,12 @@ echo "load embysim docker to system finish"
echo "extract embysim data and prog..."
tar xf ../embysim.tar.xz
echo "extract embysim data and prog finish"
if [ ! -e alistservers.txt ]; then
cp ../alistservers.template.txt alistservers.txt
fi
echo "copy scripts..."
mv ../rclonemount.sh ../runembysim.sh ../rclone.conf .
mv ../webdav_simulator.amd64 ../htdocs ../runwebdavsim.sh ../rclonemount.sh ../runembysim.sh ../rclone.conf ../xy*.txt.xz .
echo "copy scripts finish"
echo "all assets installed"

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
prog="$0"
while [ -h "${prog}" ]; do
@ -14,6 +14,7 @@ while [ -h "${prog}" ]; do
done
progdir=`dirname "${prog}"`
cd "${progdir}"
progdir=$(pwd)
num=$(mount |grep "/external"|wc -l)
if [ $num -lt 1 ]; then
@ -27,11 +28,33 @@ chmod 777 external/rclone.media rclone.cache
url=$(cat rclone.conf |grep -E "^url"|sed -e 's/.*\(http.*\)/\1/'|head -1)
echo "webdav url:$url"
mkdir -p ${progdir}/emby.tmp
chmod 777 ${progdir}/emby.tmp
export TMPDIR=${progdir}/emby.tmp
if [ "$SELFIP" == "" ]; then
interface=$(ip route show | grep default | awk '{print $5}')
export SELFIP=$(ip addr show $interface | grep -w inet | awk '{print $2}' | cut -d/ -f1|head -1)
echo "DETECT SELF IP:${SELFIP}, if this is not correct, change SELFIP to your real ip"
fi
curl -v -L $url
if [ $? -eq 0 ]; then
echo "WARN:webdavsim is running, data may be outdate."
else
echo "run webdavsim..."
nohup ./runwebdavsim.sh >/dev/null 2>&1 &
fi
echo "TRY CONNECT webdavsim, please wait... abount(30s)"
webdavsimok="0"
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
do
echo "loop: $i"
curl -v -L $url
if [ $? -eq 0 ]; then
webdavsimok="1"
break
fi
echo "found error, sleep 3s, and retry..."
@ -44,7 +67,12 @@ if [ $num -gt 1 ]; then
exit
fi
echo "ready to rclone mount, please wait...(abount 30s)"
if [ "$webdavsimok" != "1" ]; then
echo "webdavsim not run, exit"
exit
fi
echo "ready to rclone mount, please wait...(abount 60s)"
rclone --config rclone.conf mount webdavsim-nas:/dav external/rclone.media --daemon --daemon-wait 60s --no-check-certificate --allow-other --umask 000 --default-permissions --dir-cache-time 1h --webdav-vendor rclone --vfs-cache-mode writes --vfs-read-chunk-size 32M --vfs-read-chunk-size-limit 1G --buffer-size 64M --vfs-cache-max-age 1h --vfs-cache-max-size 10G --timeout 1800s --contimeout 10s --daemon-timeout 300s --poll-interval 1s --low-level-retries 2 --cache-dir rclone.cache --log-file rclone.log
echo "mount ok"
@ -57,7 +85,8 @@ if [ "$SELFIP" != "" ]; then
if [ -e emby.config/config/system.xml ]; then
touch config.selfip.modified.dat
echo "auto change embysim's selfip to $SELFIP, please restart embysim"
sed -i -e "/<LocalNetworkAddresses>/{:a;N;/<\/LocalNetworkAddresses>/!ba;s/.*<\/LocalNetworkAddresses>/<LocalNetworkAddresses><string>$SELFIP<\/<string><\/LocalNetworkAddresses>/}" emby.config/config/system.xml
sed -i -e "/<LocalNetworkAddresses>/{:a;N;/<\/LocalNetworkAddresses>/!ba;s/.*<\/LocalNetworkAddresses>/<LocalNetworkAddresses><string>$SELFIP<\/string><\/LocalNetworkAddresses>/}" emby.config/config/system.xml
sed -i -e "s/<LocalNetworkAddresses \/>/<LocalNetworkAddresses><string>$SELFIP<\/string><\/LocalNetworkAddresses>/" emby.config/config/system.xml
fi
fi
fi

View File

@ -14,6 +14,7 @@ while [ -h "${prog}" ]; do
done
progdir=`dirname "${prog}"`
cd "${progdir}"
progdir=$(pwd)
mkdir -p emby.tmp emby.cache >/dev/null 2>&1
chmod 777 emby.tmp emby.cache
@ -27,16 +28,26 @@ if [ $num -lt 1 ]; then
echo "mount emby.external to external to mark shared"
fi
if [ ! -e alistservers.txt ]; then
cp alistservers.template.txt alistservers.txt
fi
interface=$(ip route show | grep default | awk '{print $5}')
export SELFIP=$(ip addr show $interface | grep -w inet | awk '{print $2}' | cut -d/ -f1|head -1)
echo "DETECT SELF IP:${SELFIP}, if this is not correct, change SELFIP to your real ip"
num=$(mount |grep "/rclone.media"|wc -l)
if [ $num -gt 0 ]; then
echo "WARN: rclone.media already mounted, the webdav content may be outdate"
else
./rclonemount.sh &
./rclonemount.sh
fi
interface=$(ip route show | grep default | awk '{print $5}')
SELFIP=$(ip addr show $interface | grep -w inet | awk '{print $2}' | cut -d/ -f1|head -1)
echo "DETECT SELF IP:${SELFIP}, if this is not correct, change SELFIP to your real ip"
num=$(mount |grep "/rclone.media"|wc -l)
if [ $num -lt 1 ]; then
echo "ERROR: rclone not running, exit"
exit
fi
# --gpus all \
# -e HTTP_PROXY=http://192.168.101.1:8118 \
@ -53,7 +64,6 @@ docker run -d \
--device /dev/dri:/dev/dri \
-p 8096:8096 \
-p 8920:8920 \
-p 5678:5678 \
--env UID=1000 \
--env GID=100 \
--env GIDLIST=100 \

49
runwebdavsim.sh Normal file
View File

@ -0,0 +1,49 @@
#!/bin/bash
prog="$0"
while [ -h "${prog}" ]; do
newProg=`/bin/ls -ld "${prog}"`
newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
if expr "x${newProg}" : 'x/' >/dev/null; then
prog="${newProg}"
else
progdir=`dirname "${prog}"`
prog="${progdir}/${newProg}"
fi
done
progdir=`dirname "${prog}"`
cd "${progdir}"
progdir=$(pwd)
if [ "$SELFIP" == "" ]; then
interface=$(ip route show | grep default | awk '{print $5}')
export SELFIP=$(ip addr show $interface | grep -w inet | awk '{print $2}' | cut -d/ -f1|head -1)
echo "DETECT SELF IP:${SELFIP}, if this is not correct, change SELFIP to your real ip"
fi
#rm -rf tmp
#mkdir tmp
#chmod 777 tmp
#export TMPDIR=tmp
unset LD_PRELOAD
machine=$(uname -m)
if [[ "$machine" == *"arm"* || "$machine" == *"aarch"* ]]; then
arch="arm64"
else
arch="amd64"
fi
echo "arch:$arch"
chmod 755 webdav_simulator.$arch
WEBDAV_PORT=5678
while true
do
curl -v -L "http://127.0.0.1:${WEBDAV_PORT}/dav"
if [ $? -ne 0 ]; then
./webdav_simulator.$arch --selfip $SELFIP --port ${WEBDAV_PORT} --noindex --alist_config alistservers.txt --username guest --password guest_Api789 --proxymode 1 --blackwords '抖音,短剧,音乐22,mp3,wav' --fake_media_file fake.mkv --strmmode 'xy115-all.txt.xz#xy-dy.txt.xz#xy-dsj.txt.xz#xy115-music.txt.xz'
echo "webdavsim exit, sleep 5s and restart"
else
break
fi
sleep 5
done

Binary file not shown.