MCPcopy
hub / github.com/Musish/Musish / addToLibrary

Function addToLibrary

src/app/services/MusicApi.ts:65–76  ·  view source on GitHub ↗
(mediaType: string, mediaIds: string[])

Source from the content-addressed store, hash-verified

63}
64
65export async function addToLibrary(mediaType: string, mediaIds: string[]) {
66 try {
67 await axios({
68 method: 'post',
69 url: `${API_URL}/v1/me/library?ids[${mediaType}]=${mediaIds.map(m => m).join(',')}`,
70 headers: getHeaders(),
71 });
72 Alert.success("Added tracks to your library, they'll show up in a few seconds. Hold tight!");
73 } catch (error) {
74 Alert.error("We're unable to add these tracks to your library.");
75 }
76}
77
78export function getHeaders() {
79 const music = MusicKit.getInstance();

Callers 4

dropFunction · 0.90
TrackContextMenuFunction · 0.90
AlbumContextMenuFunction · 0.90
PlaylistContextMenuFunction · 0.90

Calls 1

getHeadersFunction · 0.85

Tested by

no test coverage detected