decord/source/106_getBasePath.js

59 lines
2 KiB
JavaScript
Raw Normal View History

2026-07-20 16:05:17 +00:00
// Module ID: 106
// Function ID: 1595
// Name: getBasePath
// Dependencies: []
// Module 106 (getBasePath)
function getBasePath(httpServerLocation) {
httpServerLocation = httpServerLocation.httpServerLocation;
let substr = httpServerLocation;
if (httpServerLocation.startsWith("/")) {
substr = httpServerLocation.slice(1);
}
return substr;
}
2026-07-23 10:11:24 +00:00
let closure_0 = { "0.75": "ldpi", 1: "mdpi", "1.5": "hdpi", 2: "xhdpi", 3: "xxhdpi", 4: "xxxhdpi" };
const set = new Set(["gif", "jpeg", "jpg", "ktx", "png", "webp", "xml"]);
2026-07-20 16:05:17 +00:00
export default {
getAndroidResourceFolderName(asset, arg1) {
if (set.has(asset.type)) {
2026-07-23 10:11:24 +00:00
if (arg1.toString() in table) {
let text = table[arg1.toString(arg1)];
2026-07-20 16:05:17 +00:00
} else {
const _Number = Number;
if (Number.isFinite(arg1)) {
if (arg1 > 0) {
const _Math = Math;
text = `${Math.round(160 * arg1)}dpi`;
}
}
const _Error = Error;
const error = new Error("no such scale " + arg1.toString());
throw error;
}
if (text) {
return "drawable-" + text;
} else {
const _Error2 = Error;
const _JSON = JSON;
const text1 = `Don't know which android drawable suffix to use for scale: ${arg1}`;
const _JSON2 = JSON;
const text2 = `${`Don't know which android drawable suffix to use for scale: ${arg1}`}
Asset: ${JSON.stringify(asset, null, "\t")}`;
2026-07-23 10:11:24 +00:00
const error1 = new Error(text2 + "\nPossible scales are:" + JSON.stringify(table, null, "\t"));
2026-07-20 16:05:17 +00:00
throw error1;
}
} else {
return "raw";
}
},
getAndroidResourceIdentifier(asset) {
2026-07-23 10:11:24 +00:00
const str = `${getBasePath(asset)}/${asset.name}`;
const str2 = `${getBasePath(asset)}/${asset.name}`.toLowerCase();
const str3 = `${getBasePath(asset)}/${asset.name}`.toLowerCase().replace(/\//g, "_");
return `${getBasePath(asset)}/${asset.name}`.toLowerCase().replace(/\//g, "_").replace(/([^a-z0-9_])/g, "").replace(/^(?:assets|assetsunstable_path)_/, "");
2026-07-20 16:05:17 +00:00
},
getBasePath
};