Skip to content

Commit

Permalink
Merge pull request #10 from jlw4049/electron
Browse files Browse the repository at this point in the history
Rebuilt the app from the ground up with electron
  • Loading branch information
jessielw authored Sep 30, 2023
2 parents a307091 + 339840a commit e4b89f8
Show file tree
Hide file tree
Showing 54 changed files with 8,814 additions and 7 deletions.
134 changes: 134 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,137 @@ HDR10PlusParser.spec
config.ini
*.exe
*.zip
.vscode/
app_config/
test.js

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
# HDR10Plus-Tool-Gui

![](hdr-multi-tool-gui.v1.3.png)
![image](https://github.com/jlw4049/HDR-Multi-Tool-Gui/assets/48299282/6f8920d0-64c2-408c-bc1f-0decb6783a45)

A basic GUI to parse MKV, TS, MP4, and HEVC HDR10/10+ and Dolby Vision dynamic metadata for use with video encoding
A modern GUI to parse HDR10+ and Dolby Vision dynamic metadata for use with video encoding.

Program only supports the above formats for now, I will add support for more if I come across any.
Supports **MKV, TS, MP4, and HEVC** as inputs right now. Please open an issue if there is any inputs that are not accepted that should be.

Feel free to put an issue on the tracker here if the program should but doesn't support an input extension type
Supports drag and drop in the input area.

In the menu at the top, you can select 'Automatic' or 'Debug':
If you open a file that has both HDR10+ and Dolby Vision you will see dual option panels. Choose which you would
like to extract and configure the settings. Everything else is handled for you.

'Progress Bars' spawns new windows with progress bars and a read out
At the moment the only configurable options there is under options is to automatically start the job queue upon
adding a job.

'CMD Shell (Debug)' will spawn a CMD shell and leave it open in order to read errors in the event you have one
#### Supported Operating Systems

As of **v2.0** the app only **officially** supports **Windows** operating systems. I plan to add support for mac/linux in coming updates when I have time to test the configuration fully.

#### Note

As of **v2.0** the tkinter version of the app has been dropped. I have no plans to update/maintain that version of the app. However, I will leave it on the repository in the "tkinter" folder.
Binary file added electron/app/images/hdr.ico
Binary file not shown.
Binary file added electron/app/images/hdr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions electron/app/main/baseDirectory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const path = require("path");
const { app } = require("electron");

let rootDir;

// determine root directory (where main.js would be)
if (app.isPackaged) {
// bundled app
rootDir = path.dirname(process.execPath);
} else {
// development
rootDir = path.resolve(__dirname, "../../");
}

module.exports = rootDir;
18 changes: 18 additions & 0 deletions electron/app/main/configUtils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const electronStore = require("electron-store");
const path = require("path");
const baseDirectory = require("../../app/main/baseDirectory");

// set config default options
const defaultOptions = {
autoStart: false,
};

// Define a function that initializes and returns the store instance
function createConfigStore() {
return new electronStore({
cwd: path.resolve(baseDirectory, "app_config"),
defaults: defaultOptions,
});
}

module.exports = createConfigStore;
28 changes: 28 additions & 0 deletions electron/app/main/createDirectories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const path = require("path");
const fs = require("fs").promises;
const { dialog } = require("electron");
const baseDirectory = require("../../app/main/baseDirectory");

async function createLogDir() {
const logDirectory = path.join(baseDirectory, "logs");

try {
await fs.mkdir(logDirectory, { recursive: true });
return logDirectory;
} catch (error) {
if (error.code === "EEXIST") {
return logDirectory;
} else {
// Only show an error dialog for unexpected errors
if (error.code !== "ENOENT") {
dialog.showErrorBox(
"Error Creating Directory",
`Error creating directory: ${error.message}`
);
}
return null;
}
}
}

module.exports = createLogDir;
80 changes: 80 additions & 0 deletions electron/app/main/customMenu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
const { app, Menu } = require("electron");
const {
showOpenDialog,
} = require("../../app/main/ipc_handlers/ipcFileHandlers");
const createConfigStore = require("../../app/main/configUtils.js");

async function updateAutoStart(store, toggle) {
store.set("autoStart", toggle);
}

module.exports = (root) => {
const store = createConfigStore();

const template = [
{
label: "File",
submenu: [
{
label: "Open",
accelerator: "CmdOrCtrl+O",
click: async () => {
const fileInput = await showOpenDialog(root);
root.webContents.send("return-open-dialog", fileInput.filePaths);
},
},
{
type: "separator",
},
{
label: "Quit",
accelerator: "CmdOrCtrl+Q",
click: () => {
app.quit();
},
},
],
},
{
label: "Options",
submenu: [
{
label: "Auto Start Queue",
submenu: [
{
label: "On",
type: "radio",
checked: store.get("autoStart") ? true : false,
click: async () => {
await updateAutoStart(store, true);
},
},
{
label: "Off",
type: "radio",
checked: store.get("autoStart") ? false : true,
click: async () => {
await updateAutoStart(store, false);
},
},
],
},
],
},
{
label: "Help",
submenu: [
{
label: "About",
click: async () => {
root.webContents.send("open-about");
},
},
],
},
// Add more menu items and submenus as needed
];

const menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);
};
62 changes: 62 additions & 0 deletions electron/app/main/detectFilePaths.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
const fs = require("fs");
const which = require("which");
const curPlatform = require("os").platform();
const path = require("path");

// tool paths (attempt to detect on PATH)
let doviToolPath = {
name: "dovi_tool",
path: which.sync("dovi_tool", { nothrow: true }),
};
let hdrToolPath = {
name: "hdr10plus_tool",
path: which.sync("hdr10plus", { nothrow: true }),
};
let ffmpegToolPath = {
name: "FFMPEG",
path: which.sync("ffmpeg", { nothrow: true }),
};

if (curPlatform === "win32") {
if (!doviToolPath.path) {
doviToolPath.path = path.resolve("apps/dovi_tool.exe");
}
if (!hdrToolPath.path) {
hdrToolPath.path = path.resolve("apps/hdr10plus_tool.exe");
}
if (!ffmpegToolPath.path) {
ffmpegToolPath.path = path.resolve("apps/ffmpeg.exe");
}
} else {
if (!doviToolPath.path) {
doviToolPath.path = path.resolve("apps/dovi_tool");
}
if (!hdrToolPath.path) {
hdrToolPath.path = path.resolve("apps/hdr10plus_tool");
}
if (!ffmpegToolPath.path) {
ffmpegToolPath.path = path.resolve("apps/ffmpeg");
}
}

const toolPathObject = {
doviToolPath: doviToolPath.path,
hdrToolPath: hdrToolPath.path,
ffmpegToolPath: ffmpegToolPath.path,
};

async function checkDependencies() {
for (const toolPath of [doviToolPath, hdrToolPath, ffmpegToolPath]) {
const detectFile = fs.existsSync(toolPath.path);
if (!detectFile) {
const fileName = toolPath.name;
return {
success: false,
message: `"${fileName}" is not detected.\n\nWe will be unable to process files without having "${fileName}" installed.\n\nInstall "${fileName}" on your system path or in the "apps" folder and relaunch`,
};
}
}
return { success: true };
}

module.exports = { checkDependencies, toolPathObject };
Loading

0 comments on commit e4b89f8

Please sign in to comment.