1
0
mirror of https://github.com/hanxi/xiaomusic.git synced 2025-12-06 14:52:50 +08:00

Compare commits

...

3 Commits

Author SHA1 Message Date
涵曦
0736cb0fb7 new version v0.1.12 2024-01-30 08:21:48 +08:00
涵曦
2acb668101 fix: set volume failed 2024-01-30 08:21:31 +08:00
涵曦
32fb0e9548 add script to update version 2024-01-29 23:28:31 +08:00
4 changed files with 8 additions and 5 deletions

View File

@@ -4,4 +4,4 @@ git diff
git add ./pyproject.toml
git commit -m "new version v$version"
git tag v$version
#git push --tags
git push -u origin main --tags

View File

@@ -1,6 +1,6 @@
[project]
name = "xiaomusic"
version = "0.1.11"
version = "0.1.12"
description = "Play Music with xiaomi AI speaker"
authors = [
{name = "涵曦", email = "im.hanxi@gmail.com"},

View File

@@ -31,7 +31,7 @@ HARDWARE_COMMAND_DICT = {
# add more here
}
DEFAULT_COMMAND = ("5-1", "5-5")
DEFAULT_COMMAND = ("5-1", "5-5", "2-1")
KEY_WORD_DICT = {
"播放歌曲": "play",
@@ -79,7 +79,7 @@ class Config:
mi_did: str = os.getenv("MI_DID", "")
mute_xiaoai: bool = True
cookie: str = ""
use_command: bool = True
use_command: bool = False
verbose: bool = False
music_path: str = os.getenv("XIAOMUSIC_MUSIC_PATH", "music")
hostname: str = os.getenv("XIAOMUSIC_HOSTNAME", "192.168.2.5")

View File

@@ -237,16 +237,19 @@ class XiaoMusic:
await self.wait_for_tts_finish()
async def do_set_volume(self, value):
value = int(value)
if not self.config.use_command:
try:
self.log.debug("do_set_volume not use_command value:%d", value)
await self.mina_service.player_set_volume(self.device_id, value)
except Exception:
pass
else:
self.log.debug("do_set_volume use_command value:%d", value)
await miio_command(
self.miio_service,
self.config.mi_did,
f"{self.config.volume_command} {value}",
f"{self.config.volume_command}=#{value}",
)
async def wait_for_tts_finish(self):