feat: add adjusted_length

This commit is contained in:
NiceAesth 2023-03-12 02:39:26 +02:00
parent 6c7f06ec25
commit cc571f17f2
1 changed files with 8 additions and 0 deletions

View File

@ -196,6 +196,14 @@ class Player(VoiceProtocol):
"""Property which returns the player's position in a track in milliseconds adjusted for rate"""
return self.position / self.rate
@property
def adjusted_length(self) -> float:
"""Property which returns the player's track length in milliseconds adjusted for rate"""
if not self.is_playing:
return 0
return self.current.length / self.rate
@property
def is_playing(self) -> bool:
"""Property which returns whether or not the player is actively playing a track."""