Merge pull request #69 from ZandercraftGames/fix/other-sources

Fix Support for Other Source and Playlist Types
This commit is contained in:
clxud 2024-08-23 21:04:04 -04:00 committed by GitHub
commit 5227962228
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View File

@ -6,6 +6,7 @@ name = "pypi"
[packages] [packages]
orjson = "*" orjson = "*"
"discord.py" = {extras = ["voice"], version = "*"} "discord.py" = {extras = ["voice"], version = "*"}
websockets = "*"
[dev-packages] [dev-packages]
mypy = "*" mypy = "*"

View File

@ -54,6 +54,8 @@ class TrackType(Enum):
TrackType.HTTP defines that the track is from an HTTP source. TrackType.HTTP defines that the track is from an HTTP source.
TrackType.LOCAL defines that the track is from a local source. TrackType.LOCAL defines that the track is from a local source.
TrackType.OTHER defines that the track is from an unknown source (possible from 3rd-party plugins).
""" """
# We don't have to define anything special for these, since these just serve as flags # We don't have to define anything special for these, since these just serve as flags
@ -63,6 +65,11 @@ class TrackType(Enum):
APPLE_MUSIC = "apple_music" APPLE_MUSIC = "apple_music"
HTTP = "http" HTTP = "http"
LOCAL = "local" LOCAL = "local"
OTHER = "other"
@classmethod
def _missing_(cls, _: object) -> "TrackType":
return cls.OTHER
def __str__(self) -> str: def __str__(self) -> str:
return self.value return self.value
@ -79,6 +86,8 @@ class PlaylistType(Enum):
PlaylistType.SPOTIFY defines that the playlist is from Spotify PlaylistType.SPOTIFY defines that the playlist is from Spotify
PlaylistType.APPLE_MUSIC defines that the playlist is from Apple Music. PlaylistType.APPLE_MUSIC defines that the playlist is from Apple Music.
PlaylistType.OTHER defines that the playlist is from an unknown source (possible from 3rd-party plugins).
""" """
# We don't have to define anything special for these, since these just serve as flags # We don't have to define anything special for these, since these just serve as flags
@ -86,6 +95,11 @@ class PlaylistType(Enum):
SOUNDCLOUD = "soundcloud" SOUNDCLOUD = "soundcloud"
SPOTIFY = "spotify" SPOTIFY = "spotify"
APPLE_MUSIC = "apple_music" APPLE_MUSIC = "apple_music"
OTHER = "other"
@classmethod
def _missing_(cls, _: object) -> "PlaylistType":
return cls.OTHER
def __str__(self) -> str: def __str__(self) -> str:
return self.value return self.value