Skip to content

Commit

Permalink
version 2.0.16 - filepicker support
Browse files Browse the repository at this point in the history
  • Loading branch information
paulrouget committed Feb 7, 2024
1 parent d9ce05f commit eebbc93
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 5 deletions.
27 changes: 27 additions & 0 deletions app/src/converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,23 @@ const exec_dir = path.dirname(process.execPath);

const ffmpeg = findExecutableFullPath("ffmpeg", exec_dir);
const ffprobe = findExecutableFullPath("ffprobe", exec_dir);
const filepicker = findExecutableFullPath("filepicker", exec_dir);

if (!fileExistsSync(ffmpeg)) {
logger.error("ffmpeg not found. Install ffmpeg and make sure it's in your path.");
process.exit(1);
}

if (!fileExistsSync(ffprobe)) {
logger.error("ffprobe not found. Install ffmpeg and make sure it's in your path.");
process.exit(1);
}

if (!fileExistsSync(filepicker)) {
logger.error("filepicker not found.");
process.exit(1);
}

function findExecutableFullPath(programName, extraPath = "") {
programName = ensureProgramExt(programName);
const envPath = (process.env.PATH || '');
Expand Down Expand Up @@ -98,6 +105,26 @@ exports.star_listening = () => {

rpc.listen({

"filepicker": async (action, directory, title, filename) => {
let args = [action, directory, title];
if (filename) {
args.push(filename);
}
let stdout = await new Promise((ok, ko) => {

Check failure on line 113 in app/src/converter.js

View workflow job for this annotation

GitHub Actions / build

'ko' is defined but never used. Allowed unused args must match /^_/u
let proc = spawn(filepicker, args);
let stdout = "";
proc.stdout.on("data", data => stdout += data);

Check failure on line 116 in app/src/converter.js

View workflow job for this annotation

GitHub Actions / build

Expected parentheses around arrow function argument
proc.on("exit", (code) => {
if (code == 0) {
ok(stdout);
} else {
ok("");
}
});
});
return stdout;
},

"abortConvert": (pid) => {
let child = convertChildren.get(pid);
if (child && child.exitCode == null) {
Expand Down
28 changes: 24 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,17 @@ eval $(yq ./config.toml -o shell)
node_arch=$target_arch
node_os=$target_os
deb_arch=$target_arch

filepicker_target=filepicker-$target
filepicker_target_dir=filepicker-$target
ffmpeg_target=ffmpeg-$package_ffmpeg_build_version-$target
ffmpeg_target_dir=ffmpeg-$target
if [ $target_os == "win7" ]; then
node_os="windows"
ffmpeg_target=ffmpeg-$package_ffmpeg_build_version-windows-$target_arch
ffmpeg_target_dir=ffmpeg-windows-$target_arch
filepicker_target=filepicker-windows-$target_arch
filepicker_target_dir=filepicker-windows-$target_arch
fi
if [ $target_os == "mac13" ]; then
node_os="mac"
Expand Down Expand Up @@ -331,16 +336,23 @@ else
log "Skipping bundling"
fi

if [ ! -d "$dist_dir/$ffmpeg_target" ]; then
if [[ ! -f $dist_dir/filepicker-$target ]]; then
log "Retrieving filepicker"
filepicker_url_base="https://github.com/paulrouget/static-filepicker/releases/download/"
filepicker_url=$filepicker_url_base/v$package_filepicker_build_version/$filepicker_target
wget -c $filepicker_url -O $dist_dir/$filepicker_target
chmod +x $dist_dir/$filepicker_target
fi

cp $dist_dir/filepicker-$target $target_dist_dir/filepicker$exe_extension

if [[ ! -d $dist_dir/$ffmpeg_target_dir ]]; then
log "Retrieving ffmpeg"
ffmpeg_url_base="https://github.com/aclap-dev/ffmpeg-static-builder/releases/download/"
ffmpeg_url=$ffmpeg_url_base/v$package_ffmpeg_build_version/$ffmpeg_target.tar.bz2
ffmpeg_tarball=$dist_dir/$ffmpeg_target.tar.bz2
wget --show-progress -c -O $ffmpeg_tarball $ffmpeg_url
(cd $dist_dir && tar -xf $ffmpeg_tarball)
rm $ffmpeg_tarball
else
log "ffmpeg already downloaded"
fi

cp $dist_dir/$ffmpeg_target_dir/ffmpeg$exe_extension \
Expand All @@ -361,6 +373,7 @@ if [ ! $skip_packaging == 1 ]; then
# Variation: No ffmpeg shipped
# --------------------------------
cp LICENSE.txt README.md app/node_modules/open/xdg-open \
$target_dist_dir/filepicker \
$target_dist_dir/$package_binary_name \
$target_dist_dir/deb/opt/$package_binary_name

Expand Down Expand Up @@ -403,6 +416,7 @@ if [ ! $skip_packaging == 1 ]; then

cp LICENSE.txt README.md app/node_modules/open/xdg-open \
$target_dist_dir/$package_binary_name \
$target_dist_dir/filepicker \
$target_dist_dir/ffmpeg \
$target_dist_dir/ffprobe \
$target_dist_dir/deb/opt/$package_binary_name
Expand Down Expand Up @@ -462,6 +476,7 @@ if [ ! $skip_packaging == 1 ]; then

cp $target_dist_dir/ffmpeg \
$target_dist_dir/ffprobe \
$target_dist_dir/filepicker \
$target_dist_dir/$package_binary_name \
$macos_dir

Expand Down Expand Up @@ -490,6 +505,7 @@ if [ ! $skip_packaging == 1 ]; then
--options=runtime --timestamp -v -f \
-s "$package_mac_signing_app_cert" \
$macos_dir/ffmpeg \
$macos_dir/filepicker \
$macos_dir/ffprobe \
$macos_dir/vdhcoapp \
$macos_dir/register.sh
Expand Down Expand Up @@ -558,6 +574,7 @@ if [ ! $skip_packaging == 1 ]; then
done

cp $target_dist_dir/$package_binary_name.exe \
$target_dist_dir/filepicker.exe \
$target_dist_dir/ffmpeg.exe \
$target_dist_dir/ffprobe.exe \
$install_dir
Expand Down Expand Up @@ -586,6 +603,7 @@ target_dist_dir=$dist_dir/$target_os/$target_arch

if [ $node_os == "windows" ]; then
log "Binary available: $target_dist_dir_rel/$package_binary_name.exe"
log "Binary available: $target_dist_dir_rel/filepicker.exe"
log "Binary available: $target_dist_dir_rel/ffmpeg.exe"
log "Binary available: $target_dist_dir_rel/ffprobe.exe"
if [ ! $skip_packaging == 1 ]; then
Expand All @@ -595,6 +613,7 @@ fi

if [ $target_os == "linux" ]; then
log "Binary available: $target_dist_dir_rel/$package_binary_name"
log "Binary available: $target_dist_dir_rel/filepicker"
log "Binary available: $target_dist_dir_rel/ffmpeg"
log "Binary available: $target_dist_dir_rel/ffprobe"
if [ ! $skip_packaging == 1 ]; then
Expand All @@ -607,6 +626,7 @@ fi

if [ $target_os == "mac" ]; then
log "Binary available: $target_dist_dir_rel/$package_binary_name"
log "Binary available: $target_dist_dir_rel/filepicker"
log "Binary available: $target_dist_dir_rel/ffmpeg"
log "Binary available: $target_dist_dir_rel/ffprobe"
if [ ! $skip_packaging == 1 ]; then
Expand Down
3 changes: 2 additions & 1 deletion config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ id = "net.downloadhelper.coapp"
name = "VdhCoApp"
long_name = "DownloadHelper CoApp"
description = "Video DownloadHelper companion app"
version = "2.0.15"
version = "2.0.16"

[package]
binary_name = "vdhcoapp" # .exe added automatically
ffmpeg_build_version = "2.0.3"
filepicker_build_version = "1.0.0"

[package.windows]
publisher = "ACLAP"
Expand Down

0 comments on commit eebbc93

Please sign in to comment.