Skip to content

Commit

Permalink
Merge pull request #191 from monlor/test
Browse files Browse the repository at this point in the history
fix: 🐛 修复媒体地址解析缺失
  • Loading branch information
monlor authored Jul 10, 2024
2 parents 8156df9 + 946a11e commit 4ee9a1f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions alist/update_media_addr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ get_addr() {
fi
}

echo "等待emby.js创建完成..."
while ! test -f /etc/nginx/http.d/emby.js; do
sleep 2
done

echo "开始更新媒体服务地址..."
# 设置一个循环每1分钟检查一次emby的地址是否变化,如果变化就更新/data/emby_server.txt
while true; do
nginx_reload=0
Expand All @@ -65,7 +71,8 @@ while true; do
if [ "$NEW_EMBY_ADDR" != "$OLD_EMBY_ADDR" ]; then
echo "$NEW_EMBY_ADDR" > /data/emby_server.txt
# 更新nginx配置
sed -i "s#set \$emby .*#set \$emby $NEW_EMBY_ADDR;#" /etc/nginx/http.d/emby.conf
sed -i "s#set \$emby .*#set \$emby ${NEW_EMBY_ADDR};#" /etc/nginx/http.d/emby.conf
sed -i "s#const embyHost .*#const embyHost = '${NEW_EMBY_ADDR}';#" /etc/nginx/http.d/emby.js
nginx_reload=1
OLD_EMBY_ADDR=$NEW_EMBY_ADDR
echo "Updated emby address to $NEW_EMBY_ADDR"
Expand All @@ -81,7 +88,8 @@ while true; do
if [ "$NEW_JELLYFIN_ADDR" != "$OLD_JELLYFIN_ADDR" ]; then
echo "$NEW_JELLYFIN_ADDR" > /data/jellyfin_server.txt
# 更新nginx配置
sed -i "s#set \$emby .*#set \$emby $NEW_JELLYFIN_ADDR;#" /etc/nginx/http.d/jellyfin.conf
sed -i "s#set \$emby .*#set \$emby ${NEW_JELLYFIN_ADDR};#" /etc/nginx/http.d/jellyfin.conf
sed -i "s#const embyHost .*#const embyHost = '${NEW_JELLYFIN_ADDR}';#" /etc/nginx/http.d/jellyfin.js
nginx_reload=1
OLD_JELLYFIN_ADDR=$NEW_JELLYFIN_ADDR
echo "Updated jellyfin address to $NEW_JELLYFIN_ADDR"
Expand Down

0 comments on commit 4ee9a1f

Please sign in to comment.