Skip to content

Commit

Permalink
Fix #15 due to tidal state schema change
Browse files Browse the repository at this point in the history
  • Loading branch information
Inrixia committed Jan 3, 2024
1 parent 80e3143 commit 7096c83
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugins/TidalTags/src/updateTrackElements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { store } from "@neptune";
// @ts-expect-error Remove this when types are available
import { storage } from "@plugin";
import { QualityMeta, MediaMetadataQuality } from "../../../lib/AudioQuality";
import type { MediaItem } from "neptune-types/tidal";

const queryAllAndAttribute = (selector: string) => {
const results = [];
Expand All @@ -15,12 +16,12 @@ const queryAllAndAttribute = (selector: string) => {
export const updateTrackLists = () => {
const trackElements = [...queryAllAndAttribute("data-track-id"), ...queryAllAndAttribute("data-track--content-id")];
if (trackElements.length === 0) return;
const mediaItems = store.getState().content.mediaItems;
const mediaItems: Record<number, MediaItem> = store.getState().content.mediaItems;

for (const { elem: trackElem, attr: trackId } of trackElements) {
if (trackId == null) continue;

const mediaItem = mediaItems.get(trackId)?.item;
const mediaItem = mediaItems[+trackId]?.item;
if (mediaItem?.contentType !== "track") continue;

let trackTags = mediaItem.mediaMetadata?.tags;
Expand Down

0 comments on commit 7096c83

Please sign in to comment.