1
0
mirror of https://github.com/hanxi/xiaomusic.git synced 2025-12-15 16:18:14 +08:00

feat: 外网访问端口可独立配置

This commit is contained in:
涵曦
2024-07-04 10:15:48 +00:00
parent 485a42a9a0
commit ce9adcee7f
3 changed files with 10 additions and 2 deletions

View File

@@ -105,6 +105,10 @@ class XiaoMusic:
self.hostname = self.config.hostname
self.port = self.config.port
self.public_port = self.config.public_port
if self.public_port == 0:
self.public_port = self.port
self.proxy = self.config.proxy
self.search_prefix = self.config.search_prefix
self.ffmpeg_location = self.config.ffmpeg_location
@@ -456,7 +460,7 @@ class XiaoMusic:
"get_music_url local music. name:%s, filename:%s", name, filename
)
encoded_name = urllib.parse.quote(filename)
return f"http://{self.hostname}:{self.port}/{encoded_name}"
return f"http://{self.hostname}:{self.public_port}/{encoded_name}"
# 递归获取目录下所有歌曲,生成随机播放列表
def _gen_all_music_list(self):