Skip to content

Commit

Permalink
Match from 25s in & reload playlist twice to try refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
Inrixia committed Apr 21, 2024
1 parent 287be3f commit b7fe343
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugins/Shazam/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const getShazamPlaylist = async (): Promise<Playlist> => {
const addToPlaylist = async (playlistUUID: string, mediaItemIdsToAdd: string[]) => {
actions.content.addMediaItemsToPlaylist({ mediaItemIdsToAdd, onDupes: "SKIP", playlistUUID });
await interceptPromise(["etag/SET_PLAYLIST_ETAG", "content/ADD_MEDIA_ITEMS_TO_PLAYLIST_SUCCESS"], ["content/ADD_MEDIA_ITEMS_TO_PLAYLIST_FAIL"]);
actions.content.loadListItemsPage({ listName: `playlists/${playlistUUID}`, listType: "mediaItems", reset: false });
setTimeout(() => actions.content.loadListItemsPage({ listName: `playlists/${playlistUUID}`, listType: "mediaItems", reset: true }), 1000);
};

Expand Down Expand Up @@ -90,7 +91,7 @@ const handleDrop = async (event: DragEvent) => {
for (const file of event.dataTransfer?.files ?? []) {
const bytes = await file.arrayBuffer();
if (bytes === undefined) continue;
await using(recognizeBytes(new Uint8Array(bytes)), async (signatures) => {
await using(recognizeBytes(new Uint8Array(bytes), 25), async (signatures) => {
for (const sig of signatures) {
const shazamData = await fetchShazamData({ samplems: sig.samplems, uri: sig.uri });
if (shazamData.matches.length === 0) return messageWarn(`No matches for ${file.name}`);
Expand Down

0 comments on commit b7fe343

Please sign in to comment.