-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
249 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# SPDX-License-Identifier: MIT | ||
|
||
from __future__ import annotations | ||
|
||
from enum import Enum | ||
|
||
__all__ = ("SearchType",) | ||
|
||
|
||
class SearchType(Enum): | ||
YOUTUBE = "ytsearch" | ||
YOUTUBE_MUSIC = "ytmsearch" | ||
SOUNDCLOUD = "scsearch" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# SPDX-License-Identifier: MIT | ||
|
||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
if TYPE_CHECKING: | ||
from .typings import TrackInfo | ||
|
||
__all__ = ("Track",) | ||
|
||
|
||
class Track: | ||
def __init__(self, track: str, info: TrackInfo) -> None: | ||
self.id = track | ||
|
||
self.title: str = info["title"] | ||
self.author: str = info["author"] | ||
|
||
self.identifier: str = info["identifier"] | ||
self.uri: str = info["uri"] | ||
self.source: str = info["sourceName"] | ||
|
||
self.stream: bool = info["isStream"] | ||
self.seekable: bool = info["isSeekable"] | ||
|
||
self.position: int = info["position"] | ||
self.length: int = info["length"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# SPDX-License-Identifier: MIT | ||
|
||
from .http import * | ||
from .incoming import * | ||
from .misc import * | ||
from .outgoing import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# SPDX-License-Identifier: MIT | ||
|
||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING, TypedDict, Union | ||
|
||
if TYPE_CHECKING: | ||
from typing import Literal | ||
|
||
from .misc import FriendlyException | ||
|
||
__all__ = ( | ||
"GetTracks", | ||
"PlaylistInfo", | ||
"Tracks", | ||
"TrackInfo", | ||
"TrackWithInfo", | ||
"TracksFailed", | ||
) | ||
|
||
|
||
class PlaylistInfo(TypedDict): | ||
name: str | ||
selectedTrack: int | ||
|
||
|
||
class TrackInfo(TypedDict): | ||
identifier: str | ||
isSeekable: bool | ||
author: str | ||
length: int | ||
isStream: bool | ||
position: int | ||
sourceName: str | ||
title: str | ||
uri: str | ||
|
||
|
||
class TrackWithInfo(TypedDict): | ||
track: str | ||
info: TrackInfo | ||
|
||
|
||
class Tracks(TypedDict): | ||
loadType: Literal["TRACK_LOADED", "PLAYLIST_LOADED", "SEARCH_RESULT", "NO_MATCHES"] | ||
playlistInfo: PlaylistInfo | ||
tracks: list[TrackWithInfo] | ||
|
||
|
||
class TracksFailed(TypedDict): | ||
loadType: Literal["LOAD_FAILED"] | ||
playlistInfo: PlaylistInfo | ||
tracks: list[TrackWithInfo] | ||
exception: FriendlyException | ||
|
||
|
||
GetTracks = Union[Tracks, TracksFailed] |
Oops, something went wrong.