From 461f1180b20ce3186bb517559457f379654f09de Mon Sep 17 00:00:00 2001 From: Choco <94597336+ChocoMeow@users.noreply.github.com> Date: Sat, 22 Mar 2025 19:22:46 +0800 Subject: [PATCH] Fixed some bugs --- update.py | 2 +- voicelink/objects.py | 2 -- voicelink/player.py | 10 ++++------ 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/update.py b/update.py index 5b84a2b..b244bb5 100644 --- a/update.py +++ b/update.py @@ -29,7 +29,7 @@ __version__ = "v2.7.0b4" GITHUB_API_URL = "https://api.github.com/repos/ChocoMeow/Vocard/releases/latest" VOCARD_URL = "https://github.com/ChocoMeow/Vocard/archive/" -IGNORE_FILES = ["settings.json", "logs"] +IGNORE_FILES = ["settings.json", "logs", "last-session.json"] class bcolors: WARNING = '\033[93m' diff --git a/voicelink/objects.py b/voicelink/objects.py index 3f9ad78..56fbd46 100644 --- a/voicelink/objects.py +++ b/voicelink/objects.py @@ -50,8 +50,6 @@ class Track: "author", "uri", "source", - "artist_id", - "original", "_search_type", "thumbnail", "emoji", diff --git a/voicelink/player.py b/voicelink/player.py index a24c07b..e3d0b76 100644 --- a/voicelink/player.py +++ b/voicelink/player.py @@ -151,21 +151,19 @@ class Player(VoiceProtocol): @property def position(self) -> float: """Property which returns the player's position in a track in milliseconds""" - current = self._current.original - if not self.is_playing or not self._current: return 0 if self.is_paused: - return min(self._last_position, current.length) + return min(self._last_position, self._current.length) difference = (time.time() * 1000) - self._last_update position = self._last_position + difference - if position > current.length: + if position > self._current.length: return 0 - return min(position, current.length) + return min(position, self._current.length) @property def is_playing(self) -> bool: @@ -663,7 +661,7 @@ class Player(VoiceProtocol): async def seek(self, position: float, requester: Member = None) -> float: """Seeks to a position in the currently playing track milliseconds""" - if position < 0 or position > self._current.original.length: + if position < 0 or position > self._current.length: raise TrackInvalidPosition("Seek position must be between 0 and the track length") await self.send(method=RequestMethod.PATCH, data={"position": position})