From 2ab3f977262080007ae0133b6f14709a36da1bc3 Mon Sep 17 00:00:00 2001 From: MrGeorgen Date: Tue, 1 Jun 2021 21:22:09 +0200 Subject: [PATCH] update scripts --- kernel-build | 1 + md | 33 ++++++++++++++++++++++++++++----- update | 8 +++++++- upload | 12 ++++++------ 4 files changed, 42 insertions(+), 12 deletions(-) diff --git a/kernel-build b/kernel-build index 51a4375..bfba1dc 100755 --- a/kernel-build +++ b/kernel-build @@ -3,5 +3,6 @@ make -j12 make modules_prepare make install make modules_install +emerge @module-rebuild eclean-kernel -n 3 syslinux-mkconfig diff --git a/md b/md index 83c5767..161ccc0 100755 --- a/md +++ b/md @@ -1,12 +1,35 @@ -#!/bin/bash +#!/bin/sh +checkMetadata() { + ffprobe "$1" 2>&1 | grep -e artist -e title + while true; do + read -p "correct metadata? [Y] | [n]: " yn + case "$yn" in + [Yy]* ) return 0;; + [Nn]* ) return 1;; + * ) echo "Please answer yes or no.";; + esac + done +} cd ~/Musik/2020 -file_name="$(youtube-dl "ytsearch:$1 lyrics" \ - --extract-audio \ +file_name=`youtube-dl "ytsearch:$1 lyrics" \ + --extract-audio \ --output '%(title)s.%(ext)s' \ --metadata-from-title "%(artist)s - %(title)s" \ --audio-quality 0 \ --audio-format mp3 \ --embed-thumbnail \ --add-metadata \ - |awk '$1 == "[ffmpeg]" && $2 == "Destination:" {print substr($0, index($0,$3))}')" -r128gain "$file_name" + |awk '$1 == "[ffmpeg]" && $2 == "Destination:" {print substr($0, index($0,$3))}'` +r128gain "$file_name" > /dev/null +temp_dir="/tmp/idntag$(xxd -u -l 16 -p /dev/urandom)" +mkdir "$temp_dir" +temp_file="$temp_dir/$file_name" +cp "$file_name" "$temp_file" +idntag "$temp_file" > /dev/null +temp_file=$(echo "$temp_dir"/*) +if checkMetadata "$temp_file"; then + cp "$temp_file" . + rm "$file_name" +elif ! checkMetadata "$file_name"; then + echo "enter it manually" +fi diff --git a/update b/update index 366a016..b4b7749 100755 --- a/update +++ b/update @@ -1,6 +1,12 @@ #!/bin/sh emerge --sync emerge -Du --with-bdeps=y @world +emerge @preserved-rebuild +emerge --depclean kernel-upgrade -xbps-install -Su sudo -u mrgeorgen yay +cd /var/www/rss-bridge +git pull +cd /var/www/gimmeasearx +git pull +go build -o /usr/local/bin/gimmeaserx ./cmd/main.go diff --git a/upload b/upload index 8a49c91..592f01a 100755 --- a/upload +++ b/upload @@ -1,8 +1,8 @@ #!/bin/bash -url="https://share.redstoneunion.de" -dataDir="/var/www/share" -sshargs="natur" -dirname=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32) +url='https://mrgeorgen.de/share' +dataDir='/var/www/mrgeorgen.de/share' +sshargs='natur' +dirname=`head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32` ssh "$sshargs" mkdir "$dataDir/$dirname" -scp "$1" "$sshargs:$dataDir/$dirname" -echo -n "$url/$dirname/$(basename "$1")" | xclip -sel clip +scp "$(pwd)/$1" "$sshargs:$dataDir/$dirname" +echo -n "$url/$dirname/$(basename "$1" |sed 's@+@ @g;s@%@\\x@g' | xargs -0 printf "%b")" | xclip -sel clip