mirror of
https://github.com/C4illin/ConvertX.git
synced 2025-11-20 22:48:09 +00:00
fix: getPossibleTargets select correct targets
This commit is contained in:
@@ -245,22 +245,18 @@ const possibleTargets: Record<string, Record<string, string[]>> = {};
|
|||||||
|
|
||||||
for (const converterName in properties) {
|
for (const converterName in properties) {
|
||||||
const converterProperties = properties[converterName]?.properties;
|
const converterProperties = properties[converterName]?.properties;
|
||||||
|
if (!converterProperties) continue;
|
||||||
if (!converterProperties) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const key in converterProperties.from) {
|
for (const key in converterProperties.from) {
|
||||||
if (converterProperties.from[key] === undefined) {
|
const fromList = converterProperties.from[key];
|
||||||
continue;
|
const toList = converterProperties.to[key];
|
||||||
}
|
|
||||||
|
|
||||||
for (const extension of converterProperties.from[key] ?? []) {
|
if (!fromList || !toList) continue;
|
||||||
if (!possibleTargets[extension]) {
|
|
||||||
possibleTargets[extension] = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
possibleTargets[extension][converterName] = converterProperties.to[key] || [];
|
for (const ext of fromList) {
|
||||||
|
if (!possibleTargets[ext]) possibleTargets[ext] = {};
|
||||||
|
|
||||||
|
possibleTargets[ext][converterName] = toList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -289,11 +285,6 @@ for (const converterName in properties) {
|
|||||||
}
|
}
|
||||||
possibleInputs.sort();
|
possibleInputs.sort();
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
const getPossibleInputs = () => {
|
|
||||||
return possibleInputs;
|
|
||||||
};
|
|
||||||
|
|
||||||
const allTargets: Record<string, string[]> = {};
|
const allTargets: Record<string, string[]> = {};
|
||||||
|
|
||||||
for (const converterName in properties) {
|
for (const converterName in properties) {
|
||||||
@@ -336,29 +327,3 @@ for (const converterName in properties) {
|
|||||||
export const getAllInputs = (converter: string) => {
|
export const getAllInputs = (converter: string) => {
|
||||||
return allInputs[converter] || [];
|
return allInputs[converter] || [];
|
||||||
};
|
};
|
||||||
|
|
||||||
// // count the number of unique formats
|
|
||||||
// const uniqueFormats = new Set();
|
|
||||||
|
|
||||||
// for (const converterName in properties) {
|
|
||||||
// const converterProperties = properties[converterName]?.properties;
|
|
||||||
|
|
||||||
// if (!converterProperties) {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// for (const key in converterProperties.from) {
|
|
||||||
// for (const extension of converterProperties.from[key] ?? []) {
|
|
||||||
// uniqueFormats.add(extension);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// for (const key in converterProperties.to) {
|
|
||||||
// for (const extension of converterProperties.to[key] ?? []) {
|
|
||||||
// uniqueFormats.add(extension);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // print the number of unique Inputs and Outputs
|
|
||||||
// console.log(`Unique Formats: ${uniqueFormats.size}`);
|
|
||||||
|
|||||||
Reference in New Issue
Block a user