feat: 优化播放延迟问题,并新增配置下一首播放的延迟秒数
This commit is contained in:
parent
6b38676766
commit
eab4f4bd46
@ -136,6 +136,7 @@ class Config:
|
|||||||
remove_id3tag: bool = (
|
remove_id3tag: bool = (
|
||||||
os.getenv("XIAOMUSIC_REMOVE_ID3TAG", "false").lower() == "true"
|
os.getenv("XIAOMUSIC_REMOVE_ID3TAG", "false").lower() == "true"
|
||||||
)
|
)
|
||||||
|
delay_sec: int = int(os.getenv("XIAOMUSIC_DELAY_SEC", 3)) # 下一首歌延迟播放秒数
|
||||||
|
|
||||||
def append_keyword(self, keys, action):
|
def append_keyword(self, keys, action):
|
||||||
for key in keys.split(","):
|
for key in keys.split(","):
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
<meta name="viewport" content="width=device-width">
|
<meta name="viewport" content="width=device-width">
|
||||||
<title>Debug For XiaoMusic</title>
|
<title>Debug For XiaoMusic</title>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/style.css?version=1721862430">
|
<link rel="stylesheet" type="text/css" href="/static/style.css?version=1722127035">
|
||||||
<script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
|
<script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
|
||||||
<script src="/static/jquery-3.7.1.min.js?version=1721862430"></script>
|
<script src="/static/jquery-3.7.1.min.js?version=1722127035"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var vConsole = new window.VConsole();
|
var vConsole = new window.VConsole();
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta name="viewport" content="width=device-width">
|
<meta name="viewport" content="width=device-width">
|
||||||
<title>小爱音箱操控面板</title>
|
<title>小爱音箱操控面板</title>
|
||||||
<script src="/static/jquery-3.7.1.min.js?version=1721862430"></script>
|
<script src="/static/jquery-3.7.1.min.js?version=1722127035"></script>
|
||||||
<script src="/static/app.js?version=1721862430"></script>
|
<script src="/static/app.js?version=1722127035"></script>
|
||||||
<link rel="stylesheet" type="text/css" href="/static/style.css?version=1721862430">
|
<link rel="stylesheet" type="text/css" href="/static/style.css?version=1722127035">
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
|
<script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width">
|
<meta name="viewport" content="width=device-width">
|
||||||
<title>M3U to JSON Converter</title>
|
<title>M3U to JSON Converter</title>
|
||||||
<link rel="stylesheet" type="text/css" href="/static/style.css?version=1721862430">
|
<link rel="stylesheet" type="text/css" href="/static/style.css?version=1722127035">
|
||||||
<!--
|
<!--
|
||||||
<script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
|
<script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta name="viewport" content="width=device-width">
|
<meta name="viewport" content="width=device-width">
|
||||||
<title>小爱音箱操控面板</title>
|
<title>小爱音箱操控面板</title>
|
||||||
<script src="/static/jquery-3.7.1.min.js?version=1721862430"></script>
|
<script src="/static/jquery-3.7.1.min.js?version=1722127035"></script>
|
||||||
<script src="/static/setting.js?version=1721862430"></script>
|
<script src="/static/setting.js?version=1722127035"></script>
|
||||||
<link rel="stylesheet" type="text/css" href="/static/style.css?version=1721862430">
|
<link rel="stylesheet" type="text/css" href="/static/style.css?version=1722127035">
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
|
<script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
|
||||||
@ -130,6 +130,9 @@ var vConsole = new window.VConsole();
|
|||||||
<label for="public_port">外网访问端口(0表示跟监听端口一致):</label>
|
<label for="public_port">外网访问端口(0表示跟监听端口一致):</label>
|
||||||
<input id="public_port" type="number" value="0"></input>
|
<input id="public_port" type="number" value="0"></input>
|
||||||
|
|
||||||
|
<label for="delay_sec">下一首歌延迟播放秒数:</label>
|
||||||
|
<input id="delay_sec" type="number" value="3"></input>
|
||||||
|
|
||||||
<label for="stop_tts_msg">停止提示音:</label>
|
<label for="stop_tts_msg">停止提示音:</label>
|
||||||
<input id="stop_tts_msg" type="text" value="收到,再见"></input>
|
<input id="stop_tts_msg" type="text" value="收到,再见"></input>
|
||||||
<label for="keywords_playlocal">播放本地歌曲口令:</label>
|
<label for="keywords_playlocal">播放本地歌曲口令:</label>
|
||||||
|
@ -68,9 +68,8 @@ $(function(){
|
|||||||
|
|
||||||
// 初始化显示
|
// 初始化显示
|
||||||
for (const key in data) {
|
for (const key in data) {
|
||||||
if (data.hasOwnProperty(key)) {
|
|
||||||
const $element = $("#" + key);
|
const $element = $("#" + key);
|
||||||
if ($element.length && data[key] !== '') {
|
if ($element.length) {
|
||||||
if (data[key] === true) {
|
if (data[key] === true) {
|
||||||
$element.val('true');
|
$element.val('true');
|
||||||
} else if (data[key] === false) {
|
} else if (data[key] === false) {
|
||||||
@ -80,7 +79,6 @@ $(function(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
autoSelectOne();
|
autoSelectOne();
|
||||||
});
|
});
|
||||||
|
@ -918,7 +918,7 @@ class XiaoMusicDevice:
|
|||||||
self.cur_music = name
|
self.cur_music = name
|
||||||
self.log.info(f"cur_music {self.cur_music}")
|
self.log.info(f"cur_music {self.cur_music}")
|
||||||
sec, url = await self.xiaomusic.get_music_sec_url(name)
|
sec, url = await self.xiaomusic.get_music_sec_url(name)
|
||||||
await self.group_force_stop_xiaoai()
|
# await self.group_force_stop_xiaoai()
|
||||||
self.log.info(f"播放 {url}")
|
self.log.info(f"播放 {url}")
|
||||||
results = await self.group_player_play(url)
|
results = await self.group_player_play(url)
|
||||||
if all(ele is None for ele in results):
|
if all(ele is None for ele in results):
|
||||||
@ -933,6 +933,7 @@ class XiaoMusicDevice:
|
|||||||
# 取消组内所有的下一首歌曲的定时器
|
# 取消组内所有的下一首歌曲的定时器
|
||||||
self.cancel_group_next_timer()
|
self.cancel_group_next_timer()
|
||||||
# 设置下一首歌曲的播放定时器
|
# 设置下一首歌曲的播放定时器
|
||||||
|
sec = sec + self.config.delay_sec
|
||||||
await self.set_next_music_timeout(sec)
|
await self.set_next_music_timeout(sec)
|
||||||
|
|
||||||
async def do_tts(self, value):
|
async def do_tts(self, value):
|
||||||
@ -941,7 +942,7 @@ class XiaoMusicDevice:
|
|||||||
self.log.info("do_tts no value")
|
self.log.info("do_tts no value")
|
||||||
return
|
return
|
||||||
|
|
||||||
await self.group_force_stop_xiaoai()
|
# await self.group_force_stop_xiaoai()
|
||||||
await self.text_to_speech(value)
|
await self.text_to_speech(value)
|
||||||
|
|
||||||
# 最大等8秒
|
# 最大等8秒
|
||||||
|
Loading…
Reference in New Issue
Block a user