From fe7bc924da6e6ac98539179b2b0b0f35b25e95f2 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Wed, 22 Feb 2023 15:43:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AE=B0=E4=BD=8F=E6=92=AD?= =?UTF-8?q?=E6=94=BE=E8=BF=9B=E5=BA=A6=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B?= =?UTF-8?q?=EF=BC=8C=E4=BD=BF=E7=94=A8Scheme=20URL=E6=89=93=E5=BC=80?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E6=92=AD=E6=94=BE=E7=9A=84=E6=AD=8C=E6=9B=B2?= =?UTF-8?q?=E8=BF=9B=E5=BA=A6=E6=B2=A1=E6=9C=89=E8=A2=AB=E9=87=8D=E7=BD=AE?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- publish/changeLog.md | 1 + src/renderer/core/player/action.ts | 1 + src/renderer/core/useApp/useDataInit.ts | 9 ++++++++- src/renderer/store/list/listManage/action.ts | 5 ++--- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/publish/changeLog.md b/publish/changeLog.md index 48cc592a..a07ffb08 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -2,3 +2,4 @@ ### 修复 - 修复同步连接的处理问题 +- 修复记住播放进度的情况下,使用Scheme URL打开应用播放的歌曲进度没有被重置的问题 diff --git a/src/renderer/core/player/action.ts b/src/renderer/core/player/action.ts index e72130b3..77bb42e2 100644 --- a/src/renderer/core/player/action.ts +++ b/src/renderer/core/player/action.ts @@ -109,6 +109,7 @@ const handleRestorePlay = async(restorePlayInfo: LX.Player.SavedPlayInfo) => { if (!musicInfo) return setImmediate(() => { + if (musicInfo.id != playMusicInfo.musicInfo?.id) return window.app_event.setProgress(appSetting['player.isSavePlayTime'] ? restorePlayInfo.time : 0, restorePlayInfo.maxTime) }) diff --git a/src/renderer/core/useApp/useDataInit.ts b/src/renderer/core/useApp/useDataInit.ts index ad5818e4..aca1cdc1 100644 --- a/src/renderer/core/useApp/useDataInit.ts +++ b/src/renderer/core/useApp/useDataInit.ts @@ -8,6 +8,7 @@ import useInitUserApi from './useInitUserApi' import { play, playList } from '@renderer/core/player' import { onBeforeUnmount } from '@common/utils/vueTools' import { appSetting } from '@renderer/store/setting' +import { playMusicInfo } from '@renderer/store/player/state' const initPrevPlayInfo = async() => { const info = await getPlayInfo() @@ -18,7 +19,13 @@ const initPrevPlayInfo = async() => { window.lx.restorePlayInfo = info playList(info.listId, info.index) - if (appSetting['player.startupAutoPlay']) setTimeout(play) + if (appSetting['player.startupAutoPlay']) { + const musicInfo = playMusicInfo.musicInfo + if (!musicInfo) return + setTimeout(() => { + if (musicInfo.id == playMusicInfo.musicInfo?.id) play() + }) + } } export default () => { diff --git a/src/renderer/store/list/listManage/action.ts b/src/renderer/store/list/listManage/action.ts index e8afa1c7..4645a677 100644 --- a/src/renderer/store/list/listManage/action.ts +++ b/src/renderer/store/list/listManage/action.ts @@ -128,9 +128,8 @@ export const listDataOverwrite = ({ defaultList, loveList, userList, tempList }: overwriteMusicList(LIST_IDS.DEFAULT, defaultList) updatedListIds.push(LIST_IDS.DEFAULT) } - if (allMusicList.has(LIST_IDS.LOVE)) { - overwriteMusicList(LIST_IDS.LOVE, loveList) - } + + overwriteMusicList(LIST_IDS.LOVE, loveList) updatedListIds.push(LIST_IDS.LOVE) if (tempList && allMusicList.has(LIST_IDS.TEMP)) {