(2022.09.18 更新)黑群暉 DS918+ 2-10 讓群暉自動更換Microsoft Bing桌布

開啟控制台>點擊任務排程表

點擊新增>排程任務>使用者定義指令碼

任務名稱:DSM_Login_BingWallpaper
使用者帳號:root

點擊任務設定>把指令碼貼上(2022.09.18 更新指令碼)

圖片[1]-(2022.09.18 更新)黑群暉 DS918+ 2-10 讓群暉自動更換Microsoft Bing桌布-☆Dream-NAS☆ 個人網站
# 如需收集儲存壁紙,請去掉下面註釋,設定儲存資料夾位置
# 在FileStation裡面右鍵資料夾屬性可以看到位置
# If you want to collect and save Wallpapers,
# please remove the comment below and set the savepath.
# Right click the folder property in FileStation to see the path.

savepath="/volume1/Dream-1/BingWallpaper"

# 如需下載4k分辨率,請設定res=4k
# 如需下載體積更大的4k以上分辨率的原始圖片,請設定res=raw
# To download 4K resolution, set res=4K
# To download a larger original picture, set res=raw

res=4k

# 變更使用者桌面壁紙,註釋後會替換系統的wallpaper1
# 你需要清空瀏覽器暫存查看效果,僅在DSM7.x上測試.
# Modify user desktop wallpaper.Only test for DMS7.x.
# System "Wallpaper1" will replaced by remove the comment.
# You need to clear the browser cache to see the effect.

desktop=yes

