-
Notifications
You must be signed in to change notification settings - Fork 15
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
5 changed files
with
44 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,40 @@ | ||
import SpotifyUri from "./spotify-uri"; | ||
import { SpotifyTypes } from "./types-enum"; | ||
import { encode } from "./util"; | ||
import SpotifyUri from './spotify-uri' | ||
import { SpotifyTypes } from './types-enum' | ||
import { encode } from './util' | ||
|
||
export default class Local extends SpotifyUri { | ||
public artist: string; | ||
public album: string; | ||
public track: string; | ||
public seconds: number; | ||
public artist: string | ||
public album: string | ||
public track: string | ||
public seconds: number | ||
|
||
constructor( | ||
constructor ( | ||
uri: string, | ||
artist: string, | ||
album: string, | ||
track: string, | ||
seconds: number | ||
) { | ||
super(uri, "", SpotifyTypes.Local); | ||
this.artist = artist; | ||
this.album = album; | ||
this.track = track; | ||
this.seconds = seconds; | ||
super(uri, '', SpotifyTypes.Local) | ||
this.artist = artist | ||
this.album = album | ||
this.track = track | ||
this.seconds = seconds | ||
} | ||
|
||
public static is(v: any): v is Local { | ||
return typeof v === "object" && v.type === "local"; | ||
public static is (v: any): v is Local { | ||
return typeof v === 'object' && v.type === 'local' | ||
} | ||
|
||
public toURI(): string { | ||
public toURI (): string { | ||
return `spotify:${this.type}:${encode(this.artist)}:${encode( | ||
this.album | ||
)}:${encode(this.track)}:${this.seconds}`; | ||
)}:${encode(this.track)}:${this.seconds}` | ||
} | ||
|
||
public toURL(): string { | ||
public toURL (): string { | ||
return `/${this.type}/${encode(this.artist)}/${encode(this.album)}/${encode( | ||
this.track | ||
)}/${this.seconds}`; | ||
)}/${this.seconds}` | ||
} | ||
} |
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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
export enum SpotifyTypes { | ||
Album = 'album', | ||
Artist = 'artist', | ||
Episode = 'episode', | ||
Local = 'local', | ||
Playlist = 'playlist', | ||
Search = 'search', | ||
Show = 'show', | ||
Track = 'track', | ||
User = 'user', | ||
Embed = 'embed' | ||
} | ||
Album = 'album', | ||
Artist = 'artist', | ||
Episode = 'episode', | ||
Local = 'local', | ||
Playlist = 'playlist', | ||
Search = 'search', | ||
Show = 'show', | ||
Track = 'track', | ||
User = 'user', | ||
Embed = 'embed' | ||
} |