mirror of https://github.com/VERT-sh/VERT.git
Revert "Replace deprecated jsmediatags with music-metadata (#42)"
This reverts commit a47e6f973f
.
This commit is contained in:
parent
57ead7ae8f
commit
5082f83d22
|
@ -17,6 +17,7 @@
|
|||
"@sveltejs/kit": "^2.16.0",
|
||||
"@sveltejs/vite-plugin-svelte": "^4.0.4",
|
||||
"@types/eslint": "^9.6.1",
|
||||
"@types/jsmediatags": "^3.9.6",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"eslint": "^9.18.0",
|
||||
"eslint-config-prettier": "^10.0.1",
|
||||
|
@ -42,9 +43,12 @@
|
|||
"@imagemagick/magick-wasm": "^0.0.32",
|
||||
"client-zip": "^2.4.6",
|
||||
"clsx": "^2.1.1",
|
||||
"jsmediatags": "^3.9.7",
|
||||
"lucide-svelte": "^0.475.0",
|
||||
"music-metadata": "^11.0.0",
|
||||
"vite-plugin-static-copy": "^2.2.0",
|
||||
"wasm-vips": "^0.0.11"
|
||||
},
|
||||
"patchedDependencies": {
|
||||
"jsmediatags@3.9.7": "patches/jsmediatags@3.9.7.patch"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
diff --git a/package.json b/package.json
|
||||
index 1265c61a16be5dc94dea97e1a7bcd117b0b5c0fe..602a37452738d778bf705b7a2931a661e363e33c 100644
|
||||
--- a/package.json
|
||||
+++ b/package.json
|
||||
@@ -18,8 +18,8 @@
|
||||
"email": "jesse.ditson@gmail.com"
|
||||
}
|
||||
],
|
||||
- "main": "build2/jsmediatags.js",
|
||||
- "browser": "dist/jsmediatags.js",
|
||||
+ "main": "dist/jsmediatags.min.js",
|
||||
+ "browser": "dist/jsmediatags.min.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/aadsm/jsmediatags.git"
|
|
@ -1,7 +1,8 @@
|
|||
import { converters } from "$lib/converters";
|
||||
import { error, log } from "$lib/logger";
|
||||
import { VertFile } from "$lib/types";
|
||||
import { parseBlob, selectCover } from "music-metadata";
|
||||
import jsmediatags from "jsmediatags";
|
||||
import type { TagType } from "jsmediatags/types";
|
||||
import { writable } from "svelte/store";
|
||||
import { addDialog } from "./DialogProvider";
|
||||
|
||||
|
@ -32,17 +33,22 @@ class Files {
|
|||
|
||||
try {
|
||||
if (isAudio) {
|
||||
// try to get the thumbnail from the audio via music-metadata
|
||||
const {common} = await parseBlob(file.file);
|
||||
const cover = selectCover(common.picture);
|
||||
if (cover) {
|
||||
// try to get the thumbnail from the audio via jsmmediatags
|
||||
const tags = await new Promise<TagType>((resolve, reject) => {
|
||||
jsmediatags.read(file.file, {
|
||||
onSuccess: (tag) => resolve(tag),
|
||||
onError: (error) => reject(error),
|
||||
});
|
||||
});
|
||||
if (tags.tags.picture) {
|
||||
const blob = new Blob(
|
||||
[cover.data],
|
||||
[new Uint8Array(tags.tags.picture.data)],
|
||||
{
|
||||
type: cover.format,
|
||||
type: tags.tags.picture.format,
|
||||
},
|
||||
);
|
||||
file.blobUrl = URL.createObjectURL(blob);
|
||||
const url = URL.createObjectURL(blob);
|
||||
file.blobUrl = url;
|
||||
}
|
||||
} else if (isVideo) {
|
||||
// video
|
||||
|
|
Loading…
Reference in New Issue