Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: maintain metadata through upload' #932

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions client/src/components/ManageArtist/BulkTrackUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { BulkTrackUploadRow } from "./BulkTrackUploadRow";

import { Buffer } from "buffer";
import process from "process";
import { pickBy } from "lodash";
import { pick, pickBy } from "lodash";
import {
TrackData,
UploadField,
Expand Down Expand Up @@ -65,11 +65,7 @@ export const BulkTrackUpload: React.FC<{
if (firstTrack) {
const packet = {
title: firstTrack.t.title,
metadata: pickBy(firstTrack.t.metadata, [
"format",
"common",
"native",
]),
metadata: pick(firstTrack.t.metadata, ["format", "common", "native"]),
artistId: trackgroup.artistId,
isPreview: firstTrack.t.status === "preview",
order: firstTrack.order,
Expand Down
2 changes: 0 additions & 2 deletions client/src/components/Signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ const ArtistToggle = styled(FormComponent)`
function Signup() {
const { t } = useTranslation("translation", { keyPrefix: "signUp" });
const [search] = useSearchParams();
console.log(search);
const snackbar = useSnackbar();
const [hasRegistered, setHasRegistered] = React.useState(false);
const [accountIncomplete, setAccountIncomplete] = React.useState(false);
Expand All @@ -74,7 +73,6 @@ function Signup() {

const onSubmit = React.useCallback(
async (data: SignupInputs) => {
console.log("data", data);
try {
await api.post(
"signup",
Expand Down
1 change: 0 additions & 1 deletion client/src/components/TrackGroup/DownloadAlbum.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import api from "services/api";
import { getArtistUrl, getReleaseUrl } from "utils/artist";

function DownloadAlbum() {
console.log("download album");
const [trackGroup, setTrackGroup] = React.useState<TrackGroup>();
const [isOwned, setIsOwned] = React.useState(false);
const [isLoadingTrackGroup, setIsLoadingTrackGroup] = React.useState(true);
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/TrackGroup/TrackView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ function TrackView() {
return (
<WidthContainer variant="big" justify="center">
<MetaCard
title={trackGroup.title}
description={`An album by ${trackGroup.artist?.name ?? "an artist"} on Mirlo`}
title={filteredTrack.title}
description={`A track by ${trackGroup.artist?.name ?? "an artist"} on Mirlo`}
image={trackGroup.cover?.sizes?.[600]}
/>
<Container user={user}>
Expand Down
10 changes: 0 additions & 10 deletions src/queues/processTrackAudio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,6 @@ audioQueueEvents.on(
},
});

if (audio && audio.trackId) {
await prisma.track.update({
where: {
id: audio.trackId,
},
data: {
metadata: result.returnvalue,
},
});
}
logger.info(`audioId: ${audio.id} updated trackAudio`);

await verifyAudioQueue.add("verify-audio", {
Expand Down
1 change: 0 additions & 1 deletion src/queues/verify-audio-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const verifyAudioQueueEvents = new QueueEvents("verify-audio", queueOptions);
verifyAudioQueueEvents.on(
"completed",
async (result: { jobId: string; returnvalue?: any }) => {
console.log("done verifying track");
logger.info(
`Job with id ${JSON.stringify(
result.jobId
Expand Down
2 changes: 1 addition & 1 deletion src/routers/v1/manage/tracks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default function () {
title,
order,
isPreview,
metadata: metadata,
metadata,
trackGroup: {
connect: {
id: Number(trackGroupId),
Expand Down
3 changes: 2 additions & 1 deletion src/routers/v1/manage/tracks/{trackId}/audio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
import { doesTrackBelongToUser } from "../../../../../utils/ownership";
import { processTrackAudio } from "../../../../../queues/processTrackAudio";
import busboy from "connect-busboy";
import prisma from "@mirlo/prisma";

type Params = {
trackId: string;
Expand All @@ -33,7 +34,7 @@ export default function () {
const { trackId } = req.params as unknown as Params;
const loggedInUser = req.user as User;
try {
const track = doesTrackBelongToUser(Number(trackId), loggedInUser);
const track = await doesTrackBelongToUser(Number(trackId), loggedInUser);

if (!track) {
res.status(400).json({
Expand Down
Loading