added nautilus scripts (needs nautilus-python package)

This commit is contained in:
2026-06-14 18:55:25 +02:00
parent 33df2d0d81
commit dd4af575b5
247 changed files with 14784 additions and 0 deletions
@@ -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
View File
@@ -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
View File
@@ -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 "$@"
+46
View File
@@ -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 "$@"
@@ -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 "$@"
@@ -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 "$@"