MCPcopy
hub / github.com/Musish/Musish / createMediaItem

Function createMediaItem

src/app/utils/Utils.ts:3–24  ·  view source on GitHub ↗
(song: MusicKit.MediaItem, container: any = null)

Source from the content-addressed store, hash-verified

1import translate from './translations/Translations';
2
3export function createMediaItem(song: MusicKit.MediaItem, container: any = null) {
4 if (container) {
5 const containerName =
6 container.type === 'albums' || container.type === 'library-albums' ? 'albums' : 'playlists';
7
8 return {
9 ...song,
10 container: {
11 id: container.id,
12 type: container.type,
13 name: containerName,
14 },
15 };
16 }
17
18 return {
19 ...song,
20 container: {
21 id: song.id,
22 },
23 };
24}
25
26export function artworkForMediaItem(item: MusicKit.MediaItem, size: number) {
27 if (!item.attributes || !item.attributes.artwork) {

Callers 4

playFunction · 0.90
setQueueItemsFunction · 0.90
prependQueueItemsFunction · 0.90
appendQueueItemsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected