diff --git a/dzunlock.user.js b/dzunlock.user.js index 0f45cfe..673a0a3 100644 --- a/dzunlock.user.js +++ b/dzunlock.user.js @@ -3,7 +3,7 @@ // @namespace io.github.uhwot.dzunlock // @description enables deezer hifi features lol // @author uh wot -// @version 1.4.3 +// @version 1.4.4 // @license GPL-3.0-only // @homepageURL https://git.uhwot.cf/uhwot/dzunlock // @downloadURL https://uhwotgit.fly.dev/uhwot/dzunlock/raw/branch/master/dzunlock.user.js @@ -137,16 +137,20 @@ unsafeWindow.WebSocket = new Proxy(unsafeWindow.WebSocket, { } }) +let last_track_id = null + unsafeWindow.fetch = (function (fetch) { return async function (url, init) { if (url === 'https://media.deezer.com/v1/get_url') { let track - if (unsafeWindow.dzPlayer.getPosition() === 0) { + if (last_track_id !== unsafeWindow.dzPlayer.getSongId()) { track = unsafeWindow.dzPlayer.getCurrentSong() } else { track = unsafeWindow.dzPlayer.getNextSong() // gapless playback } + last_track_id = track.SNG_ID + const quality = unsafeWindow.dzPlayer.control.getAudioQuality() const id = parseInt(track.SNG_ID)