photo
Version:
Photo/video library management toolset.
45 lines (44 loc) • 1.72 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var _a, _b, _c, _d, _e, _f;
Object.defineProperty(exports, "__esModule", { value: true });
var fs_1 = __importDefault(require("fs"));
var os_1 = require("os");
var configFile = loadConfigFile();
var config = {
lowercasedFileExtensions: {
image: ((_a = configFile.lowercasedFileExtensions) === null || _a === void 0 ? void 0 : _a.image) || [
".jpg",
".jpeg",
".cr2",
".nef",
".heic",
".tiff",
],
video: ((_b = configFile.lowercasedFileExtensions) === null || _b === void 0 ? void 0 : _b.video) || [
".avi",
".mov",
".mp4",
".3gp",
],
},
destinationFileNameSeparator: {
date: ((_c = configFile.destinationFileNameSeparator) === null || _c === void 0 ? void 0 : _c.date) || "-",
time: ((_d = configFile.destinationFileNameSeparator) === null || _d === void 0 ? void 0 : _d.time) || "-",
group: ((_e = configFile.destinationFileNameSeparator) === null || _e === void 0 ? void 0 : _e.group) || "__",
camera: ((_f = configFile.destinationFileNameSeparator) === null || _f === void 0 ? void 0 : _f.camera) || "_",
},
databaseFileName: configFile.databaseFileName || "photo.sqlite3",
defaultOutputPath: configFile.defaultOutputPath,
};
exports.default = config;
function loadConfigFile() {
try {
return JSON.parse(fs_1.default.readFileSync("".concat((0, os_1.homedir)(), "/.photo.config"), "utf-8")) || {};
}
catch (_a) {
return {};
}
}