added nautilus scripts (needs nautilus-python package)
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
/home/tobias/.local/share/nautilus/scripts/Hash and checksum/List SHA-256
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/home/tobias/.local/share/nautilus/scripts/Audio/Convert to 'flac'
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/home/tobias/.local/share/nautilus/scripts/Audio/Convert to 'wav'
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
/home/tobias/.local/share/nautilus/scripts/Audio/Convert to 'mp3' (48 kbps, mono)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/home/tobias/.local/share/nautilus/scripts/Image/Convert/Convert to 'png'
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/home/tobias/.local/share/nautilus/scripts/Hash and checksum/Verify 'md5sum.txt'
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/home/tobias/.local/share/nautilus/scripts/Hash and checksum/Produce 'md5sum.txt'
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/home/tobias/.local/share/nautilus/scripts/Hash and checksum/List all hashes
|
||||||
Executable
+44
@@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# https://help.ubuntu.com/community/NautilusScriptsHowto/SampleScripts
|
||||||
|
|
||||||
|
# This script opens a gnome-terminal in the directory you select.
|
||||||
|
#
|
||||||
|
# Distributed under the terms of GNU GPL version 2 or later
|
||||||
|
#
|
||||||
|
# Install in ~/.gnome2/nautilus-scripts or ~/Nautilus/scripts
|
||||||
|
# You need to be running Nautilus 1.0.3+ to use scripts.
|
||||||
|
|
||||||
|
# When a directory is selected, go there. Otherwise go to current
|
||||||
|
# directory. If more than one directory is selected, show error.
|
||||||
|
if [ -n "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" ]; then
|
||||||
|
set $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
|
||||||
|
if [ $# -eq 1 ]; then
|
||||||
|
destination="$1"
|
||||||
|
# Go to file's directory if it's a file
|
||||||
|
if [ ! -d "$destination" ]; then
|
||||||
|
destination="`dirname "$destination"`"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
zenity --error --title="Error - Open terminal here" \
|
||||||
|
--text="You can only select one directory."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
destination="`echo "$NAUTILUS_SCRIPT_CURRENT_URI" | sed 's/^file:\/\///'`"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# It's only possible to go to local directories
|
||||||
|
if [ -n "`echo "$destination" | grep '^[a-zA-Z0-9]\+:'`" ]; then
|
||||||
|
zenity --error --title="Error - Open terminal here" \
|
||||||
|
--text="Only local directories can be used."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# replace %20 with space
|
||||||
|
destination=$(echo $destination |sed -e 's/%20/ /g')
|
||||||
|
|
||||||
|
cd "$destination"
|
||||||
|
# exec x-terminal-emulator
|
||||||
|
/home/tobias/.local/bin/alacritty --working-directory "$destination" &
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_command_exists "bsdtar" || _check_dependencies "
|
||||||
|
command=7za; pkg_manager=apt; package=p7zip-full |
|
||||||
|
command=7za; pkg_manager=dnf; package=p7zip |
|
||||||
|
command=7za; pkg_manager=pacman; package=p7zip |
|
||||||
|
command=7za; pkg_manager=zypper; package=p7zip"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=all")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=true")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=7z")
|
||||||
|
if [[ -d "$input_file" ]]; then
|
||||||
|
cd -- "$input_file" || return 1
|
||||||
|
|
||||||
|
if _command_exists "7za"; then
|
||||||
|
std_output=$(7za a -mx9 "$output_file" -- . 2>&1)
|
||||||
|
elif _command_exists "bsdtar"; then
|
||||||
|
std_output=$(bsdtar --strip-components 1 -a -cf "$output_file" -- . 2>&1)
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
cd -- "$(_get_filename_dir "$input_file")" || return 1
|
||||||
|
local input_file_basename=""
|
||||||
|
input_file_basename=$(basename -- "$input_file")
|
||||||
|
|
||||||
|
if _command_exists "7za"; then
|
||||||
|
std_output=$(7za a -mx9 "$output_file" -- "$input_file_basename" 2>&1)
|
||||||
|
elif _command_exists "bsdtar"; then
|
||||||
|
std_output=$(bsdtar -a -cf "$output_file" -- "$input_file_basename" 2>&1)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=genisoimage; pkg_manager=apt |
|
||||||
|
command=genisoimage; pkg_manager=dnf |
|
||||||
|
command=genisoimage; pkg_manager=pacman; package=cdrtools |
|
||||||
|
command=mkisofs; pkg_manager=zypper"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=all")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=true")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
local volume_id=""
|
||||||
|
volume_id=$(basename -- "$input_file" | cut -c 1-32 2>/dev/null)
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=iso")
|
||||||
|
if _command_exists "mkisofs"; then
|
||||||
|
std_output=$(mkisofs -input-charset "utf-8" -o "$output_file" -V "$volume_id" -A "" -sysid "" -J -R "$input_file" 2>&1)
|
||||||
|
elif _command_exists "genisoimage"; then
|
||||||
|
std_output=$(genisoimage -input-charset "utf-8" -o "$output_file" -V "$volume_id" -A "" -sysid "" -J -R "$input_file" 2>&1)
|
||||||
|
fi
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=mksquashfs; pkg_manager=apt; package=squashfs-tools |
|
||||||
|
command=mksquashfs; pkg_manager=dnf; package=squashfs-tools |
|
||||||
|
command=mksquashfs; pkg_manager=pacman; package=squashfs-tools |
|
||||||
|
command=mksquashfs; pkg_manager=zypper; package=squashfs"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=all")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=true")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=squashfs")
|
||||||
|
std_output=$(mksquashfs "$input_file" "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# install_keyboard_shortcut=<Control><Alt>G
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "command=tar | command=gunzip; package=gzip"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=all")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=true")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=tar.gz")
|
||||||
|
if [[ -d "$input_file" ]]; then
|
||||||
|
local files=""
|
||||||
|
cd -- "$input_file" || return 1
|
||||||
|
files=$(find . -mindepth 1 -maxdepth 1 -printf "%p$FIELD_SEPARATOR" | sed "s|\./||g")
|
||||||
|
std_output=$(printf "%s" "$files" | xargs --no-run-if-empty --delimiter="$FIELD_SEPARATOR" tar -czf "$output_file" --)
|
||||||
|
else
|
||||||
|
cd -- "$(_get_filename_dir "$input_file")" || return 1
|
||||||
|
local input_file_basename=""
|
||||||
|
input_file_basename=$(basename -- "$input_file")
|
||||||
|
std_output=$(tar -czf "$output_file" -- "$input_file_basename" 2>&1)
|
||||||
|
fi
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# install_keyboard_shortcut=<Control><Alt>X
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=tar |
|
||||||
|
command=xz; pkg_manager=apt; package=xz-utils |
|
||||||
|
command=xz; pkg_manager=dnf |
|
||||||
|
command=xz; pkg_manager=pacman |
|
||||||
|
command=xz; pkg_manager=zypper"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=all")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=true")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Use the maximum compression.
|
||||||
|
XZ_OPT="-9"
|
||||||
|
export XZ_OPT
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=tar.xz")
|
||||||
|
if [[ -d "$input_file" ]]; then
|
||||||
|
local files=""
|
||||||
|
cd -- "$input_file" || return 1
|
||||||
|
files=$(find . -mindepth 1 -maxdepth 1 -printf "%p$FIELD_SEPARATOR" | sed "s|\./||g")
|
||||||
|
std_output=$(printf "%s" "$files" | xargs --no-run-if-empty --delimiter="$FIELD_SEPARATOR" tar -cJf "$output_file" --)
|
||||||
|
else
|
||||||
|
cd -- "$(_get_filename_dir "$input_file")" || return 1
|
||||||
|
local input_file_basename=""
|
||||||
|
input_file_basename=$(basename -- "$input_file")
|
||||||
|
std_output=$(tar -cJf "$output_file" -- "$input_file_basename" 2>&1)
|
||||||
|
fi
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# install_keyboard_shortcut=<Control><Alt>S
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "command=tar | command=zstd"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=all")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=true")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=tar.zst")
|
||||||
|
if [[ -d "$input_file" ]]; then
|
||||||
|
local files=""
|
||||||
|
cd -- "$input_file" || return 1
|
||||||
|
files=$(find . -mindepth 1 -maxdepth 1 -printf "%p$FIELD_SEPARATOR" | sed "s|\./||g")
|
||||||
|
std_output=$(printf "%s" "$files" | xargs --no-run-if-empty --delimiter="$FIELD_SEPARATOR" tar --zstd -cf "$output_file" --)
|
||||||
|
else
|
||||||
|
cd -- "$(_get_filename_dir "$input_file")" || return 1
|
||||||
|
local input_file_basename=""
|
||||||
|
input_file_basename=$(basename -- "$input_file")
|
||||||
|
std_output=$(tar --zstd -cf "$output_file" -- "$input_file_basename" 2>&1)
|
||||||
|
fi
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# install_keyboard_shortcut=<Control><Alt>Z
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "command=zip"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=all")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=true")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=zip")
|
||||||
|
if [[ -d "$input_file" ]]; then
|
||||||
|
cd -- "$input_file" || return 1
|
||||||
|
std_output=$(zip --symlinks --quiet --recurse-paths "$output_file" -- . 2>&1)
|
||||||
|
else
|
||||||
|
cd -- "$(_get_filename_dir "$input_file")" || return 1
|
||||||
|
local input_file_basename=""
|
||||||
|
input_file_basename=$(basename -- "$input_file")
|
||||||
|
std_output=$(zip --symlinks --quiet --recurse-paths "$output_file" -- "$input_file_basename" 2>&1)
|
||||||
|
fi
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+35
@@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# install_keyboard_shortcut=<Control><Alt>C
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
input_files=$(_get_files "par_type=all")
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
if _command_exists "file-roller"; then
|
||||||
|
file-roller --add -- $input_files &
|
||||||
|
elif _command_exists "ark"; then
|
||||||
|
ark --add --dialog -- $input_files &
|
||||||
|
elif _command_exists "engrampa"; then
|
||||||
|
engrampa --add -- $input_files &
|
||||||
|
elif _command_exists "lxqt-archiver"; then
|
||||||
|
lxqt-archiver --add -- $input_files &
|
||||||
|
elif _command_exists "arqiver"; then
|
||||||
|
arqiver --sa $input_files &
|
||||||
|
elif _command_exists "xarchiver"; then
|
||||||
|
xarchiver --compress=$input_files &
|
||||||
|
else
|
||||||
|
_check_dependencies "command=file-roller"
|
||||||
|
file-roller --add -- $input_files &
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+463
@@ -0,0 +1,463 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# install_keyboard_shortcut=<Control>E
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies ""
|
||||||
|
input_files=$(_get_files "par_type=file")
|
||||||
|
|
||||||
|
local dependencies=""
|
||||||
|
dependencies=$(_get_dependencies "$input_files")
|
||||||
|
_check_dependencies "$dependencies"
|
||||||
|
_display_wait_box "0"
|
||||||
|
|
||||||
|
export -f \
|
||||||
|
_all_commands_exists \
|
||||||
|
_get_command \
|
||||||
|
_run_command
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box ""
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
local command=""
|
||||||
|
command=$(_get_command "$input_file" "available")
|
||||||
|
_run_command "$input_file" "$command" "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_get_dependencies() {
|
||||||
|
local input_files=$1
|
||||||
|
local dependencies=""
|
||||||
|
|
||||||
|
# Check dependencies for each file.
|
||||||
|
for input_file in $input_files; do
|
||||||
|
local command=""
|
||||||
|
command=$(_get_command "$input_file" "available")
|
||||||
|
|
||||||
|
# If there is an available command, skip the dependency.
|
||||||
|
if [[ -n "$command" ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
command=$(_get_command "$input_file" "default")
|
||||||
|
|
||||||
|
case $command in
|
||||||
|
"7za")
|
||||||
|
dependencies+="
|
||||||
|
command=7za; pkg_manager=apt; package=p7zip-full |
|
||||||
|
command=7za; pkg_manager=dnf; package=p7zip |
|
||||||
|
command=7za; pkg_manager=pacman; package=p7zip |
|
||||||
|
command=7za; pkg_manager=zypper; package=p7zip"
|
||||||
|
;;
|
||||||
|
"ar") dependencies+="command=ar; package=binutils" ;;
|
||||||
|
"bsdtar")
|
||||||
|
dependencies+="
|
||||||
|
command=bsdtar; pkg_manager=apt; package=libarchive-tools |
|
||||||
|
command=bsdtar; pkg_manager=dnf |
|
||||||
|
command=bsdtar; pkg_manager=pacman; package=libarchive |
|
||||||
|
command=bsdtar; pkg_manager=zypper"
|
||||||
|
;;
|
||||||
|
"bsdtar+unar+7za")
|
||||||
|
dependencies+="
|
||||||
|
command=bsdtar; pkg_manager=apt; package=libarchive-tools |
|
||||||
|
command=bsdtar; pkg_manager=dnf |
|
||||||
|
command=bsdtar; pkg_manager=pacman; package=libarchive |
|
||||||
|
command=bsdtar; pkg_manager=zypper"
|
||||||
|
dependencies+=$'\n'
|
||||||
|
dependencies+="
|
||||||
|
command=unar; pkg_manager=apt |
|
||||||
|
command=unar; pkg_manager=dnf |
|
||||||
|
command=unar; pkg_manager=pacman; package=unarchiver |
|
||||||
|
command=unar; pkg_manager=zypper"
|
||||||
|
dependencies+=$'\n'
|
||||||
|
dependencies+="
|
||||||
|
command=7za; pkg_manager=apt; package=p7zip-full |
|
||||||
|
command=7za; pkg_manager=dnf; package=p7zip |
|
||||||
|
command=7za; pkg_manager=pacman; package=p7zip |
|
||||||
|
command=7za; pkg_manager=zypper; package=p7zip"
|
||||||
|
;;
|
||||||
|
"bzip2") dependencies+="command=bzip2" ;;
|
||||||
|
"cpio") dependencies+="command=cpio" ;;
|
||||||
|
"gpg")
|
||||||
|
dependencies+="
|
||||||
|
command=gpg; pkg_manager=apt; package=gpg |
|
||||||
|
command=gpg; pkg_manager=dnf; package=gnupg2 |
|
||||||
|
command=gpg; pkg_manager=pacman; package=gnupg |
|
||||||
|
command=gpg; pkg_manager=zypper; package=gpg2"
|
||||||
|
;;
|
||||||
|
"gzip") dependencies+="command=gzip" ;;
|
||||||
|
"lha") dependencies+="command=lha; package=lhasa" ;;
|
||||||
|
"lrzip") dependencies+="command=lrzip" ;;
|
||||||
|
"lz4") dependencies+="command=lz4" ;;
|
||||||
|
"lzip") dependencies+="command=lzip" ;;
|
||||||
|
"lzop") dependencies+="command=lzop" ;;
|
||||||
|
"tar") dependencies+="command=tar" ;;
|
||||||
|
"tar+bzip2") dependencies+="command=tar | command=bzip2" ;;
|
||||||
|
"tar+gzip") dependencies+="command=tar | command=gzip" ;;
|
||||||
|
"tar+lrzip") dependencies+="command=lrztar; package=lrzip" ;;
|
||||||
|
"tar+lz4") dependencies+="command=tar | command=lz4" ;;
|
||||||
|
"tar+lzip") dependencies+="command=tar | command=lzip" ;;
|
||||||
|
"tar+lzop") dependencies+="command=tar | command=lzop" ;;
|
||||||
|
"tar+xz")
|
||||||
|
dependencies+="
|
||||||
|
command=tar |
|
||||||
|
command=xz; pkg_manager=apt; package=xz-utils |
|
||||||
|
command=xz; pkg_manager=dnf |
|
||||||
|
command=xz; pkg_manager=pacman |
|
||||||
|
command=xz; pkg_manager=zypper"
|
||||||
|
;;
|
||||||
|
"tar+zstd") dependencies+="command=tar | command=zstd" ;;
|
||||||
|
"unar")
|
||||||
|
dependencies+="
|
||||||
|
command=unar; pkg_manager=apt |
|
||||||
|
command=unar; pkg_manager=dnf |
|
||||||
|
command=unar; pkg_manager=pacman; package=unarchiver |
|
||||||
|
command=unar; pkg_manager=zypper"
|
||||||
|
;;
|
||||||
|
"unrar") dependencies+="command=unrar" ;;
|
||||||
|
"unsquashfs")
|
||||||
|
dependencies+="
|
||||||
|
command=unsquashfs; pkg_manager=apt; package=squashfs-tools |
|
||||||
|
command=unsquashfs; pkg_manager=dnf; package=squashfs-tools |
|
||||||
|
command=unsquashfs; pkg_manager=pacman; package=squashfs-tools |
|
||||||
|
command=unsquashfs; pkg_manager=zypper; package=squashfs"
|
||||||
|
;;
|
||||||
|
"unzip") dependencies+="command=unzip" ;;
|
||||||
|
"xorriso") dependencies+="command=xorriso" ;;
|
||||||
|
"xz")
|
||||||
|
dependencies+="
|
||||||
|
command=xz; pkg_manager=apt; package=xz-utils |
|
||||||
|
command=xz; pkg_manager=dnf |
|
||||||
|
command=xz; pkg_manager=pacman |
|
||||||
|
command=xz; pkg_manager=zypper"
|
||||||
|
;;
|
||||||
|
"zpaq") dependencies+="command=zpaq" ;;
|
||||||
|
"zstd") dependencies+="command=zstd" ;;
|
||||||
|
esac
|
||||||
|
dependencies+=$'\n'
|
||||||
|
done
|
||||||
|
|
||||||
|
printf "%s" "$dependencies"
|
||||||
|
}
|
||||||
|
|
||||||
|
_get_command() {
|
||||||
|
local input_file=$1
|
||||||
|
local command_status=$2
|
||||||
|
local preferred_commands=""
|
||||||
|
local command=""
|
||||||
|
|
||||||
|
# Define the preferred commands for each archive format.
|
||||||
|
case "${input_file,,}" in
|
||||||
|
*.tar.bz | *.tbz | *.tar.bz2 | *.tbz2 | *.tb2) preferred_commands="tar+bzip2 unar 7za" ;;
|
||||||
|
*.tar.gz | *.tgz) preferred_commands="tar+gzip unar 7za" ;;
|
||||||
|
*.tar.lrz | *.tlrz) preferred_commands="tar+lrzip" ;;
|
||||||
|
*.tar.lz) preferred_commands="tar+lzip" ;;
|
||||||
|
*.tar.lz4) preferred_commands="tar+lz4" ;;
|
||||||
|
*.tar.lzma | *.tlz) preferred_commands="tar+lzma unar 7za" ;;
|
||||||
|
*.tar.lzo | *.tzo) preferred_commands="tar+lzop" ;;
|
||||||
|
*.tar.xz | *.txz) preferred_commands="tar+xz unar 7za" ;;
|
||||||
|
*.tar.z | *.taz) preferred_commands="tar+gzip unar 7za" ;;
|
||||||
|
*.tar.zst | *.tzst) preferred_commands="tar+zstd" ;;
|
||||||
|
*.7z) preferred_commands="7za unar bsdtar" ;;
|
||||||
|
*.ace) preferred_commands="unar" ;;
|
||||||
|
*.alz) preferred_commands="unar" ;;
|
||||||
|
*.ar) preferred_commands="ar bsdtar" ;;
|
||||||
|
*.arc) preferred_commands="unar" ;;
|
||||||
|
*.arj) preferred_commands="unar" ;;
|
||||||
|
*.bz | *.bz2) preferred_commands="bzip2 unar 7za" ;;
|
||||||
|
*.cab) preferred_commands="unar" ;;
|
||||||
|
*.cpio) preferred_commands="cpio unar bsdtar" ;;
|
||||||
|
*.deb | *.udeb) preferred_commands="ar" ;;
|
||||||
|
*.gpg | *.asc | *.pgp) preferred_commands="gpg" ;;
|
||||||
|
*.gz) preferred_commands="gzip unar 7za" ;;
|
||||||
|
*.iso) preferred_commands="xorriso bsdtar" ;;
|
||||||
|
*.lrz) preferred_commands="lrzip" ;;
|
||||||
|
*.lz) preferred_commands="lzip" ;;
|
||||||
|
*.lz4) preferred_commands="lz4" ;;
|
||||||
|
*.lzh | *.lzs | *.lha) preferred_commands="lha unar" ;;
|
||||||
|
*.lzma) preferred_commands="xz unar" ;;
|
||||||
|
*.lzo) preferred_commands="lzop" ;;
|
||||||
|
*.msi) preferred_commands="unar" ;;
|
||||||
|
*.pak) preferred_commands="unar" ;;
|
||||||
|
*.rar) preferred_commands="unrar unar bsdtar" ;;
|
||||||
|
*.sit) preferred_commands="unar" ;;
|
||||||
|
*.sqsh | *.squashfs | *.sfs) preferred_commands="unsquashfs" ;;
|
||||||
|
*.tar | *.gtar | *.gem) preferred_commands="tar bsdtar unar 7za" ;;
|
||||||
|
*.xar) preferred_commands="unar bsdtar" ;;
|
||||||
|
*.xz) preferred_commands="xz unar 7za" ;;
|
||||||
|
*.z) preferred_commands="gzip unar" ;;
|
||||||
|
*.zip) preferred_commands="7za bsdtar unar unzip" ;;
|
||||||
|
*.zoo) preferred_commands="unar" ;;
|
||||||
|
*.zpaq) preferred_commands="zpaq" ;;
|
||||||
|
*.zst) preferred_commands="zstd" ;;
|
||||||
|
*) preferred_commands="bsdtar+unar+7za" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
local preferred_commands_array=()
|
||||||
|
IFS=" " read -r -a preferred_commands_array <<<"$preferred_commands"
|
||||||
|
|
||||||
|
if [[ "$command_status" == "default" ]]; then
|
||||||
|
# The default command is the first command of preferred commands.
|
||||||
|
command=${preferred_commands_array[0]}
|
||||||
|
elif [[ "$command_status" == "available" ]]; then
|
||||||
|
# Get the available command in the system.
|
||||||
|
local preferred_command=""
|
||||||
|
for preferred_command in "${preferred_commands_array[@]}"; do
|
||||||
|
if [[ "$preferred_command" == *"+"* ]]; then
|
||||||
|
if _all_commands_exists "${preferred_command//+/ }"; then
|
||||||
|
command=$preferred_command
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
elif _command_exists "$preferred_command"; then
|
||||||
|
command=$preferred_command
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "%s" "$command"
|
||||||
|
}
|
||||||
|
|
||||||
|
_run_command() {
|
||||||
|
local input_file=$1
|
||||||
|
local command=$2
|
||||||
|
local output_dir=$3
|
||||||
|
local exit_code=0
|
||||||
|
local filename=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
if [[ -z "$output_dir" ]]; then
|
||||||
|
output_dir=$(dirname -- "$input_file")
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Try to use the command '7z' instead of '7za'.
|
||||||
|
local command_7za="7za"
|
||||||
|
if [[ "$command" == *"7za"* ]]; then
|
||||||
|
_command_exists "7z" && command_7za="7z"
|
||||||
|
fi
|
||||||
|
|
||||||
|
filename=$(basename -- "$input_file") # Remove the path.
|
||||||
|
filename=$(_strip_filename_extension "$filename") # Remove the extension.
|
||||||
|
|
||||||
|
__temp_dir_cd() {
|
||||||
|
temp_dir_output=$(_get_temp_dir_local "$output_dir" "$filename")
|
||||||
|
pushd "$temp_dir_output" &>/dev/null || true
|
||||||
|
}
|
||||||
|
__temp_dir_exit() {
|
||||||
|
# Exit the temporary directory.
|
||||||
|
popd &>/dev/null || true
|
||||||
|
}
|
||||||
|
__temp_dir_remove() {
|
||||||
|
rm -rf -- "$temp_dir_output" &>/dev/null
|
||||||
|
}
|
||||||
|
__get_password() {
|
||||||
|
_display_password_box "Enter the password for the archive '$(basename -- "$input_file")'.\nPassword:"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Use a local temporary directory to work.
|
||||||
|
__temp_dir_cd
|
||||||
|
|
||||||
|
case "$command" in
|
||||||
|
"7za")
|
||||||
|
std_output=$($command_7za x -aoa -p"null" -- "$input_file" 2>&1)
|
||||||
|
exit_code=$?
|
||||||
|
|
||||||
|
if ((exit_code != 0)) && grep -i -q "wrong password" <<<"$std_output"; then
|
||||||
|
local password=""
|
||||||
|
__temp_dir_exit && __temp_dir_remove
|
||||||
|
password=$(__get_password) || exit 1
|
||||||
|
__temp_dir_cd
|
||||||
|
std_output=$($command_7za x -aoa -p"$password" -- "$input_file" 2>&1)
|
||||||
|
exit_code=$?
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"ar") std_output=$(ar x -- "$input_file" 2>&1) ;;
|
||||||
|
"bsdtar")
|
||||||
|
std_output=$(bsdtar --passphrase "null" -xf "$input_file" 2>&1)
|
||||||
|
exit_code=$?
|
||||||
|
|
||||||
|
if ((exit_code != 0)) && grep -i -q "incorrect passphrase" <<<"$std_output"; then
|
||||||
|
local password=""
|
||||||
|
__temp_dir_exit && __temp_dir_remove
|
||||||
|
password=$(__get_password) || exit 1
|
||||||
|
__temp_dir_cd
|
||||||
|
std_output=$(bsdtar --passphrase "$password" -xf "$input_file" 2>&1)
|
||||||
|
exit_code=$?
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"bzip2") std_output=$(bzip2 -d -c -k -- "$input_file" >"$filename") ;;
|
||||||
|
"cpio") std_output=$(cpio -idv <"$input_file" 2>&1) ;;
|
||||||
|
"gpg") std_output=$(gpg --batch --yes --decrypt --output "$filename" -- "$input_file" 2>&1) ;;
|
||||||
|
"gzip") std_output=$(gzip -d -c -k -- "$input_file" >"$filename") ;;
|
||||||
|
"lha") std_output=$(lha -e "$input_file" 2>&1) ;;
|
||||||
|
"lrzip") std_output=$(lrzip -d -o "$temp_dir_output/$filename" -- "$input_file" 2>&1) ;;
|
||||||
|
"lz4") std_output=$(lz4 -d -c -- "$input_file" >"$filename") ;;
|
||||||
|
"lzip") std_output=$(lzip -d -c -k -- "$input_file" >"$filename") ;;
|
||||||
|
"lzop") std_output=$(lzop -d -- "$input_file" 2>&1) ;;
|
||||||
|
"tar+bzip2") std_output=$(tar --extract --bzip2 --file="$input_file" 2>&1) ;;
|
||||||
|
"tar+gzip") std_output=$(tar --extract --gzip --file="$input_file" 2>&1) ;;
|
||||||
|
"tar+lrzip") std_output=$(lrztar -d "$input_file" 2>&1) ;;
|
||||||
|
"tar+lzip") std_output=$(tar --extract --lzip --file="$input_file" 2>&1) ;;
|
||||||
|
"tar+lz4") std_output=$(lz4 -d -c -- "$input_file" | tar xf -) ;;
|
||||||
|
"tar+lzma") std_output=$(tar --extract --lzma --file="$input_file" 2>&1) ;;
|
||||||
|
"tar+lzop") std_output=$(tar --extract --lzop --file="$input_file" 2>&1) ;;
|
||||||
|
"tar+xz") std_output=$(tar --extract --xz --file="$input_file" 2>&1) ;;
|
||||||
|
"tar+z") std_output=$(tar --extract --file="$input_file" 2>&1) ;;
|
||||||
|
"tar+zstd") std_output=$(zstd -f -d -c -- "$input_file" | tar xf -) ;;
|
||||||
|
"tar") std_output=$(tar --extract --file="$input_file" 2>&1) ;;
|
||||||
|
"unar")
|
||||||
|
std_output=$(unar -- "$input_file" 2>&1)
|
||||||
|
exit_code=$?
|
||||||
|
|
||||||
|
if ((exit_code != 0)) && grep -i -q "requires a password" <<<"$std_output"; then
|
||||||
|
local password=""
|
||||||
|
__temp_dir_exit && __temp_dir_remove
|
||||||
|
password=$(__get_password) || exit 1
|
||||||
|
__temp_dir_cd
|
||||||
|
std_output=$(unar -force-overwrite -password "$password" -- "$input_file" 2>&1)
|
||||||
|
exit_code=$?
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"unrar")
|
||||||
|
std_output=$(unrar x -p"null" -- "$input_file" 2>&1)
|
||||||
|
exit_code=$?
|
||||||
|
|
||||||
|
if ((exit_code != 0)) && grep -i -q "incorrect password for" <<<"$std_output"; then
|
||||||
|
local password=""
|
||||||
|
__temp_dir_exit && __temp_dir_remove
|
||||||
|
password=$(__get_password) || exit 1
|
||||||
|
__temp_dir_cd
|
||||||
|
std_output=$(unrar x -p"$password" -- "$input_file" 2>&1)
|
||||||
|
exit_code=$?
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"unsquashfs") std_output=$(unsquashfs "$input_file" 2>&1) ;;
|
||||||
|
"unzip")
|
||||||
|
std_output=$(unzip -P "null" -- "$input_file" 2>&1)
|
||||||
|
exit_code=$?
|
||||||
|
|
||||||
|
if ((exit_code != 0)) && grep -i -q "incorrect password" <<<"$std_output"; then
|
||||||
|
local password=""
|
||||||
|
__temp_dir_exit && __temp_dir_remove
|
||||||
|
password=$(__get_password) || exit 1
|
||||||
|
__temp_dir_cd
|
||||||
|
std_output=$(unzip -P "$password" -- "$input_file" 2>&1)
|
||||||
|
exit_code=$?
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"xorriso") std_output=$(xorriso -osirrox on -indev "$input_file" -- -extract / . -rollback_end 2>&1) ;;
|
||||||
|
"xz") std_output=$(xz -d -c -k -- "$input_file" >"$filename") ;;
|
||||||
|
"zpaq") std_output=$(zpaq x "$input_file" 2>&1) ;;
|
||||||
|
"zstd") std_output=$(zstd -d -c -- "$input_file" >"$filename") ;;
|
||||||
|
"bsdtar+unar+7za")
|
||||||
|
exit_code=1
|
||||||
|
|
||||||
|
# Try to extract with 'bsdtar'.
|
||||||
|
if ((exit_code != 0)); then
|
||||||
|
std_output=$(bsdtar -xf "$input_file" 2>&1)
|
||||||
|
exit_code=$?
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Try to extract with 'unar'.
|
||||||
|
if ((exit_code != 0)); then
|
||||||
|
std_output=$(unar -- "$input_file" 2>&1)
|
||||||
|
exit_code=$?
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Try to extract with '7za'.
|
||||||
|
if ((exit_code != 0)); then
|
||||||
|
std_output=$($command_7za x -aoa -- "$input_file" 2>&1)
|
||||||
|
exit_code=$?
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ((exit_code != 0)); then
|
||||||
|
std_output="Could not recognize the archive format."
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Check for result errors.
|
||||||
|
local exit_code_last=$?
|
||||||
|
if ((exit_code != 0)) || ((exit_code_last != 0)); then
|
||||||
|
_check_output "1" "$std_output" "$input_file" ""
|
||||||
|
|
||||||
|
# If all extracted files have zero bytes, then abort.
|
||||||
|
local non_zero_files=""
|
||||||
|
non_zero_files=$(find . -type f ! -size 0 2>/dev/null)
|
||||||
|
if [[ -z "$non_zero_files" ]]; then
|
||||||
|
__temp_dir_exit && __temp_dir_remove
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Fix permissions of extracted files in "iso" archive format.
|
||||||
|
if [[ "${input_file,,}" == *".iso" ]]; then
|
||||||
|
chmod --recursive u+rw -- .
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if the archive has just one item (single file/directory compressed).
|
||||||
|
local count_root_items=""
|
||||||
|
local single_root_item=""
|
||||||
|
count_root_items=$(find . -mindepth 1 -maxdepth 1 2>/dev/null | wc -l)
|
||||||
|
if ((count_root_items == 1)); then
|
||||||
|
single_root_item=$(find . -mindepth 1 -maxdepth 1 2>/dev/null)
|
||||||
|
single_root_item="${single_root_item#./}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if the 'temp_dir_output' is empty.
|
||||||
|
if ((count_root_items == 0)); then
|
||||||
|
__temp_dir_exit && __temp_dir_remove
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
__temp_dir_exit
|
||||||
|
|
||||||
|
# Move the items to the correct directory.
|
||||||
|
if [[ "$single_root_item" == "$filename" ]] || [[ "$(_strip_filename_extension "$single_root_item")" == "$filename" ]]; then
|
||||||
|
# For archives with "one item with the same name of the archive".
|
||||||
|
# For example: "README.txt.tar.gz" or "README.tar.gz".
|
||||||
|
std_output=$(_move_file "rename" "$temp_dir_output/$single_root_item" "$output_dir/$single_root_item" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" ""
|
||||||
|
elif [[ "$single_root_item" == "squashfs-root" ]] && [[ "$command" == "unsquashfs" ]]; then
|
||||||
|
# For the "squashfs" archive format.
|
||||||
|
std_output=$(_move_file "rename" "$temp_dir_output/$single_root_item" "$output_dir/$filename" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" ""
|
||||||
|
else
|
||||||
|
# For archives with "one item with a different name of the archive" or "multiple items".
|
||||||
|
std_output=$(_move_file "rename" "$temp_dir_output" "$output_dir/$filename" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
__temp_dir_remove
|
||||||
|
}
|
||||||
|
|
||||||
|
_all_commands_exists() {
|
||||||
|
local commands=$1
|
||||||
|
|
||||||
|
local command=""
|
||||||
|
local commands_array=()
|
||||||
|
IFS=" " read -r -a commands_array <<<"$commands"
|
||||||
|
|
||||||
|
for command in "${commands_array[@]}"; do
|
||||||
|
if ! _command_exists "$command"; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "command=mp3gain"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_recursive=true; par_select_mime=audio/mpeg; par_skip_extension=bak")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box ""
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
local temp_file=""
|
||||||
|
|
||||||
|
# Work on a temporary file.
|
||||||
|
temp_file=$(_get_temp_file)
|
||||||
|
std_output=$(cp --archive -- "$input_file" "$temp_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "" || return 1
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
std_output=$(mp3gain -q -r -s s -m 100 -k "$temp_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "" || return 1
|
||||||
|
|
||||||
|
# Move the temporary file to the output.
|
||||||
|
output_file=$input_file
|
||||||
|
_move_temp_file_to_output "$input_file" "$temp_file" "$output_file"
|
||||||
|
|
||||||
|
# Remove the temporary files on each iteration (if not removed before).
|
||||||
|
rm -f -- "$temp_file"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "command=mp3gain"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_recursive=true; par_select_mime=audio/mpeg; par_skip_extension=bak")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box ""
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
local temp_file=""
|
||||||
|
|
||||||
|
# Work on a temporary file.
|
||||||
|
temp_file=$(_get_temp_file)
|
||||||
|
std_output=$(cp --archive -- "$input_file" "$temp_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "" || return 1
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
std_output=$(mp3gain -q -r -s s -c "$temp_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "" || return 1
|
||||||
|
|
||||||
|
# Move the temporary file to the output.
|
||||||
|
output_file=$input_file
|
||||||
|
_move_temp_file_to_output "$input_file" "$temp_file" "$output_file"
|
||||||
|
|
||||||
|
# Remove the temporary files on each iteration (if not removed before).
|
||||||
|
rm -f -- "$temp_file"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+56
@@ -0,0 +1,56 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "command=mediainfo"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_recursive=true; par_select_mime=audio/mpeg; par_skip_extension=bak")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
|
||||||
|
local std_output=""
|
||||||
|
std_output=$(_storage_text_read_all)
|
||||||
|
std_output=$(_text_sort "$std_output")
|
||||||
|
|
||||||
|
_display_list_box "$std_output" "--column=Artist;--column=Title;--column=File"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
std_output=$(mediainfo -- "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "" || return 1
|
||||||
|
# shellcheck disable=SC2001
|
||||||
|
std_output=$(tr -s " " <<<"$std_output")
|
||||||
|
# shellcheck disable=SC2001
|
||||||
|
std_output=$(sed "s|: |$FIELD_SEPARATOR|" <<<"$std_output")
|
||||||
|
|
||||||
|
local tag_artist=""
|
||||||
|
local tag_title=""
|
||||||
|
tag_artist=$(grep -m1 "^Performer $FIELD_SEPARATOR" <<<"$std_output" | cut -d "$FIELD_SEPARATOR" -f 2)
|
||||||
|
tag_title=$(grep -m1 "^Track name $FIELD_SEPARATOR" <<<"$std_output" | cut -d "$FIELD_SEPARATOR" -f 2)
|
||||||
|
|
||||||
|
# Check if the values are not empty.
|
||||||
|
if [[ -z "$tag_artist" ]]; then
|
||||||
|
tag_artist="(empty)"
|
||||||
|
fi
|
||||||
|
if [[ -z "$tag_title" ]]; then
|
||||||
|
tag_title="(empty)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
_storage_text_write_ln "$tag_artist$FIELD_SEPARATOR$tag_title$FIELD_SEPARATOR$(_text_remove_pwd "$input_file")"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+70
@@ -0,0 +1,70 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "command=mediainfo"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_recursive=true; par_select_mime=audio/mpeg; par_skip_extension=bak")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
|
||||||
|
local std_output=""
|
||||||
|
std_output=$(_storage_text_read_all)
|
||||||
|
std_output=$(_text_sort "$std_output")
|
||||||
|
|
||||||
|
_display_list_box "$std_output" "--column=Mode;--column=Bit rate;--column=Sampling rate;--column=Channels;--column=File"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
std_output=$(mediainfo -- "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "" || return 1
|
||||||
|
# shellcheck disable=SC2001
|
||||||
|
std_output=$(tr -s " " <<<"$std_output")
|
||||||
|
# shellcheck disable=SC2001
|
||||||
|
std_output=$(sed "s|: |$FIELD_SEPARATOR|" <<<"$std_output")
|
||||||
|
|
||||||
|
local mode=""
|
||||||
|
local bit_rate=""
|
||||||
|
local sampling_rate=""
|
||||||
|
local channels=""
|
||||||
|
mode=$(grep -m1 "^Overall bit rate mode $FIELD_SEPARATOR" <<<"$std_output" | cut -d "$FIELD_SEPARATOR" -f 2)
|
||||||
|
bit_rate=$(grep -m1 "^Overall bit rate $FIELD_SEPARATOR" <<<"$std_output" | cut -d "$FIELD_SEPARATOR" -f 2)
|
||||||
|
sampling_rate=$(grep -m1 "^Sampling rate $FIELD_SEPARATOR" <<<"$std_output" | cut -d "$FIELD_SEPARATOR" -f 2)
|
||||||
|
channels=$(grep -m1 "^Channel(s) $FIELD_SEPARATOR" <<<"$std_output" | cut -d "$FIELD_SEPARATOR" -f 2)
|
||||||
|
|
||||||
|
# Check if the values are not empty.
|
||||||
|
if [[ -z "$mode" ]]; then
|
||||||
|
mode="(empty)"
|
||||||
|
elif [[ "${mode,,}" == "constant" ]]; then
|
||||||
|
mode="CBR"
|
||||||
|
elif [[ "${mode,,}" == "variable" ]]; then
|
||||||
|
mode="VBR"
|
||||||
|
fi
|
||||||
|
if [[ -z "$bit_rate" ]]; then
|
||||||
|
bit_rate="(empty)"
|
||||||
|
fi
|
||||||
|
if [[ -z "$sampling_rate" ]]; then
|
||||||
|
sampling_rate="(empty)"
|
||||||
|
fi
|
||||||
|
if [[ -z "$channels" ]]; then
|
||||||
|
channels="(empty)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
_storage_text_write_ln "$mode$FIELD_SEPARATOR$bit_rate$FIELD_SEPARATOR$sampling_rate$FIELD_SEPARATOR$channels$FIELD_SEPARATOR$(_text_remove_pwd "$input_file")"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "command=mp3val"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_recursive=true; par_select_mime=audio/mpeg; par_skip_extension=bak")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box ""
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
local temp_file=""
|
||||||
|
|
||||||
|
# Work on a temporary file.
|
||||||
|
temp_file=$(_get_temp_file)
|
||||||
|
std_output=$(cp --archive -- "$input_file" "$temp_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "" || return 1
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
std_output=$(mp3val -si -f "$temp_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "" || return 1
|
||||||
|
|
||||||
|
# Move the temporary file to the output.
|
||||||
|
output_file=$input_file
|
||||||
|
_move_temp_file_to_output "$input_file" "$temp_file" "$output_file"
|
||||||
|
|
||||||
|
# Remove the temporary files on each iteration (if not removed before).
|
||||||
|
rm -f -- "$temp_file"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+59
@@ -0,0 +1,59 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "command=mediainfo"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_recursive=true; par_select_mime=audio/mpeg; par_skip_extension=bak")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box ""
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
std_output=$(mediainfo -- "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "" || return 1
|
||||||
|
# shellcheck disable=SC2001
|
||||||
|
std_output=$(tr -s " " <<<"$std_output")
|
||||||
|
# shellcheck disable=SC2001
|
||||||
|
std_output=$(sed "s|: |$FIELD_SEPARATOR|" <<<"$std_output")
|
||||||
|
|
||||||
|
local tag_artist=""
|
||||||
|
local tag_title=""
|
||||||
|
tag_artist=$(grep -m1 "^Performer $FIELD_SEPARATOR" <<<"$std_output" | cut -d "$FIELD_SEPARATOR" -f 2)
|
||||||
|
tag_title=$(grep -m1 "^Track name $FIELD_SEPARATOR" <<<"$std_output" | cut -d "$FIELD_SEPARATOR" -f 2)
|
||||||
|
|
||||||
|
# Check if the values are not empty.
|
||||||
|
if [[ -z "$tag_artist" ]]; then
|
||||||
|
_check_output "1" "Empty 'Artist' value." "$input_file" "" || return 1
|
||||||
|
fi
|
||||||
|
if [[ -z "$tag_title" ]]; then
|
||||||
|
_check_output "1" "Empty 'Title' value." "$input_file" "" || return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Rename the file.
|
||||||
|
local dir_file=""
|
||||||
|
dir_file=$(_get_filename_dir "$input_file")
|
||||||
|
std_output=$(_move_file "rename" "$input_file" "$dir_file/$tag_artist - $tag_title.mp3" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" ""
|
||||||
|
|
||||||
|
# Remove the temporary files on each iteration (if not removed before).
|
||||||
|
rm -f -- "$temp_file"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+70
@@ -0,0 +1,70 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "command=id3v2"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_recursive=true; par_select_mime=audio/mpeg; par_skip_extension=bak")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box ""
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Work on a temporary file.
|
||||||
|
local temp_file=""
|
||||||
|
temp_file=$(_get_temp_file)
|
||||||
|
std_output=$(cp --archive -- "$input_file" "$temp_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "" || return 1
|
||||||
|
|
||||||
|
local basename=""
|
||||||
|
basename=$(basename -- "$input_file")
|
||||||
|
basename=$(_strip_filename_extension "$basename")
|
||||||
|
basename=$(tr -s " " <<<"$basename")
|
||||||
|
# shellcheck disable=SC2001
|
||||||
|
basename=$(sed "s| - |$FIELD_SEPARATOR|" <<<"$basename")
|
||||||
|
|
||||||
|
local audio_artist=""
|
||||||
|
local audio_title=""
|
||||||
|
audio_artist=$(cut -d "$FIELD_SEPARATOR" -f 1 <<<"$basename")
|
||||||
|
audio_title=$(cut -d "$FIELD_SEPARATOR" -f 2- <<<"$basename")
|
||||||
|
|
||||||
|
# Check if the values are not empty.
|
||||||
|
if [[ -z "$audio_artist" ]]; then
|
||||||
|
_check_output "1" "Empty 'Artist' value." "$input_file" "" || return 1
|
||||||
|
fi
|
||||||
|
if [[ -z "$audio_title" ]]; then
|
||||||
|
_check_output "1" "Empty 'Title' value." "$input_file" "" || return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
std_output=$(id3v2 --artist "$audio_artist" --song "$audio_title" "$temp_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "" || return 1
|
||||||
|
|
||||||
|
# Strip id3v1 tags.
|
||||||
|
std_output=$(id3v2 --delete-v1 "$temp_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "" || return 1
|
||||||
|
|
||||||
|
# Move the temporary file to the output.
|
||||||
|
output_file=$input_file
|
||||||
|
_move_temp_file_to_output "$input_file" "$temp_file" "$output_file"
|
||||||
|
|
||||||
|
# Remove the temporary files on each iteration (if not removed before).
|
||||||
|
rm -f -- "$temp_file"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=ffmpeg; pkg_manager=apt; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free |
|
||||||
|
command=ffmpeg; pkg_manager=pacman; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=zypper; package=ffmpeg"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime='audio/|video/'; par_min_items=2; par_sort_list=true")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=true")
|
||||||
|
|
||||||
|
_main_task "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_files=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Create the input list for the 'ffmpeg'.
|
||||||
|
local temp_file=""
|
||||||
|
temp_file=$(_get_temp_file)
|
||||||
|
input_files="file '$input_files'"
|
||||||
|
# shellcheck disable=SC2001
|
||||||
|
input_files=$(sed "s|$FIELD_SEPARATOR|'${FIELD_SEPARATOR}file '|g" <<<"$input_files")
|
||||||
|
_convert_filenames_to_text "$input_files" >"$temp_file"
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "Concatenated audio.wav" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(ffmpeg -hide_banner -y -f "concat" -safe 0 -i "$temp_file" -- "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=ffmpeg; pkg_manager=apt; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free |
|
||||||
|
command=ffmpeg; pkg_manager=pacman; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=zypper; package=ffmpeg"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime='audio/|video/'; par_validate_conflict=true")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=true")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=flac")
|
||||||
|
std_output=$(ffmpeg -hide_banner -y -i "$input_file" -vn -ac 2 -- "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=ffmpeg; pkg_manager=apt; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free |
|
||||||
|
command=ffmpeg; pkg_manager=pacman; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=zypper; package=ffmpeg"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime='audio/|video/'; par_validate_conflict=true")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=true")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=mp3")
|
||||||
|
std_output=$(ffmpeg -hide_banner -y -i "$input_file" -vn -c:a libmp3lame -b:a 192k -ac 2 -- "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=ffmpeg; pkg_manager=apt; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free |
|
||||||
|
command=ffmpeg; pkg_manager=pacman; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=zypper; package=ffmpeg"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime='audio/|video/'; par_validate_conflict=true")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=true")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=mp3")
|
||||||
|
std_output=$(ffmpeg -hide_banner -y -i "$input_file" -vn -c:a libmp3lame -b:a 320k -ac 2 -- "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=ffmpeg; pkg_manager=apt; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free |
|
||||||
|
command=ffmpeg; pkg_manager=pacman; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=zypper; package=ffmpeg"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime='audio/|video/'; par_validate_conflict=true")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=true")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=mp3")
|
||||||
|
std_output=$(ffmpeg -hide_banner -y -i "$input_file" -vn -c:a libmp3lame -b:a 48k -ac 1 -- "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=ffmpeg; pkg_manager=apt; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free |
|
||||||
|
command=ffmpeg; pkg_manager=pacman; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=zypper; package=ffmpeg"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime='audio/|video/'; par_validate_conflict=true")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=true")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=ogg")
|
||||||
|
std_output=$(ffmpeg -hide_banner -y -i "$input_file" -vn -ac 2 -- "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=ffmpeg; pkg_manager=apt; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free |
|
||||||
|
command=ffmpeg; pkg_manager=pacman; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=zypper; package=ffmpeg"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime='audio/|video/'; par_validate_conflict=true")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=true")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=wav")
|
||||||
|
std_output=$(ffmpeg -hide_banner -y -i "$input_file" -vn -ac 2 -- "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=ffmpeg; pkg_manager=apt; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free |
|
||||||
|
command=ffmpeg; pkg_manager=pacman; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=zypper; package=ffmpeg"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime='audio/|video/'")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(ffmpeg -hide_banner -y -i "$input_file" -filter:a "afade=d=10" -- "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=ffmpeg; pkg_manager=apt; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free |
|
||||||
|
command=ffmpeg; pkg_manager=pacman; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=zypper; package=ffmpeg"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime='audio/|video/'")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(ffmpeg -hide_banner -y -i "$input_file" -filter:a "areverse, afade=d=10, areverse" -- "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=ffmpeg; pkg_manager=apt; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free |
|
||||||
|
command=ffmpeg; pkg_manager=pacman; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=zypper; package=ffmpeg"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime='audio/|video/'")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(ffmpeg -hide_banner -y -i "$input_file" -filter:a "compand=attacks=0:points=-80/-115|-30.1/-80|-30/-30|20/20" -- "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=ffmpeg; pkg_manager=apt; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free |
|
||||||
|
command=ffmpeg; pkg_manager=pacman; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=zypper; package=ffmpeg"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime='audio/|video/'")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(ffmpeg -hide_banner -y -i "$input_file" -filter:a "loudnorm" -- "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=ffmpeg; pkg_manager=apt; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free |
|
||||||
|
command=ffmpeg; pkg_manager=pacman; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=zypper; package=ffmpeg"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime='audio/|video/'")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(ffmpeg -hide_banner -y -i "$input_file" -filter:a "silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-30dB" -- "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+67
@@ -0,0 +1,67 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=sox |
|
||||||
|
pkg_manager=apt; package=libsox-fmt-mp3"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_recursive=true; par_select_mime='audio/|video/'")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
|
||||||
|
local std_output=""
|
||||||
|
std_output=$(_storage_text_read_all)
|
||||||
|
std_output=$(_text_sort "$std_output")
|
||||||
|
|
||||||
|
_display_list_box "$std_output" "--column=Status;--column=File"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
std_output=$(sox "$input_file" -n remix 1 sinc "19k-20k" -m stat 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" ""
|
||||||
|
|
||||||
|
std_output=$(grep "^Mean.*norm" <<<"$std_output")
|
||||||
|
std_output=$(cut -d ":" -f 2 <<<"$std_output")
|
||||||
|
std_output=$(tr -d " " <<<"$std_output")
|
||||||
|
|
||||||
|
local status="[excellent quality]"
|
||||||
|
if [[ -z "$std_output" ]]; then
|
||||||
|
status="[poor quality]"
|
||||||
|
elif [[ "$std_output" == "0.00000"* ]]; then
|
||||||
|
status="[medium quality]"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$status" == "[medium quality]" ]]; then
|
||||||
|
std_output=$(sox "$input_file" -n remix 1 sinc "17k-18k" -m stat 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" ""
|
||||||
|
|
||||||
|
std_output=$(grep "^Mean.*norm" <<<"$std_output")
|
||||||
|
std_output=$(cut -d ":" -f 2 <<<"$std_output")
|
||||||
|
std_output=$(tr -d " " <<<"$std_output")
|
||||||
|
|
||||||
|
if [[ -z "$std_output" ]]; then
|
||||||
|
status="[poor quality]"
|
||||||
|
elif [[ "$std_output" == "0.00000"* ]]; then
|
||||||
|
status="[poor quality]"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
_storage_text_write_ln "$status$FIELD_SEPARATOR$(_text_remove_pwd "$input_file")"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=ffmpeg; pkg_manager=apt; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free |
|
||||||
|
command=ffmpeg; pkg_manager=pacman; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=zypper; package=ffmpeg"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime='audio/|video/'")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(ffmpeg -hide_banner -y -i "$input_file" -ac 1 -- "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=ffmpeg; pkg_manager=apt; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free |
|
||||||
|
command=ffmpeg; pkg_manager=pacman; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=zypper; package=ffmpeg"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime='audio/|video/'; par_min_items=2; par_max_items=2; par_sort_list=true")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=true")
|
||||||
|
|
||||||
|
_main_task "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_files=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
local file_1=""
|
||||||
|
local file_2=""
|
||||||
|
|
||||||
|
file_1=$(cut -d "$FIELD_SEPARATOR" -f 1 <<<"$input_files")
|
||||||
|
file_2=$(cut -d "$FIELD_SEPARATOR" -f 2 <<<"$input_files")
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "Mixed audio.wav" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(ffmpeg -hide_banner -y -i "$file_1" -i "$file_2" -filter_complex "amix=inputs=2:duration=longest" -- "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=sox |
|
||||||
|
pkg_manager=apt; package=libsox-fmt-mp3"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime='audio/|video/'")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=true")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=png")
|
||||||
|
std_output=$(sox "$input_file" -n "spectrogram" -c "" -o "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=ffmpeg; pkg_manager=apt; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free |
|
||||||
|
command=ffmpeg; pkg_manager=pacman; package=ffmpeg |
|
||||||
|
command=ffmpeg; pkg_manager=zypper; package=ffmpeg"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_recursive=true; par_select_mime='audio/|video/'; par_skip_extension=bak")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box ""
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
local temp_file=""
|
||||||
|
|
||||||
|
# Work on a temporary file.
|
||||||
|
temp_file=$(_get_temp_file)$(_get_filename_extension "$input_file")
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
std_output=$(ffmpeg -hide_banner -y -i "$input_file" -map_metadata -1 -vn -c:a copy -- "$temp_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "" || return 1
|
||||||
|
|
||||||
|
# Move the temporary file to the output.
|
||||||
|
output_file=$input_file
|
||||||
|
_move_temp_file_to_output "$input_file" "$temp_file" "$output_file"
|
||||||
|
|
||||||
|
# Remove the temporary files on each iteration (if not removed before).
|
||||||
|
rm -f -- "$temp_file"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,240 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# install_keyboard_shortcut=<Control><Shift>C
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies ""
|
||||||
|
input_files=$(_get_files "par_type=all; par_min_items=2; par_max_items=3; par_sort_list=true")
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
_compare "$input_files"
|
||||||
|
}
|
||||||
|
|
||||||
|
_compare() {
|
||||||
|
local input_files=$1
|
||||||
|
|
||||||
|
local file_1=""
|
||||||
|
local file_2=""
|
||||||
|
local file_3=""
|
||||||
|
file_1=$(cut -d "$FIELD_SEPARATOR" -f 1 <<<"$input_files")
|
||||||
|
file_2=$(cut -d "$FIELD_SEPARATOR" -f 2 <<<"$input_files")
|
||||||
|
file_3=$(cut -d "$FIELD_SEPARATOR" -f 3 <<<"$input_files")
|
||||||
|
|
||||||
|
# Check if the items (directories or files) are identical.
|
||||||
|
local diff_1_2=""
|
||||||
|
local diff_1_3=""
|
||||||
|
diff_1_2=$(diff --brief --recursive -- "$file_1" "$file_2" 2>&1)
|
||||||
|
if [[ -z "$file_3" ]]; then
|
||||||
|
if [[ -z "$diff_1_2" ]]; then
|
||||||
|
_display_info_box "The two selected items are identical."
|
||||||
|
_exit_script
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
diff_1_3=$(diff --brief --recursive -- "$file_1" "$file_3" 2>&1)
|
||||||
|
if [[ -z "$diff_1_2" ]] && [[ -z "$diff_1_3" ]]; then
|
||||||
|
_display_info_box "The three selected items are identical."
|
||||||
|
_exit_script
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Define the command to execute according to file MIME type.
|
||||||
|
local command=""
|
||||||
|
local file_1_mime=""
|
||||||
|
file_1_mime=$(_get_file_mime "$file_1")
|
||||||
|
case $file_1_mime in
|
||||||
|
"application/pdf") command="diffpdf" ;;
|
||||||
|
"inode/directory") command="meld" ;;
|
||||||
|
"inode/x-empty") command="meld" ;;
|
||||||
|
"image/"*) command="compare" ;;
|
||||||
|
"text/"*) command="meld" ;;
|
||||||
|
*)
|
||||||
|
local file_1_encoding=""
|
||||||
|
file_1_encoding=$(_get_file_encoding "$file_1")
|
||||||
|
if [[ "$file_1_encoding" == "binary" ]]; then
|
||||||
|
command="meld_hexadecimal"
|
||||||
|
else
|
||||||
|
command="meld"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [[ "$command" == "meld"* ]]; then
|
||||||
|
case "${XDG_CURRENT_DESKTOP,,}" in
|
||||||
|
*"kde"* | *"lxqt"*)
|
||||||
|
command=${command//meld/kdiff3}
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check dependencies for the command.
|
||||||
|
local dependencies=""
|
||||||
|
case $command in
|
||||||
|
"compare") dependencies="
|
||||||
|
command=compare; pkg_manager=apt; package=imagemagick |
|
||||||
|
command=compare; pkg_manager=dnf; package=ImageMagick |
|
||||||
|
command=compare; pkg_manager=pacman; package=imagemagick |
|
||||||
|
command=compare; pkg_manager=zypper; package=ImageMagick |
|
||||||
|
command=xdg-open; package=xdg-utils" ;;
|
||||||
|
"diffpdf") dependencies="command=diffpdf" ;;
|
||||||
|
"kdiff3") dependencies="command=kdiff3" ;;
|
||||||
|
"kdiff3_hexadecimal") dependencies="command=kdiff3 | command=xxd" ;;
|
||||||
|
"meld") dependencies="command=meld" ;;
|
||||||
|
"meld_hexadecimal") dependencies="command=meld | command=xxd" ;;
|
||||||
|
esac
|
||||||
|
_check_dependencies "$dependencies"
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
case $command in
|
||||||
|
"compare")
|
||||||
|
if [[ -n "$file_3" ]]; then
|
||||||
|
_display_error_box "You must select only two image files to compare!"
|
||||||
|
_exit_script
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if both images have the same pixel values.
|
||||||
|
local pixel_error=""
|
||||||
|
pixel_error=$(compare -metric AE -- "$file_1" "$file_2" null: 2>&1)
|
||||||
|
if [[ "$pixel_error" == "0" ]]; then
|
||||||
|
_display_info_box "The two selected images are identical (same pixel values)."
|
||||||
|
_exit_script
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get image dimensions.
|
||||||
|
local dimensions_1=""
|
||||||
|
local dimensions_2=""
|
||||||
|
dimensions_1=$(identify -format "%wx%h" "$file_1")
|
||||||
|
dimensions_2=$(identify -format "%wx%h" "$file_2")
|
||||||
|
|
||||||
|
# Compare two images using a visual diff with the 'convert' command.
|
||||||
|
local temp_file=""
|
||||||
|
temp_file="$(_get_temp_file_dry).png"
|
||||||
|
if [[ "$dimensions_1" == "$dimensions_2" ]]; then
|
||||||
|
# Compare images with the same dimensions.
|
||||||
|
convert \
|
||||||
|
'(' "$file_1" -flatten -grayscale Rec709Luminance ')' \
|
||||||
|
'(' "$file_2" -flatten -grayscale Rec709Luminance ')' \
|
||||||
|
'(' -clone 0-1 -compose darken -composite ')' \
|
||||||
|
-channel RGB -combine "$temp_file"
|
||||||
|
else
|
||||||
|
# Compare images with different dimensions.
|
||||||
|
compare "$file_1" "$file_2" -compose src "$temp_file"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get the installed image viewer.
|
||||||
|
local image_viewer=""
|
||||||
|
image_viewer=$(_xdg_get_default_app "image/jpeg")
|
||||||
|
if [[ "$image_viewer" == *"eog" ]]; then
|
||||||
|
$image_viewer --new-instance -- "$temp_file"
|
||||||
|
else
|
||||||
|
$image_viewer -- "$temp_file"
|
||||||
|
fi
|
||||||
|
|
||||||
|
;;
|
||||||
|
"diffpdf")
|
||||||
|
if [[ -n "$file_3" ]]; then
|
||||||
|
_display_error_box "You must select only two PDFs to compare!"
|
||||||
|
_exit_script
|
||||||
|
fi
|
||||||
|
|
||||||
|
diffpdf -- "$file_1" "$file_2" &
|
||||||
|
;;
|
||||||
|
"meld" | "kdiff3")
|
||||||
|
if [[ -z "$file_3" ]]; then
|
||||||
|
$command -- "$file_1" "$file_2" &
|
||||||
|
else
|
||||||
|
$command -- "$file_1" "$file_2" "$file_3" &
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"meld_hexadecimal" | "kdiff3_hexadecimal")
|
||||||
|
if [[ -n "$file_3" ]]; then
|
||||||
|
_display_error_box "You must select only two files to hexadecimal compare!"
|
||||||
|
_exit_script
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Remove the prefix '_hexadecimal'.
|
||||||
|
command=${command//_hexadecimal/}
|
||||||
|
|
||||||
|
# Get the file sizes.
|
||||||
|
local file_1_size=""
|
||||||
|
local file_2_size=""
|
||||||
|
local size_difference=0
|
||||||
|
file_1_size=$(_get_file_size "$file_1")
|
||||||
|
file_2_size=$(_get_file_size "$file_2")
|
||||||
|
size_difference=$(_get_difference "$file_1_size" "$file_2_size")
|
||||||
|
|
||||||
|
# If the files have different sizes,
|
||||||
|
# compute a column width for better comparison.
|
||||||
|
local cols=24
|
||||||
|
if ((size_difference != 0)); then
|
||||||
|
cols=$(_get_ideal_cols "$size_difference")
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Convert files to hexadecimal text view.
|
||||||
|
local file_1_hex=""
|
||||||
|
local file_2_hex=""
|
||||||
|
file_1_hex="$TEMP_DIR_TASK/$(basename -- "$file_1")"
|
||||||
|
file_2_hex="$TEMP_DIR_TASK/$(basename -- "$file_2")"
|
||||||
|
xxd -c "$cols" "$file_1" "$file_1_hex"
|
||||||
|
xxd -c "$cols" "$file_2" "$file_2_hex"
|
||||||
|
|
||||||
|
# Remove the addresses for better comparison.
|
||||||
|
sed -i "s|^[^:]*: ||g" "$file_1_hex"
|
||||||
|
sed -i "s|^[^:]*: ||g" "$file_2_hex"
|
||||||
|
|
||||||
|
# Compare and edit the files.
|
||||||
|
$command -- "$file_1_hex" "$file_2_hex"
|
||||||
|
|
||||||
|
# Convert to plain hexadecimal dump.
|
||||||
|
sed -i "s| .*||g; s| ||g" "$file_1_hex"
|
||||||
|
sed -i "s| .*||g; s| ||g" "$file_2_hex"
|
||||||
|
|
||||||
|
# Save the files after possible modifications.
|
||||||
|
local file_1_modified="$file_1_hex.bin"
|
||||||
|
local file_2_modified="$file_2_hex.bin"
|
||||||
|
xxd -revert -plain "$file_1_hex" "$file_1_modified"
|
||||||
|
xxd -revert -plain "$file_2_hex" "$file_2_modified"
|
||||||
|
_move_temp_file_to_output "$file_1" "$file_1_modified" "$file_1"
|
||||||
|
_move_temp_file_to_output "$file_2" "$file_2_modified" "$file_2"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_get_ideal_cols() {
|
||||||
|
local size_difference=$1
|
||||||
|
local cols=24
|
||||||
|
|
||||||
|
local i=0
|
||||||
|
for ((i = 23; i >= 5; i--)); do
|
||||||
|
if ((size_difference % i == 0)); then
|
||||||
|
cols=$i
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
printf "%s" "$cols"
|
||||||
|
}
|
||||||
|
|
||||||
|
_get_difference() {
|
||||||
|
local num_1=$1
|
||||||
|
local num_2=$2
|
||||||
|
|
||||||
|
# Calculate the positive difference.
|
||||||
|
if ((num_1 > num_2)); then
|
||||||
|
printf "%s" "$((num_1 - num_2))"
|
||||||
|
else
|
||||||
|
printf "%s" "$((num_2 - num_1))"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
_get_file_size() {
|
||||||
|
stat --format="%s" "$1" 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies ""
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=all; par_min_items=2; par_max_items=2; par_sort_list=true")
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
local file_1=""
|
||||||
|
local file_2=""
|
||||||
|
|
||||||
|
file_1=$(cut -d "$FIELD_SEPARATOR" -f 1 <<<"$input_files")
|
||||||
|
file_2=$(cut -d "$FIELD_SEPARATOR" -f 2 <<<"$input_files")
|
||||||
|
|
||||||
|
[[ -d "$file_1" ]] && file_1+="/"
|
||||||
|
[[ -d "$file_2" ]] && file_2+="/"
|
||||||
|
|
||||||
|
std_output=$(diff --no-dereference --brief --recursive -- "$file_1" "$file_2" 2>&1)
|
||||||
|
std_output=$(_text_remove_pwd "$std_output")
|
||||||
|
std_output=$(_text_sort "$std_output")
|
||||||
|
|
||||||
|
if [[ -z "$std_output" ]]; then
|
||||||
|
std_output="(No differences)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
_display_text_box "$std_output"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+35
@@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies ""
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=true")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve; par_prefix='Hard link to'")
|
||||||
|
std_output=$(ln -- "$input_file" "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+35
@@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies ""
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=all")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=true")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve; par_prefix='Link to'")
|
||||||
|
std_output=$(ln -s -- "$input_file" "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# shellcheck disable=SC2001
|
||||||
|
# install_keyboard_shortcut=<Control><Shift>U
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local std_output=""
|
||||||
|
local temp_file=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "command=rdfind"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=all; par_get_pwd=true")
|
||||||
|
|
||||||
|
# Work on a temporary file.
|
||||||
|
temp_file=$(_get_temp_file)
|
||||||
|
|
||||||
|
# NOTE: The 'rdfind' does not support ' -- ' in the command line.
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
rdfind -dryrun true -removeidentinode false -outputname "$temp_file" $input_files &>/dev/null
|
||||||
|
std_output=$(grep "DUPTYPE" <"$temp_file")
|
||||||
|
std_output=$(sed "s|DUPTYPE_FIRST_OCCURRENCE|\nDUPTYPE_FIRST_OCCURRENCE|" <<<"$std_output")
|
||||||
|
std_output=$(cut -d ' ' -f 8- <<<"$std_output")
|
||||||
|
std_output=$(grep -v "/\.git/" <<<"$std_output")
|
||||||
|
std_output=$(sed -z "s|^\n*\([^\n]\)|\1|g; s|\n\{3,\}|\n\n|g" <<<"$std_output")
|
||||||
|
std_output=$(_text_remove_pwd "$std_output")
|
||||||
|
std_output=$(sed "s|//|/|" <<<"$std_output")
|
||||||
|
std_output=$(sed "s|^\(..*\)$|'\1'|" <<<"$std_output")
|
||||||
|
|
||||||
|
# Print a string in each group of duplicate files.
|
||||||
|
if [[ -n "$std_output" ]]; then
|
||||||
|
local msg_duplicate="Duplicate files:"
|
||||||
|
std_output="$msg_duplicate"$'\n'"$std_output"
|
||||||
|
std_output=$(sed -z "s|\n\n|\n\n$msg_duplicate\n|g" <<<"$std_output")
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f -- "$temp_file"
|
||||||
|
|
||||||
|
_display_text_box "$std_output"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# install_keyboard_shortcut=<Control><Shift>E
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies ""
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=directory; par_get_pwd=true")
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
std_output=$(find $input_files -type d -empty ! -path "$IGNORE_FIND_PATH" -printf "%p\n" 2>/dev/null)
|
||||||
|
std_output=$(_text_remove_pwd "$std_output")
|
||||||
|
|
||||||
|
_display_list_box "$std_output" "--column=Directory"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# install_keyboard_shortcut=<Control><Shift>Y
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies ""
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_recursive=true; par_get_pwd=true")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
|
||||||
|
local std_output=""
|
||||||
|
std_output=$(_storage_text_read_all)
|
||||||
|
std_output=$(_text_sort "$std_output")
|
||||||
|
|
||||||
|
_display_text_box "$std_output"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
std_output=$(file --separator "$FIELD_SEPARATOR" --no-pad -- "$input_file")
|
||||||
|
std_output=$(_text_remove_pwd "$std_output")
|
||||||
|
# shellcheck disable=SC2001
|
||||||
|
std_output=$(sed "s|\(.*\)$FIELD_SEPARATOR *\(.*\)|\2: '\1'|" <<<"$std_output")
|
||||||
|
|
||||||
|
_storage_text_write_ln "$std_output"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# install_keyboard_shortcut=<Control><Alt>1
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies ""
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_recursive=true; par_get_pwd=true")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
|
||||||
|
local std_output=""
|
||||||
|
std_output=$(_storage_text_read_all)
|
||||||
|
std_output=$(_text_sort "$std_output")
|
||||||
|
|
||||||
|
_display_list_box "$std_output" "--column=Mime;--column=File"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local std_output=""
|
||||||
|
local file_mime=""
|
||||||
|
|
||||||
|
file_mime=$(file --brief --mime-type -- "$input_file" 2>/dev/null)
|
||||||
|
|
||||||
|
if [[ -z "$file_mime" ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$file_mime" == "cannot"* ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
std_output="$file_mime$FIELD_SEPARATOR$input_file"
|
||||||
|
std_output=$(_text_remove_pwd "$std_output")
|
||||||
|
|
||||||
|
_storage_text_write_ln "$std_output"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies ""
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=all; par_get_pwd=true")
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
std_output=$(find "$input_files" -type f -links +1 -printf "%i %p\n")
|
||||||
|
std_output=$(_text_sort "$std_output")
|
||||||
|
std_output=$(awk 'NR==1 {prev=$1} $1!=prev {print "\nHard links:"; prev=$1} {print $0}' <<<"$std_output")
|
||||||
|
|
||||||
|
if [[ -n "$std_output" ]]; then
|
||||||
|
std_output="Hard links:"$'\n'"$std_output"
|
||||||
|
fi
|
||||||
|
|
||||||
|
_display_text_box "$std_output"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# install_keyboard_shortcut=<Control><Shift>H
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies ""
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=all; par_get_pwd=true")
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
std_output=$(find $input_files ! -path "$IGNORE_FIND_PATH" -regextype posix-extended -regex ".*/\.[^/]*" -printf "%p\n" 2>/dev/null)
|
||||||
|
std_output=$(_text_remove_pwd "$std_output")
|
||||||
|
|
||||||
|
_display_list_box "$std_output" "--column=Item"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies ""
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=all; par_recursive=true; par_get_pwd=true")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
|
||||||
|
local std_output=""
|
||||||
|
std_output=$(_storage_text_read_all)
|
||||||
|
std_output=$(_text_sort "$std_output")
|
||||||
|
|
||||||
|
_display_list_box "$std_output" "--column=Size;--column=Modified;--column=Created;--column=Type;--column=File"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
std_output=$(stat --format="%s$FIELD_SEPARATOR%y$FIELD_SEPARATOR%w$FIELD_SEPARATOR%F" -- "$input_file" 2>/dev/null)
|
||||||
|
# shellcheck disable=SC2001
|
||||||
|
std_output=$(sed "s|\([0-9]\{4\}-[0-1][0-9]-[0-3][0-9]\)[^$FIELD_SEPARATOR]*|\1|g" <<<"$std_output")
|
||||||
|
|
||||||
|
_storage_text_write_ln "$std_output$FIELD_SEPARATOR$(_text_remove_pwd "$input_file")"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+44
@@ -0,0 +1,44 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# install_keyboard_shortcut=<Control><Alt>9
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies ""
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=directory; par_get_pwd=true")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
|
||||||
|
local std_output=""
|
||||||
|
std_output=$(_storage_text_read_all)
|
||||||
|
std_output=$(sort -h -r <<<"$std_output") # Sort the result.
|
||||||
|
std_output=$(head -n 15 <<<"$std_output")
|
||||||
|
|
||||||
|
_display_list_box "$std_output" "--column=Size;--column=File"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
std_output=$(du -h -- "$input_file" 2>/dev/null)
|
||||||
|
std_output=$(_text_remove_pwd "$std_output")
|
||||||
|
std_output=$(grep -v "\.$" <<<"$std_output")
|
||||||
|
# shellcheck disable=SC2001
|
||||||
|
std_output=$(sed "s|\([^ ]*\)\t\(.*\)|\1$FIELD_SEPARATOR\2|g" <<<"$std_output")
|
||||||
|
|
||||||
|
_storage_text_write_ln "$std_output"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# install_keyboard_shortcut=<Control><Alt>0
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies ""
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_recursive=true; par_get_pwd=true")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
|
||||||
|
local std_output=""
|
||||||
|
std_output=$(_storage_text_read_all)
|
||||||
|
std_output=$(sort -h -r <<<"$std_output") # Sort the result.
|
||||||
|
std_output=$(head -n 15 <<<"$std_output")
|
||||||
|
|
||||||
|
_display_list_box "$std_output" "--column=Size;--column=File"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
std_output=$(du -h -- "$input_file" 2>/dev/null)
|
||||||
|
std_output=$(_text_remove_pwd "$std_output")
|
||||||
|
# shellcheck disable=SC2001
|
||||||
|
std_output=$(sed "s|\([^ ]*\)\t\(.*\)|\1$FIELD_SEPARATOR\2|g" <<<"$std_output")
|
||||||
|
|
||||||
|
_storage_text_write_ln "$std_output"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# install_keyboard_shortcut=<Control><Shift>O
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "command=xdg-open; package=xdg-utils"
|
||||||
|
input_files=$(_get_files "par_type=all; par_max_items=20; par_get_pwd=true")
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
_open_items_locations "$input_files"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=pdfunite; pkg_manager=apt; package=poppler-utils |
|
||||||
|
command=pdfunite; pkg_manager=dnf; package=poppler-utils |
|
||||||
|
command=pdfunite; pkg_manager=pacman; package=poppler |
|
||||||
|
command=pdfunite; pkg_manager=zypper; package=poppler-tools"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf; par_min_items=2; par_sort_list=true")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=true")
|
||||||
|
|
||||||
|
_main_task "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_files=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "Combined documents.pdf" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
std_output=$(pdfunite -- $input_files "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
Executable
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=pdfseparate; pkg_manager=apt; package=poppler-utils |
|
||||||
|
command=pdfseparate; pkg_manager=dnf; package=poppler-utils |
|
||||||
|
command=pdfseparate; pkg_manager=pacman; package=poppler |
|
||||||
|
command=pdfseparate; pkg_manager=zypper; package=poppler-tools"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=%04d.pdf")
|
||||||
|
std_output=$(pdfseparate "$input_file" -- "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
Executable
+38
@@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "command=qpdf"
|
||||||
|
_display_wait_box "0"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
TEMP_DATA_TASK=$(_display_password_box_define) || _exit_script
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
# NOTE: Older 'qpdf' versions do not support ' -- ' in the command line.
|
||||||
|
std_output=$(qpdf --decrypt --password="$TEMP_DATA_TASK" "$input_file" "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
Executable
+36
@@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "command=qpdf"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
# NOTE: Older 'qpdf' versions do not support ' -- ' in the command line.
|
||||||
|
std_output=$(qpdf --decrypt "$input_file" "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+37
@@ -0,0 +1,37 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "command=qpdf"
|
||||||
|
_display_wait_box "0"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
TEMP_DATA_TASK=$(_display_password_box_define) || _exit_script
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(qpdf --encrypt "$TEMP_DATA_TASK" "$TEMP_DATA_TASK" 256 -- "$input_file" "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+49
@@ -0,0 +1,49 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=pdfinfo; pkg_manager=apt; package=poppler-utils |
|
||||||
|
command=pdfinfo; pkg_manager=dnf; package=poppler-utils |
|
||||||
|
command=pdfinfo; pkg_manager=pacman; package=poppler |
|
||||||
|
command=pdfinfo; pkg_manager=zypper; package=poppler-tools"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_recursive=true; par_get_pwd=true; par_select_mime=application/pdf")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" ""
|
||||||
|
|
||||||
|
local std_output=""
|
||||||
|
std_output=$(_storage_text_read_all)
|
||||||
|
std_output=$(_text_sort "$std_output")
|
||||||
|
|
||||||
|
_display_list_box "$std_output" "--column=Protection;--column=File"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
std_output=$(pdfinfo -- "$input_file" 2>&1)
|
||||||
|
|
||||||
|
# Save the result only for 'encrypted' PDFs.
|
||||||
|
if [[ "$std_output" == *"yes ("* ]]; then
|
||||||
|
std_output=$(grep --only-matching "(print.*)" <<<"$std_output")
|
||||||
|
# shellcheck disable=SC2001
|
||||||
|
std_output=$(sed "s|^(\(.*\))$|\1|g" <<<"$std_output")
|
||||||
|
_storage_text_write_ln "$std_output$FIELD_SEPARATOR$(_text_remove_pwd "$input_file")"
|
||||||
|
elif [[ "$std_output" == *"Incorrect password"* ]]; then
|
||||||
|
_storage_text_write_ln "password protection$FIELD_SEPARATOR$(_text_remove_pwd "$input_file")"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
Executable
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=pdfjam; pkg_manager=apt; package=texlive-extra-utils |
|
||||||
|
command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam |
|
||||||
|
command=pdfjam; pkg_manager=pacman; package=texlive-binextra |
|
||||||
|
command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(pdfjam --nup "1x2" --landscape --outfile "$output_file" -- "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
Executable
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=pdfjam; pkg_manager=apt; package=texlive-extra-utils |
|
||||||
|
command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam |
|
||||||
|
command=pdfjam; pkg_manager=pacman; package=texlive-binextra |
|
||||||
|
command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(pdfjam --nup "2x1" --landscape --outfile "$output_file" -- "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
Executable
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=pdfjam; pkg_manager=apt; package=texlive-extra-utils |
|
||||||
|
command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam |
|
||||||
|
command=pdfjam; pkg_manager=pacman; package=texlive-binextra |
|
||||||
|
command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(pdfjam --nup "2x2" --landscape --outfile "$output_file" -- "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
Executable
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=pdfjam; pkg_manager=apt; package=texlive-extra-utils |
|
||||||
|
command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam |
|
||||||
|
command=pdfjam; pkg_manager=pacman; package=texlive-binextra |
|
||||||
|
command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(pdfjam --nup "2x4" --landscape --outfile "$output_file" -- "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
Executable
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=pdfjam; pkg_manager=apt; package=texlive-extra-utils |
|
||||||
|
command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam |
|
||||||
|
command=pdfjam; pkg_manager=pacman; package=texlive-binextra |
|
||||||
|
command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(pdfjam --nup "4x2" --landscape --outfile "$output_file" -- "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
Executable
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=pdfjam; pkg_manager=apt; package=texlive-extra-utils |
|
||||||
|
command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam |
|
||||||
|
command=pdfjam; pkg_manager=pacman; package=texlive-binextra |
|
||||||
|
command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(pdfjam --nup "1x2" --no-landscape --outfile "$output_file" -- "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
Executable
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=pdfjam; pkg_manager=apt; package=texlive-extra-utils |
|
||||||
|
command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam |
|
||||||
|
command=pdfjam; pkg_manager=pacman; package=texlive-binextra |
|
||||||
|
command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(pdfjam --nup "2x1" --no-landscape --outfile "$output_file" -- "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
Executable
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=pdfjam; pkg_manager=apt; package=texlive-extra-utils |
|
||||||
|
command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam |
|
||||||
|
command=pdfjam; pkg_manager=pacman; package=texlive-binextra |
|
||||||
|
command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(pdfjam --nup "2x2" --no-landscape --outfile "$output_file" -- "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
Executable
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=pdfjam; pkg_manager=apt; package=texlive-extra-utils |
|
||||||
|
command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam |
|
||||||
|
command=pdfjam; pkg_manager=pacman; package=texlive-binextra |
|
||||||
|
command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(pdfjam --nup "2x4" --no-landscape --outfile "$output_file" -- "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
Executable
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=pdfjam; pkg_manager=apt; package=texlive-extra-utils |
|
||||||
|
command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam |
|
||||||
|
command=pdfjam; pkg_manager=pacman; package=texlive-binextra |
|
||||||
|
command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(pdfjam --nup "4x2" --no-landscape --outfile "$output_file" -- "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+36
@@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "command=qpdf"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
# NOTE: Older 'qpdf' versions do not support ' -- ' in the command line.
|
||||||
|
std_output=$(qpdf --stream-data=compress --linearize "$input_file" "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+41
@@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=pdfinfo; pkg_manager=apt; package=poppler-utils |
|
||||||
|
command=pdfinfo; pkg_manager=dnf; package=poppler-utils |
|
||||||
|
command=pdfinfo; pkg_manager=pacman; package=poppler |
|
||||||
|
command=pdfinfo; pkg_manager=zypper; package=poppler-tools"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_recursive=true; par_get_pwd=true; par_select_mime=application/pdf")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" ""
|
||||||
|
|
||||||
|
local std_output=""
|
||||||
|
std_output=$(_storage_text_read_all)
|
||||||
|
std_output=$(_text_sort "$std_output")
|
||||||
|
|
||||||
|
_display_list_box "$std_output" "--column=File"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local temp_file=""
|
||||||
|
|
||||||
|
# Save the result only for 'not linearized (not optimized)' PDFs.
|
||||||
|
if pdfinfo "$input_file" | grep "Optimized:" | grep --quiet "no"; then
|
||||||
|
_storage_text_write_ln "$(_text_remove_pwd "$input_file")"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+35
@@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "command=gs; package=ghostscript"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(gs -q -dNOPAUSE -dBATCH -dFastWebView -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -sOutputFile="$output_file" -- "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
Executable
+35
@@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "command=gs; package=ghostscript"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(gs -q -dNOPAUSE -dBATCH -dFastWebView -sDEVICE=pdfwrite -dPDFSETTINGS=/printer -sOutputFile="$output_file" -- "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=pdfjam; pkg_manager=apt; package=texlive-extra-utils |
|
||||||
|
command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam |
|
||||||
|
command=pdfjam; pkg_manager=pacman; package=texlive-binextra |
|
||||||
|
command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(pdfjam --papersize "{297mm,420mm}" --outfile "$output_file" -- "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=pdfjam; pkg_manager=apt; package=texlive-extra-utils |
|
||||||
|
command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam |
|
||||||
|
command=pdfjam; pkg_manager=pacman; package=texlive-binextra |
|
||||||
|
command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(pdfjam --papersize "{210mm,297mm}" --outfile "$output_file" -- "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=pdfjam; pkg_manager=apt; package=texlive-extra-utils |
|
||||||
|
command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam |
|
||||||
|
command=pdfjam; pkg_manager=pacman; package=texlive-binextra |
|
||||||
|
command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(pdfjam --papersize "{148mm,210mm}" --outfile "$output_file" -- "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=pdfjam; pkg_manager=apt; package=texlive-extra-utils |
|
||||||
|
command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam |
|
||||||
|
command=pdfjam; pkg_manager=pacman; package=texlive-binextra |
|
||||||
|
command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(pdfjam --papersize "{8.5in,14in}" --outfile "$output_file" -- "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=pdfjam; pkg_manager=apt; package=texlive-extra-utils |
|
||||||
|
command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam |
|
||||||
|
command=pdfjam; pkg_manager=pacman; package=texlive-binextra |
|
||||||
|
command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(pdfjam --papersize "{8.5in,11in}" --outfile "$output_file" -- "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "command=qpdf"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
# NOTE: Older 'qpdf' versions do not support ' -- ' in the command line.
|
||||||
|
std_output=$(qpdf --rotate=180:1-z "$input_file" "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "command=qpdf"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
# NOTE: Older 'qpdf' versions do not support ' -- ' in the command line.
|
||||||
|
std_output=$(qpdf --rotate=270:1-z "$input_file" "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "command=qpdf"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
# NOTE: Older 'qpdf' versions do not support ' -- ' in the command line.
|
||||||
|
std_output=$(qpdf --rotate=90:1-z "$input_file" "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
Executable
+41
@@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=pdffonts; pkg_manager=apt; package=poppler-utils |
|
||||||
|
command=pdffonts; pkg_manager=dnf; package=poppler-utils |
|
||||||
|
command=pdffonts; pkg_manager=pacman; package=poppler |
|
||||||
|
command=pdffonts; pkg_manager=zypper; package=poppler-tools"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_recursive=true; par_get_pwd=true; par_select_mime=application/pdf")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" ""
|
||||||
|
|
||||||
|
local std_output=""
|
||||||
|
std_output=$(_storage_text_read_all)
|
||||||
|
std_output=$(_text_sort "$std_output")
|
||||||
|
|
||||||
|
_display_list_box "$std_output" "--column=File"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local temp_file=""
|
||||||
|
|
||||||
|
# Save the result only for 'without fonts' PDFs.
|
||||||
|
if ! pdffonts "$input_file" | sed -n 3p | grep --quiet "."; then
|
||||||
|
_storage_text_write_ln "$(_text_remove_pwd "$input_file")"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
Executable
+41
@@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
TEMP_DATA_TASK="eng"
|
||||||
|
_check_dependencies "
|
||||||
|
command=ocrmypdf |
|
||||||
|
pkg_manager=apt; package=tesseract-ocr-$TEMP_DATA_TASK |
|
||||||
|
pkg_manager=dnf; package=tesseract-langpack-$TEMP_DATA_TASK |
|
||||||
|
pkg_manager=pacman; package=tesseract-data-$TEMP_DATA_TASK |
|
||||||
|
pkg_manager=zypper; package=tesseract-ocr-traineddata-$TEMP_DATA_TASK"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(ocrmypdf --l "$TEMP_DATA_TASK" --output-type pdfa --skip-text --jobs "$(_get_max_procs)" -- "$input_file" "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
Executable
+41
@@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
TEMP_DATA_TASK="fra"
|
||||||
|
_check_dependencies "
|
||||||
|
command=ocrmypdf |
|
||||||
|
pkg_manager=apt; package=tesseract-ocr-$TEMP_DATA_TASK |
|
||||||
|
pkg_manager=dnf; package=tesseract-langpack-$TEMP_DATA_TASK |
|
||||||
|
pkg_manager=pacman; package=tesseract-data-$TEMP_DATA_TASK |
|
||||||
|
pkg_manager=zypper; package=tesseract-ocr-traineddata-$TEMP_DATA_TASK"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(ocrmypdf --l "$TEMP_DATA_TASK" --output-type pdfa --skip-text --jobs "$(_get_max_procs)" -- "$input_file" "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
Executable
+41
@@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
TEMP_DATA_TASK="deu"
|
||||||
|
_check_dependencies "
|
||||||
|
command=ocrmypdf |
|
||||||
|
pkg_manager=apt; package=tesseract-ocr-$TEMP_DATA_TASK |
|
||||||
|
pkg_manager=dnf; package=tesseract-langpack-$TEMP_DATA_TASK |
|
||||||
|
pkg_manager=pacman; package=tesseract-data-$TEMP_DATA_TASK |
|
||||||
|
pkg_manager=zypper; package=tesseract-ocr-traineddata-$TEMP_DATA_TASK"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(ocrmypdf --l "$TEMP_DATA_TASK" --output-type pdfa --skip-text --jobs "$(_get_max_procs)" -- "$input_file" "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
Executable
+41
@@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
TEMP_DATA_TASK="ita"
|
||||||
|
_check_dependencies "
|
||||||
|
command=ocrmypdf |
|
||||||
|
pkg_manager=apt; package=tesseract-ocr-$TEMP_DATA_TASK |
|
||||||
|
pkg_manager=dnf; package=tesseract-langpack-$TEMP_DATA_TASK |
|
||||||
|
pkg_manager=pacman; package=tesseract-data-$TEMP_DATA_TASK |
|
||||||
|
pkg_manager=zypper; package=tesseract-ocr-traineddata-$TEMP_DATA_TASK"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(ocrmypdf --l "$TEMP_DATA_TASK" --output-type pdfa --skip-text --jobs "$(_get_max_procs)" -- "$input_file" "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
Executable
+41
@@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
TEMP_DATA_TASK="por"
|
||||||
|
_check_dependencies "
|
||||||
|
command=ocrmypdf |
|
||||||
|
pkg_manager=apt; package=tesseract-ocr-$TEMP_DATA_TASK |
|
||||||
|
pkg_manager=dnf; package=tesseract-langpack-$TEMP_DATA_TASK |
|
||||||
|
pkg_manager=pacman; package=tesseract-data-$TEMP_DATA_TASK |
|
||||||
|
pkg_manager=zypper; package=tesseract-ocr-traineddata-$TEMP_DATA_TASK"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(ocrmypdf --l "$TEMP_DATA_TASK" --output-type pdfa --skip-text --jobs "$(_get_max_procs)" -- "$input_file" "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
Executable
+41
@@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
TEMP_DATA_TASK="rus"
|
||||||
|
_check_dependencies "
|
||||||
|
command=ocrmypdf |
|
||||||
|
pkg_manager=apt; package=tesseract-ocr-$TEMP_DATA_TASK |
|
||||||
|
pkg_manager=dnf; package=tesseract-langpack-$TEMP_DATA_TASK |
|
||||||
|
pkg_manager=pacman; package=tesseract-data-$TEMP_DATA_TASK |
|
||||||
|
pkg_manager=zypper; package=tesseract-ocr-traineddata-$TEMP_DATA_TASK"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(ocrmypdf --l "$TEMP_DATA_TASK" --output-type pdfa --skip-text --jobs "$(_get_max_procs)" -- "$input_file" "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
Executable
+41
@@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
TEMP_DATA_TASK="spa"
|
||||||
|
_check_dependencies "
|
||||||
|
command=ocrmypdf |
|
||||||
|
pkg_manager=apt; package=tesseract-ocr-$TEMP_DATA_TASK |
|
||||||
|
pkg_manager=dnf; package=tesseract-langpack-$TEMP_DATA_TASK |
|
||||||
|
pkg_manager=pacman; package=tesseract-data-$TEMP_DATA_TASK |
|
||||||
|
pkg_manager=zypper; package=tesseract-ocr-traineddata-$TEMP_DATA_TASK"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(ocrmypdf --l "$TEMP_DATA_TASK" --output-type pdfa --skip-text --jobs "$(_get_max_procs)" -- "$input_file" "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "command=gs; package=ghostscript"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
|
||||||
|
std_output=$(gs -q -dNOPAUSE -dBATCH -dPDFA=2 -dPDFACompatibilityPolicy=1 -sColorConversionStrategy=UseDeviceIndependentColor -sDEVICE=pdfwrite -sOutputFile="$output_file" -- "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "
|
||||||
|
command=pdfimages; pkg_manager=apt; package=poppler-utils |
|
||||||
|
command=pdfimages; pkg_manager=dnf; package=poppler-utils |
|
||||||
|
command=pdfimages; pkg_manager=pacman; package=poppler |
|
||||||
|
command=pdfimages; pkg_manager=zypper; package=poppler-tools"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_select_mime=application/pdf")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=false")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=strip")
|
||||||
|
std_output=$(pdfimages -all "$input_file" -- "$output_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+110
@@ -0,0 +1,110 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies ""
|
||||||
|
input_files=$(_get_files "par_type=file; par_validate_conflict=true")
|
||||||
|
|
||||||
|
local dependencies=""
|
||||||
|
dependencies=$(_get_dependencies "$input_files")
|
||||||
|
_check_dependencies "$dependencies"
|
||||||
|
_display_wait_box "2"
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=true")
|
||||||
|
|
||||||
|
export -f _get_command _run_command
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
local command=""
|
||||||
|
command=$(_get_command "$input_file")
|
||||||
|
_run_command "$input_file" "$command" "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_get_dependencies() {
|
||||||
|
local input_files=$1
|
||||||
|
local dependencies=""
|
||||||
|
|
||||||
|
# Check dependencies for each file.
|
||||||
|
for input_file in $input_files; do
|
||||||
|
local command=""
|
||||||
|
command=$(_get_command "$input_file")
|
||||||
|
|
||||||
|
case $command in
|
||||||
|
"libreoffice_writer")
|
||||||
|
if ! _command_exists "libreoffice.writer" && ! _command_exists "libreoffice-writer"; then
|
||||||
|
dependencies+="package=libreoffice-writer"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"pandoc") dependencies+="command=pandoc" ;;
|
||||||
|
esac
|
||||||
|
dependencies+=$'\n'
|
||||||
|
done
|
||||||
|
|
||||||
|
printf "%s" "$dependencies"
|
||||||
|
}
|
||||||
|
|
||||||
|
_get_command() {
|
||||||
|
local input_file=$1
|
||||||
|
local command=""
|
||||||
|
|
||||||
|
case "${input_file,,}" in
|
||||||
|
*.doc | *.docx) command="libreoffice_writer" ;;
|
||||||
|
*.htm | *.html) command="libreoffice_writer" ;;
|
||||||
|
*.odf | *.fodf) command="libreoffice_writer" ;;
|
||||||
|
*.odt | *.fodt) command="libreoffice_writer" ;;
|
||||||
|
*.rtf) command="libreoffice_writer" ;;
|
||||||
|
*) command="pandoc" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
printf "%s" "$command"
|
||||||
|
}
|
||||||
|
|
||||||
|
_run_command() {
|
||||||
|
local input_file=$1
|
||||||
|
local command=$2
|
||||||
|
local output_dir=$3
|
||||||
|
local output_format="docx"
|
||||||
|
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=$output_format")
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
case $command in
|
||||||
|
"libreoffice_writer")
|
||||||
|
# NOTE: Workaround to fix the bug 37531 in LibreOffice.
|
||||||
|
# See the: https://bugs.documentfoundation.org/show_bug.cgi?id=37531
|
||||||
|
local temp_file=""
|
||||||
|
temp_file=$(_get_temp_file_dry)
|
||||||
|
|
||||||
|
# NOTE: LibreOffice does not support ' -- ' in the command line.
|
||||||
|
# NOTE: LibreOffice does not support defining the output file manually.
|
||||||
|
std_output=$(libreoffice --headless --convert-to "$output_format" "-env:UserInstallation=file://$temp_file" --outdir "$output_dir" "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" ""
|
||||||
|
|
||||||
|
# Remove the temporary file.
|
||||||
|
rm -f -- "$temp_file"
|
||||||
|
;;
|
||||||
|
"pandoc")
|
||||||
|
std_output=$(pandoc --standalone -o "$output_file" -- "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "command=pandoc"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_validate_conflict=true")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=true")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=epub")
|
||||||
|
std_output=$(pandoc --standalone -o "$output_file" -- "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies "command=pandoc"
|
||||||
|
_display_wait_box "2"
|
||||||
|
input_files=$(_get_files "par_type=file; par_validate_conflict=true")
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=true")
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
local std_output=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=md")
|
||||||
|
std_output=$(pandoc -t gfm --wrap=none -s -o "$output_file" -- "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+108
@@ -0,0 +1,108 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies ""
|
||||||
|
input_files=$(_get_files "par_type=file; par_validate_conflict=true")
|
||||||
|
|
||||||
|
local dependencies=""
|
||||||
|
dependencies=$(_get_dependencies "$input_files")
|
||||||
|
_check_dependencies "$dependencies"
|
||||||
|
_display_wait_box "2"
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=true")
|
||||||
|
|
||||||
|
export -f _get_command _run_command
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
local command=""
|
||||||
|
command=$(_get_command "$input_file")
|
||||||
|
_run_command "$input_file" "$command" "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_get_dependencies() {
|
||||||
|
local input_files=$1
|
||||||
|
local dependencies=""
|
||||||
|
|
||||||
|
# Check dependencies for each file.
|
||||||
|
for input_file in $input_files; do
|
||||||
|
local command=""
|
||||||
|
command=$(_get_command "$input_file")
|
||||||
|
|
||||||
|
case $command in
|
||||||
|
"libreoffice_impress")
|
||||||
|
if ! _command_exists "libreoffice.impress" && ! _command_exists "libreoffice-impress"; then
|
||||||
|
dependencies+="package=libreoffice-impress"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"pandoc") dependencies+="command=pandoc" ;;
|
||||||
|
esac
|
||||||
|
dependencies+=$'\n'
|
||||||
|
done
|
||||||
|
|
||||||
|
printf "%s" "$dependencies"
|
||||||
|
}
|
||||||
|
|
||||||
|
_get_command() {
|
||||||
|
local input_file=$1
|
||||||
|
local command=""
|
||||||
|
|
||||||
|
case "${input_file,,}" in
|
||||||
|
*.odg | *.fodg) command="libreoffice_impress" ;;
|
||||||
|
*.odp | *.fodp) command="libreoffice_impress" ;;
|
||||||
|
*.ppt | *.pptx) command="libreoffice_impress" ;;
|
||||||
|
*) command="pandoc" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
printf "%s" "$command"
|
||||||
|
}
|
||||||
|
|
||||||
|
_run_command() {
|
||||||
|
local input_file=$1
|
||||||
|
local command=$2
|
||||||
|
local output_dir=$3
|
||||||
|
local output_format="odp"
|
||||||
|
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=$output_format")
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
case $command in
|
||||||
|
"libreoffice_impress")
|
||||||
|
# NOTE: Workaround to fix the bug 37531 in LibreOffice.
|
||||||
|
# See the: https://bugs.documentfoundation.org/show_bug.cgi?id=37531
|
||||||
|
local temp_file=""
|
||||||
|
temp_file=$(_get_temp_file_dry)
|
||||||
|
|
||||||
|
# NOTE: LibreOffice does not support ' -- ' in the command line.
|
||||||
|
# NOTE: LibreOffice does not support defining the output file manually.
|
||||||
|
std_output=$(libreoffice --headless --convert-to "$output_format" "-env:UserInstallation=file://$temp_file" --outdir "$output_dir" "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" ""
|
||||||
|
|
||||||
|
# Remove the temporary file.
|
||||||
|
rm -f -- "$temp_file"
|
||||||
|
;;
|
||||||
|
"pandoc")
|
||||||
|
std_output=$(pandoc --standalone -o "$output_file" -- "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+108
@@ -0,0 +1,108 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies ""
|
||||||
|
input_files=$(_get_files "par_type=file; par_validate_conflict=true")
|
||||||
|
|
||||||
|
local dependencies=""
|
||||||
|
dependencies=$(_get_dependencies "$input_files")
|
||||||
|
_check_dependencies "$dependencies"
|
||||||
|
_display_wait_box "2"
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=true")
|
||||||
|
|
||||||
|
export -f _get_command _run_command
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
local command=""
|
||||||
|
command=$(_get_command "$input_file")
|
||||||
|
_run_command "$input_file" "$command" "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_get_dependencies() {
|
||||||
|
local input_files=$1
|
||||||
|
local dependencies=""
|
||||||
|
|
||||||
|
# Check dependencies for each file.
|
||||||
|
for input_file in $input_files; do
|
||||||
|
local command=""
|
||||||
|
command=$(_get_command "$input_file")
|
||||||
|
|
||||||
|
case $command in
|
||||||
|
"libreoffice_calc")
|
||||||
|
if ! _command_exists "libreoffice.calc" && ! _command_exists "libreoffice-calc"; then
|
||||||
|
dependencies+="package=libreoffice-calc"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"pandoc") dependencies+="command=pandoc" ;;
|
||||||
|
esac
|
||||||
|
dependencies+=$'\n'
|
||||||
|
done
|
||||||
|
|
||||||
|
printf "%s" "$dependencies"
|
||||||
|
}
|
||||||
|
|
||||||
|
_get_command() {
|
||||||
|
local input_file=$1
|
||||||
|
local command=""
|
||||||
|
|
||||||
|
case "${input_file,,}" in
|
||||||
|
*.ods | *.fods) command="libreoffice_calc" ;;
|
||||||
|
*.xls | *.xlsx) command="libreoffice_calc" ;;
|
||||||
|
*.csv) command="libreoffice_calc" ;;
|
||||||
|
*) command="pandoc" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
printf "%s" "$command"
|
||||||
|
}
|
||||||
|
|
||||||
|
_run_command() {
|
||||||
|
local input_file=$1
|
||||||
|
local command=$2
|
||||||
|
local output_dir=$3
|
||||||
|
local output_format="ods"
|
||||||
|
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=$output_format")
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
case $command in
|
||||||
|
"libreoffice_calc")
|
||||||
|
# NOTE: Workaround to fix the bug 37531 in LibreOffice.
|
||||||
|
# See the: https://bugs.documentfoundation.org/show_bug.cgi?id=37531
|
||||||
|
local temp_file=""
|
||||||
|
temp_file=$(_get_temp_file_dry)
|
||||||
|
|
||||||
|
# NOTE: LibreOffice does not support ' -- ' in the command line.
|
||||||
|
# NOTE: LibreOffice does not support defining the output file manually.
|
||||||
|
std_output=$(libreoffice --headless --convert-to "$output_format" "-env:UserInstallation=file://$temp_file" --outdir "$output_dir" "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" ""
|
||||||
|
|
||||||
|
# Remove the temporary file.
|
||||||
|
rm -f -- "$temp_file"
|
||||||
|
;;
|
||||||
|
"pandoc")
|
||||||
|
std_output=$(pandoc --standalone -o "$output_file" -- "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
+110
@@ -0,0 +1,110 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source the script 'common-functions.sh'.
|
||||||
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
|
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||||
|
source "$ROOT_DIR/common-functions.sh"
|
||||||
|
|
||||||
|
_main() {
|
||||||
|
local input_files=""
|
||||||
|
local output_dir=""
|
||||||
|
|
||||||
|
# Execute initial checks.
|
||||||
|
_check_dependencies ""
|
||||||
|
input_files=$(_get_files "par_type=file; par_validate_conflict=true")
|
||||||
|
|
||||||
|
local dependencies=""
|
||||||
|
dependencies=$(_get_dependencies "$input_files")
|
||||||
|
_check_dependencies "$dependencies"
|
||||||
|
_display_wait_box "2"
|
||||||
|
output_dir=$(_get_output_dir "par_use_same_dir=true")
|
||||||
|
|
||||||
|
export -f _get_command _run_command
|
||||||
|
|
||||||
|
# Execute the function '_main_task' for each file in parallel.
|
||||||
|
_run_task_parallel "$input_files" "$output_dir"
|
||||||
|
_display_result_box "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_main_task() {
|
||||||
|
local input_file=$1
|
||||||
|
local output_dir=$2
|
||||||
|
local output_file=""
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
local command=""
|
||||||
|
command=$(_get_command "$input_file")
|
||||||
|
_run_command "$input_file" "$command" "$output_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
_get_dependencies() {
|
||||||
|
local input_files=$1
|
||||||
|
local dependencies=""
|
||||||
|
|
||||||
|
# Check dependencies for each file.
|
||||||
|
for input_file in $input_files; do
|
||||||
|
local command=""
|
||||||
|
command=$(_get_command "$input_file")
|
||||||
|
|
||||||
|
case $command in
|
||||||
|
"libreoffice_writer")
|
||||||
|
if ! _command_exists "libreoffice.writer" && ! _command_exists "libreoffice-writer"; then
|
||||||
|
dependencies+="package=libreoffice-writer"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"pandoc") dependencies+="command=pandoc" ;;
|
||||||
|
esac
|
||||||
|
dependencies+=$'\n'
|
||||||
|
done
|
||||||
|
|
||||||
|
printf "%s" "$dependencies"
|
||||||
|
}
|
||||||
|
|
||||||
|
_get_command() {
|
||||||
|
local input_file=$1
|
||||||
|
local command=""
|
||||||
|
|
||||||
|
case "${input_file,,}" in
|
||||||
|
*.doc | *.docx) command="libreoffice_writer" ;;
|
||||||
|
*.htm | *.html) command="libreoffice_writer" ;;
|
||||||
|
*.odf | *.fodf) command="libreoffice_writer" ;;
|
||||||
|
*.odt | *.fodt) command="libreoffice_writer" ;;
|
||||||
|
*.rtf) command="libreoffice_writer" ;;
|
||||||
|
*) command="pandoc" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
printf "%s" "$command"
|
||||||
|
}
|
||||||
|
|
||||||
|
_run_command() {
|
||||||
|
local input_file=$1
|
||||||
|
local command=$2
|
||||||
|
local output_dir=$3
|
||||||
|
local output_format="odt"
|
||||||
|
|
||||||
|
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=$output_format")
|
||||||
|
|
||||||
|
# Run the main process.
|
||||||
|
case $command in
|
||||||
|
"libreoffice_writer")
|
||||||
|
# NOTE: Workaround to fix the bug 37531 in LibreOffice.
|
||||||
|
# See the: https://bugs.documentfoundation.org/show_bug.cgi?id=37531
|
||||||
|
local temp_file=""
|
||||||
|
temp_file=$(_get_temp_file_dry)
|
||||||
|
|
||||||
|
# NOTE: LibreOffice does not support ' -- ' in the command line.
|
||||||
|
# NOTE: LibreOffice does not support defining the output file manually.
|
||||||
|
std_output=$(libreoffice --headless --convert-to "$output_format" "-env:UserInstallation=file://$temp_file" --outdir "$output_dir" "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" ""
|
||||||
|
|
||||||
|
# Remove the temporary file.
|
||||||
|
rm -f -- "$temp_file"
|
||||||
|
;;
|
||||||
|
"pandoc")
|
||||||
|
std_output=$(pandoc --standalone -o "$output_file" -- "$input_file" 2>&1)
|
||||||
|
_check_output "$?" "$std_output" "$input_file" "$output_file"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_main "$@"
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user