]> gitweb.hhaalo.de Git - albentohandy.git/commitdiff
delete all files
authorBastian Dehn <hhaalo@arcor.de>
Fri, 25 Sep 2026 06:59:28 +0000 (08:59 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Fri, 25 Sep 2026 06:59:28 +0000 (08:59 +0200)
albentohandy [deleted file]
libs/flac.sh [deleted file]
libs/mp3.sh [deleted file]
libs/opus.sh [deleted file]
libs/vorbis.sh [deleted file]

diff --git a/albentohandy b/albentohandy
deleted file mode 100755 (executable)
index 9c29fe3..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-#!/bin/bash
-
-errlog()
-{
-       local lastexit=$?
-       local msg="$1"
-
-       echo "❌ ERROR: $msg"
-       echo "🛑 EXIT $lastexit"
-       return $lastexit
-}
-
-usage()
-{
-       cat <<- EOF
-
-NAME
-    albumtohandy - konvertiert flac to mp3 von einer Sammlung
-
-SYNOPSIS
-    albentohandy [-3] [-c] [-f] [-h] [-k] [-o]
-
-OPTIONS
-    -3                      convert to mp3
-    -c                      generate checksum.sha256
-    -f                      convert to flac
-    -h                      show this help
-    -k                      keep cover.jpg
-    -o                      convert to opus
-
-       EOF
-}
-
-check_programms()
-{
-       command -v rsync > /dev/null \
-               || errlog "command rsync not found" \
-               || return $?
-}
-
-load_config()
-{
-       [ -f "$HOME/.albentohandy.conf" ] \
-               || errlog "file $HOME/.albentohandy.conf does not exists" \
-               || return $?
-       # shellcheck disable=SC1091
-       source "$HOME/.albentohandy.conf"
-
-       [ -n "$MUSICPATH" ] \
-               || errlog "missing MUSICPATH" \
-               || return $?
-}
-
-cleanup_cover()
-{
-       local cover="$1"
-       local workdir="$2"
-
-       find "$workdir" -name 'cover.txt' -exec rm {} \;
-       [ "$cover" == "false" ] || return 0
-       find "$workdir" -name 'cover.jpg' -exec rm {} \;
-}
-
-cleanup_flac()
-{
-       local lib="$1"
-       local workdir="$2"
-
-       [ "$lib" != "flac.sh" ] || return 0
-       [ -n "$workdir" ] \
-               || errlog "missing workdir could not cleanup" \
-               || return $?
-       find "$workdir" -name '*.flac' -exec rm {} \;
-}
-
-make_symlinks_to_work()
-{
-       local albumlist="$1"
-       local workdir="$2"
-       local alben=()
-       mapfile -t alben < <(cat "$albumlist")
-
-       local album=
-       for album in "${alben[@]}"; do
-               [ -d "$MUSICPATH/$album" ] \
-                       || errlog "directory $MUSICPATH/$album does not exists" \
-                       || return $?
-               cp --recursive \
-                       --symbolic-link \
-                       "$MUSICPATH/$album" \
-                       "$workdir" \
-                       || errlog "could not copy symlinks from $MUSICPATH/$album" \
-                       || return $?
-               rsync --recursive \
-                       --perms \
-                       --times \
-                       --group \
-                       --owner \
-                       --exclude="*.flac" \
-                       --include="cover.jpg" \
-                       "$MUSICPATH/$album" \
-                       "$workdir" \
-                       || errlog "could not copy etc like cover" \
-                       || return $?
-       done
-}
-
-calc_checksum()
-{
-       local checksum="$1"
-       local workdir="$2"
-
-       [ "$checksum" == "true" ] || return 0
-       cd "$workdir" || return 1
-       find . -type f \
-               | sort \
-               | sed '/checksum/d' \
-               | xargs sha256sum > checksum.sha256
-       sha256sum --status --check checksum.sha256 \
-               || errlog "checksum failed" \
-               || return $?
-}
-
-main()
-{
-       local lib="vorbis.sh"
-       local cover="false"
-       local checksum="false"
-       local workdir="work.$$"
-       local albumlist="albumlist"
-       local scriptpath=
-       scriptpath=$(dirname "$(realpath "$0")")
-       local libpath="$scriptpath/libs"
-
-       check_programms || return $?
-       load_config || return $?
-
-       while getopts "3cfhko" optname; do
-               case "$optname" in
-               "3") lib="mp3.sh" ;;
-               "c") checksum="true" ;;
-               "f") lib="flac.sh" ;;
-               "h") usage && return 0 ;;
-               "k") cover="true" ;;
-               "o") lib="opus.sh" ;;
-               "*") echo "unkwnon parameter" ;;
-               esac
-       done
-
-       [ -f "$albumlist" ] \
-               || errlog "file $albumlist does not exists" \
-               || return $?
-
-       [ -f "$libpath/$lib" ] \
-               || errlog "file $libpath/$lib does not exists" \
-               || return $?
-       # shellcheck disable=SC1090
-       source "$libpath/$lib" || return $?
-
-       mkdir -p "$workdir"
-       make_symlinks_to_work "$albumlist" "$workdir" || return $?
-       execute "$workdir" || return $?
-       cleanup_cover "$cover" "$workdir" || return $?
-       cleanup_flac "$lib" "$workdir" || return $?
-       calc_checksum "$checksum" "$workdir" || return $?
-}
-
-main "$@"
diff --git a/libs/flac.sh b/libs/flac.sh
deleted file mode 100644 (file)
index 327e0c5..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/bash
-
-picture_to_flac()
-{
-       local workdir="$1"
-       local flacs=()
-       mapfile -t flacs < <(find "$workdir" -name '*.flac' | sort)
-
-       local file=
-       local output=
-       for file in "${flacs[@]}"; do
-               output=${file/.flac/-out.flac}
-               metaflac \
-               --import-picture-from="3|image/jpeg|||${file%/*}/cover.jpg" \
-               --output-name "$output" \
-               "$file"
-               mv "$output" "$file"
-       done
-}
-
-check_flac_programs()
-{
-       command -v metaflac > /dev/null \
-               || errlog "command metaflac not found" \
-               || return $?
-}
-
-execute()
-{
-       local workdir="$1"
-
-       picture_to_flac "$workdir" || return $?
-}
-
-check_flac_programs || return $?
diff --git a/libs/mp3.sh b/libs/mp3.sh
deleted file mode 100644 (file)
index 3b66031..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-#!/bin/bash
-
-check_mp3_programs()
-{
-       command -v flac > /dev/null \
-               || errlog "command flac not found" \
-               || return $?
-       command -v lame > /dev/null \
-               || errlog "command lame not found" \
-               || return $?
-       command -v eyeD3 > /dev/null \
-               || errlog "command eyeD3 not found" \
-               || return $?
-       command -v parallel > /dev/null \
-               || errlog "command parallel not found" \
-               || return $?
-}
-
-read_flac_to_mp3_tags()
-{
-       local input="$1"
-       local output="$2"
-       local inputdir=${input%/*}
-       local artist=
-       local title=
-       local album=
-       local genre=
-       local genre=
-       local trackno=
-       local date=
-       local rrl=
-       local rtg=
-       local rtp=
-       local rag=
-       local rap=
-
-       # get the tags from flac file
-       title=$(metaflac --show-tag=TITLE "$input")
-       artist=$(metaflac --show-tag=ARTIST "$input")
-       album=$(metaflac --show-tag=ALBUM "$input")
-       date=$(metaflac --show-tag=DATE "$input")
-       trackno=$(metaflac --show-tag=TRACKNUMBER "$input")
-       genre=$(metaflac --show-tag=GENRE "$input")
-
-       rrl=$(metaflac --show-tag=REPLAYGAIN_REFERENCE_LOUDNESS "$input")
-       rtg=$(metaflac --show-tag=REPLAYGAIN_TRACK_GAIN "$input")
-       rtp=$(metaflac --show-tag=REPLAYGAIN_TRACK_PEAK "$input")
-       rag=$(metaflac --show-tag=REPLAYGAIN_ALBUM_GAIN "$input")
-       rap=$(metaflac --show-tag=REPLAYGAIN_ALBUM_PEAK "$input")
-
-       artist=${artist/*=/}
-       title=${title/*=/}
-       album=${album/*=/}
-       genre=${genre/*=/}
-       genre=${genre:=12}
-       trackno=${trackno/*=/}
-       trackno=${trackno:=0}
-       date=${date/*=/}
-
-       rrl=${rrl/=/:}
-       rtg=${rtg/=/:}
-       rtp=${rtp/=/:}
-       rag=${rag/=/:}
-       rap=${rap/=/:}
-       # --------------------------------------------------
-
-       # ID3v2.3 tagging with cover and without cover
-       eyeD3 --v2 \
-               --to-v2.3 \
-               --title="$title" \
-               --artist="$artist" \
-               --album="$album" \
-               --recording-date="$date" \
-               --track="$trackno" \
-               --genre="$genre" \
-               --user-text-frame="$rrl" \
-               --user-text-frame="$rtg" \
-               --user-text-frame="$rtp" \
-               --user-text-frame="$rag" \
-               --user-text-frame="$rap" \
-               --add-image="$inputdir/cover.jpg":FRONT_COVER \
-               "$output" > /dev/null 2>&1
-}
-
-encoding_flac_to_mp3()
-{
-       local input="$1"
-       local output="$2"
-       BITRATE=${BITRATE:="192"}
-
-       nice --adjustment=10 flac \
-               --totally-silent \
-               --stdout \
-               --decode \
-               "$input" \
-               | nice --adjustment=15 lame \
-               --silent \
-               -b "$BITRATE" -t \
-               --noreplaygain \
-               - "$output"
-}
-
-flac_to_mp3()
-{
-       local input="$1"
-       local output="${input/.flac/.mp3}"
-       encoding_flac_to_mp3 "$input" "$output"
-       read_flac_to_mp3_tags "$input" "$output"
-}
-
-convert_flac_to_mp3()
-{
-       local workdir="$1"
-       find "$workdir" -name '*.flac' \
-               | sort \
-               | parallel --will-cite \
-               --ungroup \
-               --eta \
-               --progress \
-               flac_to_mp3 {}
-}
-
-execute()
-{
-       local workdir="$1"
-       convert_flac_to_mp3 "$workdir" || return $?
-}
-
-check_mp3_programs || return $?
-export -f flac_to_mp3
-export -f encoding_flac_to_mp3
-export -f read_flac_to_mp3_tags
diff --git a/libs/opus.sh b/libs/opus.sh
deleted file mode 100644 (file)
index 8e69c7f..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/bash
-
-check_opus_programs()
-{
-       command -v opusenc > /dev/null \
-               || errlog "command opusenc not found" \
-               || return $?
-       command -v parallel > /dev/null \
-               || errlog "command parallel not found" \
-               || return $?
-}
-
-flac_to_opus()
-{
-       local input="$1"
-       local output="${input/.flac/.opus}"
-       local coverfile="${input%/*}/cover.jpg"
-       BITRATE=${BITRATE:="192"}
-
-       nice --adjustment=10 opusenc --picture "3|image/jpeg|||$coverfile" \
-               --quiet \
-               --serial 1 \
-               --bitrate "$BITRATE" "$input" "$output"
-}
-
-convert_flac_to_opus()
-{
-       local workdir="$1"
-
-       find "$workdir" -name '*.flac' \
-               | sort \
-               | parallel --will-cite \
-               --ungroup \
-               --eta \
-               --progress \
-               flac_to_opus {}
-}
-
-execute()
-{
-       local workdir="$1"
-       convert_flac_to_opus "$workdir" || return $?
-}
-
-check_opus_programs || return $?
-export -f flac_to_opus
diff --git a/libs/vorbis.sh b/libs/vorbis.sh
deleted file mode 100644 (file)
index 22c3456..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-#!/bin/bash
-
-check_vorbis_programs()
-{
-       command -v flac > /dev/null \
-               || errlog "command flac not found" \
-               || return $?
-       command -v metaflac > /dev/null \
-               || errlog "command metaflac not found" \
-               || return $?
-       command -v oggenc > /dev/null \
-               || errlog "command oggenc not found" \
-               || return $?
-       command -v vorbiscomment > /dev/null \
-               || errlog "command vorbiscomment not found" \
-               || return $?
-       command -v parallel > /dev/null \
-               || errlog "command parallel not found" \
-               || return $?
-}
-
-read_flac_to_ogg_tags()
-{
-       local input="$1"
-       local output="$2"
-       local coverfile="${input%/*}/cover.txt"
-
-       metaflac --export-tags-to=- "$input" \
-               | vorbiscomment --commentfile - --write "$output"
-
-       [ -f "$coverfile" ] || return 0
-
-       echo "METADATA_BLOCK_PICTURE=$(base64 --wrap 0 "$coverfile")" \
-               | vorbiscomment --commentfile - --raw --append "$output"
-}
-
-encoding_flac_to_ogg()
-{
-       local input="$1"
-       local output="$2"
-       QUALITY=${QUALITY:="6"}
-       nice --adjustment=10 flac --totally-silent --stdout --decode \
-               "$input" \
-               | nice --adjustment=15 oggenc --quiet \
-               --serial 1 \
-               --quality "$QUALITY" \
-               --output "$output" -
-}
-
-flac_to_vorbis()
-{
-       local input="$1"
-       local output="${input/.flac/.ogg}"
-       encoding_flac_to_ogg "$input" "$output"
-       read_flac_to_ogg_tags "$input" "$output"
-}
-
-write_number_to_byte()
-{
-       local number="$1"
-       local hex_number=
-       hex_number=$(printf "%08x" "$number")
-
-       for i in {0..6..2}; do
-               printf "%b" "\x${hex_number:$i:2}"
-       done
-}
-
-cover_to_metadata()
-{
-       local input="$1"
-       local output="${input/.jpg/.txt}"
-       local filesize=
-       filesize=$(wc --bytes "$input")
-       filesize=${filesize/ */}
-
-       {
-               # picture typ (jpg)
-               write_number_to_byte "3"
-               # mime type (image/jpeg)
-               write_number_to_byte "10"
-               printf "%s" "image/jpeg"
-               # description length (zero)
-               write_number_to_byte "0"
-               # width (zero)
-               write_number_to_byte "0"
-               # heigth (zero)
-               write_number_to_byte "0"
-               # color depth (zero)
-               write_number_to_byte "0"
-               # color count (zero)
-               write_number_to_byte "0"
-               # file size
-               write_number_to_byte "$filesize"
-               cat "$input"
-       } > "$output"
-}
-
-convert_flac_to_ogg()
-{
-       local workdir="$1"
-       find "$workdir" -name '*.jpg' \
-               | sort \
-               | parallel --will-cite --ungroup \
-               cover_to_metadata {}
-       find "$workdir" -name '*.flac' \
-               | sort \
-               | parallel --will-cite --ungroup --eta --progress \
-               flac_to_vorbis "{}"
-}
-
-execute()
-{
-       local workdir="$1"
-       convert_flac_to_ogg "$workdir" || return $?
-}
-
-check_vorbis_programs || return $?
-export -f flac_to_vorbis
-export -f encoding_flac_to_ogg
-export -f read_flac_to_ogg_tags
-export -f cover_to_metadata
-export -f write_number_to_byte