mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-24 18:47:44 +00:00
parent
8d7ad0acc1
commit
b86413cda3
2 changed files with 10 additions and 3 deletions
|
|
@ -360,10 +360,16 @@ export function fetchMediaTags(file, id) {
|
|||
dispatch({ type: MEDIA_TAG_REQUEST_INITIALIZED, id });
|
||||
return genMediaTags(file)
|
||||
.then(data => {
|
||||
const { artist, title } = data.tags;
|
||||
// There's more data here, but we don't have a use for it yet:
|
||||
// https://github.com/aadsm/jsmediatags#shortcuts
|
||||
dispatch({ type: SET_MEDIA_TAGS, artist, title, id });
|
||||
const { artist, title, picture } = data.tags;
|
||||
let albumArtUrl = null;
|
||||
if (picture) {
|
||||
const byteArray = new Uint8Array(picture.data);
|
||||
const blob = new Blob([byteArray], { type: picture.type });
|
||||
albumArtUrl = URL.createObjectURL(blob);
|
||||
}
|
||||
dispatch({ type: SET_MEDIA_TAGS, artist, title, albumArtUrl, id });
|
||||
})
|
||||
.catch(() => {
|
||||
dispatch({ type: MEDIA_TAG_REQUEST_FAILED, id });
|
||||
|
|
|
|||
|
|
@ -179,7 +179,8 @@ const playlist = (state = defaultPlaylistState, action) => {
|
|||
...state.tracks[action.id],
|
||||
mediaTagsRequestStatus: MEDIA_TAG_REQUEST_STATUS.COMPLETE,
|
||||
title: action.title,
|
||||
artist: action.artist
|
||||
artist: action.artist,
|
||||
albumArtUrl: action.albumArtUrl
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue