n->a and n->v filters

This commit is contained in:
Sam Lavigne 2023-08-21 11:55:11 -04:00
parent 7b62ce676a
commit 6b7170e0c7
2 changed files with 42 additions and 48 deletions

View File

@ -118,8 +118,6 @@
command.push("-i"); command.push("-i");
command.push(vid); command.push(vid);
} }
// let command = ["-i", "example.mp4"];
// const audioFilters = $filters.filter(f => f.type[0] === "A").map(makeFilterArgs); // const audioFilters = $filters.filter(f => f.type[0] === "A").map(makeFilterArgs);
// const videoFilters = $filters.filter(f => f.type[0] === "V").map(makeFilterArgs); // const videoFilters = $filters.filter(f => f.type[0] === "V").map(makeFilterArgs);
@ -316,11 +314,7 @@
flex: 1; flex: 1;
align-content: start; align-content: start;
} }
.filter {
/* width: 33%; */
}
h1, h1,
h2,
h3 { h3 {
font-weight: normal; font-weight: normal;
margin: 0; margin: 0;

View File

@ -1,39 +1,39 @@
<script> <script>
import uFuzzy from "@leeoniya/ufuzzy"; import uFuzzy from "@leeoniya/ufuzzy";
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from "uuid";
import FILTERS from "./filters.json"; import FILTERS from "./filters.json";
import { filters } from "./stores.js"; import { filters } from "./stores.js";
export let select = "video"; export let select = "video";
$: selectedFilters = selectFilters(select); $: selectedFilters = selectFilters(select);
$: allfilters = [...selectedFilters]; $: allfilters = [...selectedFilters];
let q = ""; let q = "";
const uf = new uFuzzy(); const uf = new uFuzzy();
function selectFilters(sel) { function selectFilters(sel) {
if (sel == "video") { if (sel == "video") {
return FILTERS.filter(f => f.type[0] === "V") return FILTERS.filter((f) => f.type[0] === "V" || f.type === "N->V");
} else if (sel == "audio") { } else if (sel == "audio") {
return FILTERS.filter(f => f.type[0] === "A") return FILTERS.filter((f) => f.type[0] === "A" || f.type === "N->A");
} else { } else {
return [...FILTERS]; return [...FILTERS];
} }
} }
function reset() { function reset() {
q = ""; q = "";
} }
function add(f) { function add(f) {
const newFilter = { ...f, filterId: f.id, id: uuidv4() }; const newFilter = { ...f, filterId: f.id, id: uuidv4() };
if (f.params) { if (f.params) {
newFilter.params = f.params.map((p) => { newFilter.params = f.params.map((p) => {
p.value = null; p.value = null;
if (p.default != null) p.value = p.default; if (p.default != null) p.value = p.default;
return p; return p;
}); });
} }
$filters = [...$filters, newFilter]; $filters = [...$filters, newFilter];
console.log(newFilter); console.log(newFilter);
} }
@ -58,10 +58,10 @@
<div class="holder"> <div class="holder">
<div class="search"> <div class="search">
<input placeholder="Search Filters" on:keyup={update} bind:value={q} type="text" /> <input placeholder="Search Filters" on:keyup={update} bind:value={q} type="text" />
<select on:change={reset} bind:value={select}> <select on:change={reset} bind:value={select}>
<option value="video">Video Filters</option> <option value="video">Video Filters</option>
<option value="audio">Audio Filters</option> <option value="audio">Audio Filters</option>
</select> </select>
</div> </div>
<div class="all-filters"> <div class="all-filters">
{#each allfilters as f} {#each allfilters as f}
@ -77,22 +77,22 @@
.holder { .holder {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 100%; height: 100%;
padding: 10px; padding: 10px;
border: 1px solid var(--b1); border: 1px solid var(--b1);
}
.search {
display: flex;
justify-items: stretch;
}
input {
flex: 1;
margin-right: 10px;
}
.type {
color: #999;
font-size: 0.8em;
} }
.search {
display: flex;
justify-items: stretch;
}
input {
flex: 1;
margin-right: 10px;
}
.type {
color: #999;
font-size: 0.8em;
}
.filter { .filter {
border-bottom: 1px solid var(--b1); border-bottom: 1px solid var(--b1);