Skip to content

best way to save what you love

web/remux: correctly unset processing state

dumbmorond446dfd87e5c
diff --git a/web/src/routes/remux/+page.svelte b/web/src/routes/remux/+page.svelte
index 3229e863..2570f132 100644
--- a/web/src/routes/remux/+page.svelte
+++ b/web/src/routes/remux/+page.svelte
@@ -43,43 +43,44 @@
const render = async () => {
if (!file || processing) return;
await ff.init();
-
- progress = '';
- processing = true;
-
- const file_info = await ff.probe(file);
- if (!file_info?.format) {
- return createDialog({
- id: "remux-error",
- type: "small",
- meowbalt: "error",
- bodyText: $t("error.remux.corrupted"),
- buttons: [
- {
- text: $t("button.gotit"),
- main: true,
- action: () => {},
- },
- ],
+ try {
+ progress = '';
+ processing = true;
+
+ const file_info = await ff.probe(file);
+ if (!file_info?.format) {
+ return createDialog({
+ id: "remux-error",
+ type: "small",
+ meowbalt: "error",
+ bodyText: $t("error.remux.corrupted"),
+ buttons: [
+ {
+ text: $t("button.gotit"),
+ main: true,
+ action: () => {},
+ },
+ ],
+ });
+ }
+
+ totalDuration = Number(file_info.format.duration);
+
+ const render = await ff.render({
+ blob: file,
+ args: ['-c', 'copy', '-map', '0']
});
- }
-
- totalDuration = Number(file_info.format.duration);
- const render = await ff.render({
- blob: file,
- args: ['-c', 'copy', '-map', '0']
- });
+ if (render) {
+ openURL(URL.createObjectURL(render));
+ } else {
+ console.log("not a valid file");
+ }
- processing = false;
-
- if (render) {
- openURL(URL.createObjectURL(render));
- } else {
- console.log("not a valid file");
+ } finally {
+ processing = false;
+ file = undefined;
}
-
- file = undefined;
};
$: if (file) {