-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from zeroday0619/dev
Add show URLs support
- Loading branch information
Showing
5 changed files
with
56 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from typing import Any | ||
from spotify_uri.spotify import SpotifyUri | ||
from spotify_uri.util import encode | ||
|
||
|
||
class Show(SpotifyUri): | ||
def __init__(self, uri: str, _id: str) -> None: | ||
self.type = "show" | ||
self.id = _id | ||
super(Show, self).__init__(uri) | ||
|
||
@staticmethod | ||
def is_(v: Any) -> bool: | ||
x = v is Show | ||
if x: | ||
return v.type == "show" | ||
else: | ||
return False | ||
|
||
def toURI(self) -> str: | ||
return f"spotify:{self.type}:{encode(self.id)}" | ||
|
||
def toURL(self) -> str: | ||
return f"/{self.type}/{encode(self.id)}" |