From 0ffd48db48f640a0591b005973d0f24b65762a9b Mon Sep 17 00:00:00 2001 From: Sattva <74269253+Sattva-108@users.noreply.github.com> Date: Tue, 20 May 2025 10:14:21 +0300 Subject: [PATCH] media: remove extra 1s play-time it was made by original author, idk why. in result we were getting tracks to be starting all over again for 1-2 seconds, sometimes. now is all good --- Leatrix_Plus.lua | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/Leatrix_Plus.lua b/Leatrix_Plus.lua index 7a6f7e2..2889fee 100644 --- a/Leatrix_Plus.lua +++ b/Leatrix_Plus.lua @@ -15699,15 +15699,22 @@ function LeaPlusLC:RunOnce() LeaPlusLC.TrackTimer:Cancel() end if trackTime then - LeaPlusLC.TrackTimer = LibCompat.NewTimer(trackTime + 1, function() - -- Automatic mark track after listened fully - MarkCurrentTrackListened() - StopMusic() - if tracknumber > #playlist then - tracknumber = 1 - end - PlayTrack() - end) + -- Convert trackTime (which is a string) to a number before using it + local numericTrackTime = tonumber(trackTime) + if numericTrackTime then -- Ensure conversion was successful + LeaPlusLC.TrackTimer = LibCompat.NewTimer(numericTrackTime, function() + -- Automatic mark track after listened fully + MarkCurrentTrackListened() + StopMusic() + if tracknumber > #playlist then + tracknumber = 1 + end + PlayTrack() + end) + else + -- Handle case where trackTime couldn't be converted (optional, for robustness) + -- LeaPlusLC:Print("Error: Invalid trackTime format for " .. LastPlayed) + end end -- Обновить статус