luci-app-unblockmusic: add force replace lower than 320kbps option

This commit is contained in:
coolsnowwolf 2020-05-26 18:33:09 +08:00
parent 052720804c
commit f3339baf3c
3 changed files with 13 additions and 3 deletions

View File

@ -7,8 +7,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-unblockmusic
PKG_VERSION:=2.3.1
PKG_RELEASE:=43
PKG_VERSION:=2.3.5
PKG_RELEASE:=1
PKG_CONFIG_DEPENDS := \
CONFIG_UnblockNeteaseMusic_Go \

View File

@ -52,6 +52,12 @@ flac.rmempty = false
flac.description = translate("目前仅支持酷我、QQ、咪咕")
flac:depends("apptype", "nodejs")
force = s:option(Flag, "force_enabled", translate("强制替换为高音质歌曲"))
force.default = 1
force.rmempty = false
force.description = translate("如果歌曲音质在 320Kbps 以内,则尝试强制替换为高音质版本")
force:depends("apptype", "nodejs")
o = s:option(Flag, "autoupdate")
o.title = translate("自动检查更新主程序")
o.default = 0

View File

@ -66,6 +66,7 @@ TYPE=$(uci_get_by_type unblockmusic musicapptype default)
AUTOUPDATE=$(uci_get_by_type unblockmusic autoupdate 0)
APPTYPE=$(uci_get_by_type unblockmusic apptype go)
FLAC=$(uci_get_by_type unblockmusic flac_enabled 0)
FORCE=$(uci_get_by_type unblockmusic force_enabled 0)
CLOUD=$(uci_get_by_type unblockmusic cloudserver "127.0.0.1:5200:5201")
cloudadd=$(echo "$CLOUD" | awk -F ':' '{print $1}')
@ -171,7 +172,10 @@ start()
if [ "$APPTYPE" == "nodejs" ]; then
if [ $FLAC -eq 1 ]; then
export ENABLE_FLAC=true
export ENABLE_FLAC=true
fi
if [ $FORCE -eq 1 ]; then
sed -i '/item.code != 200/ { s/item.code != 200 || item.freeTrialInfo/item.br < 320000/g; }' /usr/share/UnblockNeteaseMusic/src/hook.js
fi
node /usr/share/UnblockNeteaseMusic/app.js -e http://music.163.com -p 5200 $musictype >>/tmp/unblockmusic.log 2>&1 &
node /usr/share/UnblockNeteaseMusic/app.js -e https://music.163.com -p 5203:5201 $musictype >>/tmp/unblockmusic.log 2>&1 &