Skip to content

Commit

Permalink
Merge pull request #2448 from KasukabeDefenceForce/CorrectingCoverArt
Browse files Browse the repository at this point in the history
LB-1258: Listening now not showing cover art even if correct release is found.
  • Loading branch information
MonkeyDo authored Jun 27, 2023
2 parents 1626548 + 259c42a commit 35c212a
Showing 1 changed file with 43 additions and 22 deletions.
65 changes: 43 additions & 22 deletions frontend/js/src/user/Listens.tsx
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
/* eslint-disable jsx-a11y/anchor-is-valid,camelcase */

import * as React from "react";
import { createRoot } from "react-dom/client";
import * as Sentry from "@sentry/react";
import * as _ from "lodash";
import * as React from "react";
import { createRoot } from "react-dom/client";

import DateTimePicker from "react-datetime-picker/dist/entry.nostyle";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import NiceModal from "@ebay/nice-modal-react";
import { IconProp } from "@fortawesome/fontawesome-svg-core";
import { faCalendar } from "@fortawesome/free-regular-svg-icons";
import { io, Socket } from "socket.io-client";
import { get, isEqual } from "lodash";
import { Integrations } from "@sentry/tracing";
import {
faCompactDisc,
faPlusCircle,
faTrashAlt,
} from "@fortawesome/free-solid-svg-icons";
import NiceModal from "@ebay/nice-modal-react";
import GlobalAppContext from "../utils/GlobalAppContext";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { Integrations } from "@sentry/tracing";
import { get, isEqual } from "lodash";
import DateTimePicker from "react-datetime-picker/dist/entry.nostyle";
import { Socket, io } from "socket.io-client";
import {
WithAlertNotificationsInjectedProps,
withAlertNotifications,
} from "../notifications/AlertNotificationsHOC";
import GlobalAppContext from "../utils/GlobalAppContext";

import APIServiceClass from "../utils/APIService";
import AddListenModal from "../add-listen/AddListenModal";
import BrainzPlayer from "../brainzplayer/BrainzPlayer";
import ErrorBoundary from "../utils/ErrorBoundary";
import ListenCard from "../listens/ListenCard";
import Loader from "../components/Loader";
import AddListenModal from "../add-listen/AddListenModal";
import FollowButton from "../follow/FollowButton";
import UserSocialNetwork from "../follow/UserSocialNetwork";
import ListenCard from "../listens/ListenCard";
import ListenControl from "../listens/ListenControl";
import ListenCountCard from "../listens/ListenCountCard";
import PinnedRecordingCard from "../pins/PinnedRecordingCard";
import APIServiceClass from "../utils/APIService";
import ErrorBoundary from "../utils/ErrorBoundary";
import {
formatWSMessageToListen,
getPageProps,
getListenablePin,
getPageProps,
getRecordingMBID,
getTrackName,
getRecordingMSID,
getTrackName,
} from "../utils/utils";
import ListenControl from "../listens/ListenControl";
import UserSocialNetwork from "../follow/UserSocialNetwork";
import ListenCountCard from "../listens/ListenCountCard";
import FollowButton from "../follow/FollowButton";

export type ListensProps = {
latestListenTs: number;
Expand Down Expand Up @@ -248,12 +248,33 @@ export default class Listens extends React.Component<
const playingNow = newPlayingNow;
const { APIService } = this.context;
try {
const metadata = await APIService.lookupRecordingMetadata(
const response = await APIService.lookupRecordingMetadata(
playingNow.track_metadata.track_name,
playingNow.track_metadata.artist_name,
false
true
);
playingNow.track_metadata.mbid_mapping = metadata as MBIDMapping;
if (response) {
const {
metadata,
recording_mbid,
release_mbid,
artist_mbids,
} = response;
playingNow.track_metadata.mbid_mapping = {
recording_mbid,
release_mbid,
artist_mbids,
caa_id: metadata?.release?.caa_id,
caa_release_mbid: metadata?.release?.caa_release_mbid,
artists: metadata?.artist?.artists?.map((artist, index)=>{
return {
artist_credit_name: artist.name,
join_phrase: artist.join_phrase,
artist_mbid: artist_mbids[index]
}
})
};
}

await this.loadFeedbackForNowPlaying(playingNow);
} catch (error) {
Expand Down

0 comments on commit 35c212a

Please sign in to comment.