echo "[x]Collecting information..."
pic="https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=zh-CN"
if [ "$res" != "" ]
then pic="https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=zh-CN&uhd=1&uhdwidth=3840&uhdheight=2160"
fi
pic=$(wget -t 5 --no-check-certificate -qO- $pic)
echo $pic|grep -q startdate||exit
link=$(echo https://www.bing.com$(echo $pic|sed 's/.\+"url"[:" ]\+//g'|sed 's/".\+//g'))
if [ "$res" == "raw" ]
then link=$(echo $link|grep -Eo "https://[-=?/._a-zA-Z0-9]+")
fi
date=$(echo $pic|grep -Eo '"startdate":"[0-9]+'|grep -Eo '[0-9]+'|head -1)
if [ "$date" == "" ]
then date=$(date +%Y%m%d)
fi
title=$(echo $pic|sed 's/.\+"title":"//g'|sed 's/".\+//g')
copyright=$(echo $pic|sed 's/.\+"copyright[:" ]\+//g'|sed 's/".\+//g')
keyword=$(echo $copyright|sed 's/, /-/g'|cut -d" " -f1|grep -Eo '[^()\\/:*?"<>]+'|head -1)
filename="bing_"$date"_"$keyword".jpg"
echo "Link:"$link
echo "Date:"$date
echo "Title:"$title
echo "Copyright:"$copyright
echo "Keyword:"$keyword
echo "Filename:"$filename

echo "[x]Downloading wallpaper..."
tmpfile=/tmp/$filename
wget -t 5 --no-check-certificate  $link -qO $tmpfile
ls -lah $tmpfile||exit

echo "[x]Copying wallpaper..."
if [ "$savepath" != "" ]
then cp $tmpfile "$savepath"
echo "Save:"$savepath
ls -lah "$savepath"|grep $date
cd "$savepath"
chmod 777 $filename
else echo "savepath is not set, skip copy."
fi

echo "[x]Setting welcome msg..."
sed -i s/login_welcome_title=.*//g /etc/synoinfo.conf
echo "login_welcome_title=\"$title\"">>/etc/synoinfo.conf
sed -i s/login_welcome_msg=.*//g /etc/synoinfo.conf
echo "login_welcome_msg=\"$copyright\"">>/etc/synoinfo.conf

echo "[x]Applying login wallpaper..."
sed -i s/login_background_customize=.*//g /etc/synoinfo.conf
echo "login_background_customize=\"yes\"">>/etc/synoinfo.conf
sed -i s/login_background_type=.*//g /etc/synoinfo.conf
echo "login_background_type=\"fromDS\"">>/etc/synoinfo.conf
rm -rf /usr/syno/etc/login_background*.jpg
cp -f $tmpfile /usr/syno/etc/login_background.jpg
ln -sf /usr/syno/etc/login_background.jpg /usr/syno/etc/login_background_hd.jpg

echo "[x]Clean..."
rm -f /tmp/bing_*.jpg

if [ "$desktop" == "yes" ]
then echo "[x]Applying user desktop wallpaper..."
mkdir -p /usr/syno/synoman/webman/resources/images/2x/default_wallpaper/
mkdir -p /usr/syno/synoman/webman/resources/images/1x/default_wallpaper/
mkdir -p /usr/syno/synoman/webman/resources/images/default/1x/default_wallpaper/
mkdir -p /usr/syno/synoman/webman/resources/images/default_wallpaper/
#7.0
cp -f /usr/syno/etc/login_background.jpg /usr/syno/synoman/webman/resources/images/2x/default_wallpaper/dsm7_01.jpg
ln -sf /usr/syno/synoman/webman/resources/images/2x/default_wallpaper/dsm7_01.jpg /usr/syno/synoman/webman/resources/images/1x/default_wallpaper/dsm7_01.jpg
#6.0
ln -sf /usr/syno/synoman/webman/resources/images/2x/default_wallpaper/dsm7_01.jpg /usr/syno/synoman/webman/resources/images/default/1x/default_wallpaper/default_wallpaper.jpg
ln -sf /usr/syno/synoman/webman/resources/images/2x/default_wallpaper/dsm7_01.jpg /usr/syno/synoman/webman/resources/images/default/1x/default_wallpaper/dsm6_01.jpg
ln -sf /usr/syno/synoman/webman/resources/images/2x/default_wallpaper/dsm7_01.jpg /usr/syno/synoman/webman/resources/images/default/1x/default_wallpaper/dsm6_02.jpg
#5.2
ln -sf /usr/syno/synoman/webman/resources/images/2x/default_wallpaper/dsm7_01.jpg /usr/syno/synoman/webman/resources/images/default_wallpaper/default_wallpaper.jpg
#5.1
ln -sf /usr/syno/synoman/webman/resources/images/2x/default_wallpaper/dsm7_01.jpg /usr/syno/synoman/webman/resources/images/default_wallpaper/01.jpg
ln -sf /usr/syno/synoman/webman/resources/images/2x/default_wallpaper/dsm7_01.jpg /usr/syno/synoman/webman/resources/images/default_wallpaper/02.jpg
fi

 

開啟File Station>點擊你的共用資料夾>新增BingWallpaper

回到任務排程表執行DSM_Login_BingWallpaper

登出後看一下登入入口以及群暉桌布有沒有更換

圖片[2]-(2022.09.18 更新)黑群暉 DS918+ 2-10 讓群暉自動更換Microsoft Bing桌布-☆Dream-NAS☆ 個人網站
圖片[3]-(2022.09.18 更新)黑群暉 DS918+ 2-10 讓群暉自動更換Microsoft Bing桌布-☆Dream-NAS☆ 個人網站


BingWallpaper的資料夾中會有圖片

溫馨提示:本文最後更新於2022-11-03 16:57:27,某些文章具有時效性,若有錯誤或已失效,請在下方留言或聯絡Email
------本頁内容已結束------

感謝您的來訪,獲得更多精彩文章請收藏本網站。

© 版權聲明
THE END
喜歡就支持一下吧
點讚0點我一下嘛>_< 分享
留言 搶沙發
大頭照
歡迎您留下寶貴的意見!
送出
大頭照

暱稱

取消
暱稱常用語表情代碼圖片

    請登入後查看留言內容