mirror of
https://github.com/hanxi/xiaomusic.git
synced 2025-12-06 14:52:50 +08:00
Compare commits
6 Commits
alert-auto
...
v0.3.83
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a316053d01 | ||
|
|
0bfa4e6251 | ||
|
|
6ef7d4c6c2 | ||
|
|
fff35783c2 | ||
|
|
c8fad5ba1d | ||
|
|
956a4af3c9 |
12
CHANGELOG.md
12
CHANGELOG.md
@@ -1,3 +1,15 @@
|
||||
## v0.3.83 (2025-06-12)
|
||||
|
||||
### Feat
|
||||
|
||||
- 新增开关控制是否开始谷歌统计 see #473
|
||||
- 支持b站合集和收藏下载 (#487)
|
||||
|
||||
### Fix
|
||||
|
||||
- 修复安全问题
|
||||
- 修复安全问题
|
||||
|
||||
## v0.3.82 (2025-05-30)
|
||||
|
||||
### Fix
|
||||
|
||||
@@ -9,8 +9,10 @@ RUN apk add --no-cache bash\
|
||||
supervisor \
|
||||
vim \
|
||||
libc6-compat \
|
||||
ffmpeg \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
COPY install_dependencies.sh .
|
||||
RUN bash install_dependencies.sh
|
||||
RUN mkdir -p /app/ffmpeg/bin \
|
||||
&& ln -s /usr/bin/ffmpeg /app/ffmpeg/bin/ffmpeg \
|
||||
&& ln -s /usr/bin/ffprobe /app/ffmpeg/bin/ffprobe
|
||||
|
||||
@@ -120,5 +120,22 @@ EOF
|
||||
正常现象。可以把延迟设置为0试试。
|
||||
|
||||
|
||||
---
|
||||
|
||||
### 评论 5 - worrywast
|
||||
|
||||
> > 为啥我的播放完一首音乐之后,还会播放该歌曲开头一点点才会放下一首呢?
|
||||
>
|
||||
> 正常现象。可以把延迟设置为0试试。
|
||||
|
||||
是这个选项吗:“下一首歌延迟播放秒数:”
|
||||
我设置为0,也会有这个现象,只是没有之前播放开头那么多
|
||||
|
||||
---
|
||||
|
||||
### 评论 6 - hanxi
|
||||
|
||||
@worrywast 等下个版本我优化一下,允许设置成负数吧。
|
||||
|
||||
---
|
||||
[链接到 GitHub Issue](https://github.com/hanxi/xiaomusic/issues/360)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "xiaomusic"
|
||||
version = "0.3.82"
|
||||
version = "0.3.83"
|
||||
description = "Play Music with xiaomi AI speaker"
|
||||
authors = [
|
||||
{name = "涵曦", email = "im.hanxi@gmail.com"},
|
||||
|
||||
@@ -1 +1 @@
|
||||
__version__ = "0.3.82"
|
||||
__version__ = "0.3.83"
|
||||
|
||||
@@ -57,8 +57,11 @@ class Analytics:
|
||||
await self._send(event)
|
||||
|
||||
async def _send(self, event):
|
||||
asyncio.create_task(self.post_to_umami(event))
|
||||
await self.run_with_cancel(self._google_send, [event])
|
||||
if self.config.enable_analytics:
|
||||
asyncio.create_task(self.post_to_umami(event))
|
||||
await self.run_with_cancel(self._google_send, [event])
|
||||
else:
|
||||
self.log.info("analytics is disabled, skip sending event")
|
||||
|
||||
def _google_send(self, events):
|
||||
try:
|
||||
|
||||
@@ -191,6 +191,9 @@ class Config:
|
||||
enable_save_tag: bool = (
|
||||
os.getenv("XIAOMUSIC_ENABLE_SAVE_TAG", "false").lower() == "true"
|
||||
)
|
||||
enable_analytics: bool = (
|
||||
os.getenv("XIAOMUSIC_ENABLE_ANALYTICS", "true").lower() == "true"
|
||||
)
|
||||
get_ask_by_mina: bool = (
|
||||
os.getenv("XIAOMUSIC_GET_ASK_BY_MINA", "false").lower() == "true"
|
||||
)
|
||||
|
||||
@@ -54,6 +54,7 @@ from xiaomusic.utils import (
|
||||
remove_common_prefix,
|
||||
remove_id3_tags,
|
||||
restart_xiaomusic,
|
||||
safe_join_path,
|
||||
try_add_access_control_param,
|
||||
update_version,
|
||||
)
|
||||
@@ -560,10 +561,10 @@ async def downloadplaylist(data: DownloadPlayList, Verifcation=Depends(verificat
|
||||
for title, download_proc_sigle in download_proc_list.items():
|
||||
exit_code = await download_proc_sigle.wait()
|
||||
log.info(f"Download completed {title} with exit code {exit_code}")
|
||||
dir_path = os.path.join(config.download_path, data.dirname)
|
||||
dir_path = safe_join_path(config.download_path, data.dirname)
|
||||
log.debug(f"Download dir_path: {dir_path}")
|
||||
# 可能只是部分失败,都需要整理下载目录
|
||||
remove_common_prefix(config.download_path, dir_path)
|
||||
remove_common_prefix(dir_path)
|
||||
chmoddir(dir_path)
|
||||
return {"ret": "OK"}
|
||||
else:
|
||||
@@ -574,10 +575,10 @@ async def downloadplaylist(data: DownloadPlayList, Verifcation=Depends(verificat
|
||||
exit_code = await download_proc.wait()
|
||||
log.info(f"Download completed with exit code {exit_code}")
|
||||
|
||||
dir_path = os.path.join(config.download_path, data.dirname)
|
||||
dir_path = safe_join_path(config.download_path, data.dirname)
|
||||
log.debug(f"Download dir_path: {dir_path}")
|
||||
# 可能只是部分失败,都需要整理下载目录
|
||||
remove_common_prefix(config.download_path, dir_path)
|
||||
remove_common_prefix(dir_path)
|
||||
chmoddir(dir_path)
|
||||
|
||||
asyncio.create_task(check_download_proc())
|
||||
|
||||
4
xiaomusic/static/default/debug.html
vendored
4
xiaomusic/static/default/debug.html
vendored
@@ -6,9 +6,9 @@
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<title>Debug For XiaoMusic</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="./main.css?version=1748562548">
|
||||
<link rel="stylesheet" type="text/css" href="./main.css?version=1749666240">
|
||||
<script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
|
||||
<script src="./jquery-3.7.1.min.js?version=1748562548"></script>
|
||||
<script src="./jquery-3.7.1.min.js?version=1749666240"></script>
|
||||
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-Z09NC1K7ZW"></script>
|
||||
|
||||
4
xiaomusic/static/default/downloadtool.html
vendored
4
xiaomusic/static/default/downloadtool.html
vendored
@@ -4,8 +4,8 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<title>歌曲下载工具</title>
|
||||
<link rel="stylesheet" type="text/css" href="./main.css?version=1748562548">
|
||||
<script src="./jquery-3.7.1.min.js?version=1748562548"></script>
|
||||
<link rel="stylesheet" type="text/css" href="./main.css?version=1749666240">
|
||||
<script src="./jquery-3.7.1.min.js?version=1749666240"></script>
|
||||
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-Z09NC1K7ZW"></script>
|
||||
|
||||
6
xiaomusic/static/default/index.html
vendored
6
xiaomusic/static/default/index.html
vendored
@@ -6,8 +6,8 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>小爱音箱操控面板</title>
|
||||
<link href="https://fonts.googleapis.com/css?family=Material+Icons|Material+Icons+Outlined" rel="stylesheet">
|
||||
<script src="./jquery-3.7.1.min.js?version=1748562548"></script>
|
||||
<link rel="stylesheet" href="./main.css?version=1748562548">
|
||||
<script src="./jquery-3.7.1.min.js?version=1749666240"></script>
|
||||
<link rel="stylesheet" href="./main.css?version=1749666240">
|
||||
<link rel="icon" href="./favicon.ico">
|
||||
|
||||
<!-- Google tag (gtag.js) -->
|
||||
@@ -219,7 +219,7 @@
|
||||
Powered by XiaoMusic
|
||||
</div>
|
||||
|
||||
<script src="./md.js?version=1748562548">
|
||||
<script src="./md.js?version=1749666240">
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
||||
2
xiaomusic/static/default/m3u.html
vendored
2
xiaomusic/static/default/m3u.html
vendored
@@ -5,7 +5,7 @@
|
||||
<link rel="icon" href="/favicon.ico">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<title>M3U to JSON Converter</title>
|
||||
<link rel="stylesheet" type="text/css" href="./main.css?version=1748562548">
|
||||
<link rel="stylesheet" type="text/css" href="./main.css?version=1749666240">
|
||||
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-Z09NC1K7ZW"></script>
|
||||
|
||||
13
xiaomusic/static/default/setting.html
vendored
13
xiaomusic/static/default/setting.html
vendored
@@ -5,9 +5,9 @@
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<title>小爱音箱操控面板</title>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||
<script src="./jquery-3.7.1.min.js?version=1748562548"></script>
|
||||
<script src="./setting.js?version=1748562548"></script>
|
||||
<link rel="stylesheet" type="text/css" href="./main.css?version=1748562548">
|
||||
<script src="./jquery-3.7.1.min.js?version=1749666240"></script>
|
||||
<script src="./setting.js?version=1749666240"></script>
|
||||
<link rel="stylesheet" type="text/css" href="./main.css?version=1749666240">
|
||||
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-Z09NC1K7ZW"></script>
|
||||
@@ -260,6 +260,13 @@ var vConsole = new window.VConsole();
|
||||
<option value="false" selected>false</option>
|
||||
</select>
|
||||
|
||||
<label for="enable_analytics">开启谷歌数据统计(无敏感数据):</label>
|
||||
<select id="enable_analytics">
|
||||
<option value="true" selected>true</option>
|
||||
<option value="false">false</option>
|
||||
</select>
|
||||
|
||||
|
||||
<label for="music_list_url" class="setting-label">歌单地址:
|
||||
<button class="option-inline mini-button" id="get_music_list">
|
||||
<span class="material-icons">sync_alt</span>
|
||||
|
||||
@@ -1107,14 +1107,19 @@ def _longest_common_prefix(file_names):
|
||||
return prefix
|
||||
|
||||
|
||||
# 移除目录下文件名前缀相同的
|
||||
def remove_common_prefix(safe_root, directory):
|
||||
def safe_join_path(safe_root, directory):
|
||||
directory = os.path.join(safe_root, directory)
|
||||
# Normalize the directory path
|
||||
normalized_directory = os.path.normpath(directory)
|
||||
# Ensure the directory is within the safe root
|
||||
if not normalized_directory.startswith(os.path.normpath(safe_root)):
|
||||
raise ValueError(f"Access to directory '{directory}' is not allowed.")
|
||||
files = os.listdir(normalized_directory)
|
||||
return normalized_directory
|
||||
|
||||
|
||||
# 移除目录下文件名前缀相同的
|
||||
def remove_common_prefix(directory):
|
||||
files = os.listdir(directory)
|
||||
|
||||
# 获取所有文件的前缀
|
||||
common_prefix = _longest_common_prefix(files)
|
||||
|
||||
Reference in New Issue
Block a user