()
| 287 | } |
| 288 | |
| 289 | function getTrackMeta() { |
| 290 | const meta = { |
| 291 | title: Player.data.item.metadata.title, |
| 292 | imageUrl: Player.data.item.metadata.image_url, |
| 293 | }; |
| 294 | meta.uri = Player.data.item.uri; |
| 295 | if (URI.isEpisode(meta.uri)) { |
| 296 | meta.description = Player.data.item.metadata.album_title; |
| 297 | } else { |
| 298 | meta.description = Player.data.item.metadata.artist_name; |
| 299 | } |
| 300 | const playerState = Spicetify.Player.data; |
| 301 | const contextUri = URI.fromString(playerState.context_uri ?? playerState.context.uri); |
| 302 | if (contextUri && (contextUri.type === URI.Type.PLAYLIST || contextUri.type === URI.Type.PLAYLIST_V2 || contextUri.type === URI.Type.ALBUM)) { |
| 303 | meta.context = `/${contextUri.toURLPath()}?uid=${Player.data.item.uid}`; |
| 304 | } |
| 305 | |
| 306 | return meta; |
| 307 | } |
| 308 | |
| 309 | function storeTrack() { |
| 310 | LIST.addToStorage(getTrackMeta()); |
no outgoing calls
no test coverage detected