mirror of
https://github.com/stashapp/stash.git
synced 2026-01-30 20:13:58 +01:00
* Update text.ts Displayed resolutions in Stash were confusing as hell when it came to VR files - which are typically 2:1. Now I understand why, it's assuming 16:9 files/looking at height only.
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import { ResolutionEnum } from "src/core/generated-graphql";
|
|
|
|
const stringResolutionMap = new Map<string, ResolutionEnum>([
|
|
["144p", ResolutionEnum.VeryLow],
|
|
["240p", ResolutionEnum.Low],
|
|
["360p", ResolutionEnum.R360P],
|
|
["480p", ResolutionEnum.Standard],
|
|
["540p", ResolutionEnum.WebHd],
|
|
["720p", ResolutionEnum.StandardHd],
|
|
["1080p", ResolutionEnum.FullHd],
|
|
["1440p", ResolutionEnum.QuadHd],
|
|
// ["1920p", ResolutionEnum.VrHd],
|
|
["4k", ResolutionEnum.FourK],
|
|
["5k", ResolutionEnum.FiveK],
|
|
["6k", ResolutionEnum.SixK],
|
|
["7k", ResolutionEnum.SevenK],
|
|
["8k", ResolutionEnum.EightK],
|
|
["Huge", ResolutionEnum.Huge],
|
|
]);
|
|
|
|
export const stringToResolution = (
|
|
value?: string | null,
|
|
caseInsensitive?: boolean
|
|
) => {
|
|
if (!value) {
|
|
return undefined;
|
|
}
|
|
|
|
const ret = stringResolutionMap.get(value);
|
|
if (ret || !caseInsensitive) {
|
|
return ret;
|
|
}
|
|
|
|
const asUpper = value.toUpperCase();
|
|
const foundEntry = Array.from(stringResolutionMap.entries()).find((e) => {
|
|
return e[0].toUpperCase() === asUpper;
|
|
});
|
|
|
|
if (foundEntry) {
|
|
return foundEntry[1];
|
|
}
|
|
};
|
|
|
|
export const resolutionStrings = Array.from(stringResolutionMap.keys());
|