mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-01-30 09:48:11 +01:00
Compare commits
7 Commits
3dec3fb2b1
...
5a6a156826
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a6a156826 | ||
|
|
b8cd0ab495 | ||
|
|
c550a7c6e5 | ||
|
|
d08eea1cf5 | ||
|
|
fe6b9043b8 | ||
|
|
62618ae588 | ||
|
|
f313b6c0f5 |
@ -31,3 +31,4 @@ progressbar_elapsed_color = blue:b
|
||||
statusbar_color = red
|
||||
statusbar_time_color = cyan:b
|
||||
execute_on_song_change="pkill -RTMIN+11 dwmblocks"
|
||||
execute_on_player_state_change="pkill -RTMIN+11 dwmblocks"
|
||||
|
||||
@ -12,7 +12,7 @@ inputaudio="$1"
|
||||
ext="${1##*.}"
|
||||
|
||||
# Get a safe file name from the book.
|
||||
escbook="$(echo "$booktitle" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")"
|
||||
escbook="$(echo "$booktitle" | iconv -c -f UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")"
|
||||
|
||||
! mkdir -p "$escbook" &&
|
||||
echo "Do you have write access in this directory?" &&
|
||||
@ -31,7 +31,7 @@ do
|
||||
cmd="$cmd -metadata artist=\"$author\" -metadata title=\"$title\" -metadata album=\"$booktitle\" -metadata year=\"$year\" -metadata track=\"$track\" -metadata total=\"$total\" -ss \"$start\" -to \"$end\" -vn -c:a copy \"$file\" "
|
||||
fi
|
||||
title="$(echo "$x" | cut -d' ' -f2-)"
|
||||
esctitle="$(echo "$title" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")"
|
||||
esctitle="$(echo "$title" | iconv -c -f UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")"
|
||||
track="$((track+1))"
|
||||
start="$end"
|
||||
done < "$2"
|
||||
|
||||
35
.local/bin/fixnames
Normal file
35
.local/bin/fixnames
Normal file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$(id -u)" = "0" ] && echo "This script should not be run as root" >&2 && exit 1
|
||||
|
||||
find . -type d -path '*/.*' -prune -o -print0 | xargs -0 -n1 -P10 -I{} sh -c '
|
||||
generate_unique_name() {
|
||||
base_name="$1"; ext="$2"; dest_path="$3"; count=1
|
||||
[ -z "$ext" ] && new_name="$base_name" || new_name="${base_name}.${ext}"
|
||||
while [ -e "${dest_path}/${new_name}" ]; do
|
||||
[ -z "$ext" ] && new_name="${base_name}_${count}" || new_name="${base_name}_${count}.${ext}"
|
||||
count=$(( count + 1 ))
|
||||
done
|
||||
echo "$new_name"
|
||||
}
|
||||
process_item() {
|
||||
item_path="$1";
|
||||
[ "$item_path" = "." ] && return
|
||||
dir_name=$(dirname "$item_path"); base_name=$(basename "$item_path")
|
||||
[ -d "$item_path" ] && {
|
||||
new_name=$(echo "$base_name" | sed -E "s/[^a-zA-Z0-9 _.-]+//g; s/[ .-]+/_/g; s/_+/_/g; s/^_//; s/_$//; s/(.*)/\L\1/")
|
||||
[ -z "$new_name" ] && new_name="untitled"
|
||||
} || {
|
||||
file_ext="${base_name##*.}"
|
||||
base_name_no_ext="${base_name%.*}"
|
||||
new_base_name_no_ext=$(echo "$base_name_no_ext" | sed -E "s/[^a-zA-Z0-9 _.-]+//g; s/[ .-]+/_/g; s/_+/_/g; s/^_//; s/_$//; s/(.*)/\L\1/")
|
||||
[ -z "$new_base_name_no_ext" ] && new_base_name_no_ext="untitled"
|
||||
[ -z "$file_ext" ] || [ "$file_ext" = "$base_name_no_ext" ] && new_name="$new_base_name_no_ext" || new_name="${new_base_name_no_ext}.${file_ext}"
|
||||
}
|
||||
[ "$base_name" != "$new_name" ] && {
|
||||
[ -e "${dir_name}/${new_name}" ] && new_name=$(generate_unique_name "${new_name%.*}" "${new_name##*.}" "$dir_name")
|
||||
mv "$item_path" "${dir_name}/${new_name}" 2>/dev/null || true
|
||||
}
|
||||
}
|
||||
process_item "{}"
|
||||
' 2>/dev/null
|
||||
@ -7,7 +7,7 @@ url="${WTTRURL:-wttr.in}"
|
||||
weatherreport="${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport"
|
||||
|
||||
# Get a weather report from 'wttr.in' and save it locally.
|
||||
getforecast() { curl -sf "$url/$LOCATION" > "$weatherreport" || exit 1; }
|
||||
getforecast() { timeout --signal=1 2s curl -sf "$url/$LOCATION" > "$weatherreport" || exit 1; }
|
||||
|
||||
# Forecast should be updated only once a day.
|
||||
checkforecast() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user