Skip to content

Commit

Permalink
修复本地flac音乐播放后去下载错误音乐的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
hanxi committed Jan 27, 2024
1 parent 8e8a605 commit 8f2d26a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions xiaomusic/xiaomusic.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,16 @@ async def poll_latest_ask(self):
async with ClientSession() as session:
session._cookie_jar = self.cookie_jar
while True:
self.log.debug(
"Listening new message, timestamp: %s", self.last_timestamp
)
# self.log.debug(
# "Listening new message, timestamp: %s", self.last_timestamp
# )
await self.get_latest_ask_from_xiaoai(session)
start = time.perf_counter()
self.log.debug("Polling_event, timestamp: %s", self.last_timestamp)
# self.log.debug("Polling_event, timestamp: %s", self.last_timestamp)
await self.polling_event.wait()
if (d := time.perf_counter() - start) < 1:
# sleep to avoid too many request
self.log.debug("Sleep %f, timestamp: %s", d, self.last_timestamp)
# self.log.debug("Sleep %f, timestamp: %s", d, self.last_timestamp)
await asyncio.sleep(1 - d)

async def init_all_data(self, session):
Expand Down Expand Up @@ -453,7 +453,7 @@ async def play(self, **kwargs):
# 下一首
async def play_next(self, **kwargs):
self.log.info("下一首")
name = self.cur_music
(name, _) = os.path.splitext(os.path.basename(self.cur_music))
if self.play_type == PLAY_TYPE_ALL or name == "":
name = self.random_music()
if name == "":
Expand Down

0 comments on commit 8f2d26a

Please sign in to comment.