Skip to content

Commit

Permalink
new media player interface
Browse files Browse the repository at this point in the history
  • Loading branch information
BruceZhang1993 committed Feb 8, 2024
1 parent 150ca66 commit 5820f19
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
39 changes: 39 additions & 0 deletions aionowplaying/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import List, Optional

from aionowplaying.enum import PlaybackStatus, LoopStatus
from aionowplaying.model import Metadata


# noinspection PyPep8Naming
Expand Down Expand Up @@ -173,6 +174,22 @@ def loopStatus(self) -> Optional[LoopStatus]:
def loopStatus(self, status: LoopStatus):
pass

@property
def shuffle(self) -> Optional[bool]:
return None

@shuffle.setter
def shuffle(self, value: bool):
pass

@property
def volume(self) -> Optional[float]:
return None

@volume.setter
def volume(self, value: float):
pass

@property
@abstractmethod
def canPlay(self) -> bool:
Expand All @@ -199,3 +216,25 @@ def openUri(self, uri: str):
@abstractmethod
def playbackStatus(self) -> PlaybackStatus:
pass

@property
def rate(self) -> float:
return 1.0

@property
def minimumRate(self) -> float:
return 1.0

@property
def maximumRate(self) -> float:
return 1.0

@property
@abstractmethod
def metadata(self) -> Metadata:
pass

@property
@abstractmethod
def position(self) -> int:
pass
29 changes: 29 additions & 0 deletions aionowplaying/model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from dataclasses import dataclass
from datetime import datetime
from typing import List


@dataclass
class Metadata:
trackId: str
length: int # Duration in microseconds
artUrl: str
album: str
albumArtist: List[str]
artist: List[str]
asText: str # Track lyrics (should not include timeline)
audioBPM: int # The speed of the music, in beats per minute
autoRating: float # An automatically-generated rating (0.0-1.0)
comment: List[str]
composer: List[str]
contentCreated: datetime
discNumber: int # The disc number on the album that this track is from
firstUsed: datetime # When the track was first played.
lastUsed: datetime # When the track was last played.
genre: List[str]
lyricist: List[str]
title: str
trackNumber: int
url: str
useCount: int
userRating: float

0 comments on commit 5820f19

Please sign in to comment.