cleanup
cleanup cleanup
This commit is contained in:
parent
e66434b56b
commit
fc4ddae64c
17 changed files with 32 additions and 438 deletions
|
@ -4,10 +4,10 @@ start() {
|
|||
pidof -s $1 || $@ >/dev/null 2>&1 &
|
||||
}
|
||||
|
||||
xwallpaper --zoom "${XDG_DATA_HOME:-$HOME/.local/share}/bg"
|
||||
|
||||
xwallpaper --zoom "${XDG_DATA_HOME:-$HOME/.local/share}/bg" &
|
||||
remaps &
|
||||
checkup &
|
||||
|
||||
start playerctld daemon
|
||||
start picom
|
||||
start unclutter -noevents
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
text/x-shellscript=text.desktop;
|
||||
x-scheme-handler/magnet=torrent.desktop;
|
||||
application/x-bittorrent=torrent.desktop;
|
||||
x-scheme-handler/mailto=userapp-Thunderbird-2FQGG1.desktop
|
||||
x-scheme-handler/mailto=mail.desktop
|
||||
text/plain=text.desktop;
|
||||
application/postscript=pdf.desktop;
|
||||
application/pdf=pdf.desktop;
|
||||
|
@ -11,11 +11,6 @@ image/jpeg=img.desktop;
|
|||
image/gif=img.desktop;
|
||||
application/rss+xml=rss.desktop
|
||||
video/x-matroska=video.desktop
|
||||
x-scheme-handler/lbry=lbry.desktop
|
||||
inode/directory=file.desktop
|
||||
message/rfc822=userapp-Thunderbird-2FQGG1.desktop
|
||||
x-scheme-handler/mid=userapp-Thunderbird-2FQGG1.desktop
|
||||
|
||||
[Added Associations]
|
||||
x-scheme-handler/mailto=userapp-Thunderbird-2FQGG1.desktop;
|
||||
x-scheme-handler/mid=userapp-Thunderbird-2FQGG1.desktop;
|
||||
message/rfc822=mail.desktop
|
||||
x-scheme-handler/mid=mail.desktop
|
||||
|
|
|
@ -13,7 +13,6 @@ alias \
|
|||
bc="bc -ql" \
|
||||
mkd="mkdir -pv" \
|
||||
ffmpeg="ffmpeg -hide_banner" \
|
||||
ls="ls -alhNF --color=auto --group-directories-first" \
|
||||
grep="grep --color=auto" \
|
||||
diff="diff --color=auto" \
|
||||
nvidia-settings="nvidia-settings --config=$XDG_CONFIG_HOME/nvidia/settings"
|
||||
|
@ -41,6 +40,7 @@ alias \
|
|||
|
||||
# Misc.
|
||||
alias \
|
||||
ll="ls -alhN --color=auto --group-directories-first"
|
||||
subpush="git push --recurse-submodules=on-demand" \
|
||||
ref="shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" \
|
||||
weath="less -S ${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport" \
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# vim:set ft=zsh
|
||||
[ ! -f $XDG_CACHE_HOME/zsh/history ] && mkdir -p $XDG_CACHE_HOME/zsh && touch $XDG_CACHE_HOME/zsh/history
|
||||
|
||||
setopt HIST_IGNORE_ALL_DUPS HIST_REDUCE_BLANKS HIST_VERIFY BANG_HIST interactive_comments autocd noflowcontrol longlistjobs nonomatch notify hash_list_all share_history histignorespace
|
||||
|
||||
autoload -U colors && colors
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# vim:set ft=zsh
|
||||
PYENV_DIR="${PYENVS_HOME:-${XDG_DATA_HOME:-$HOME/.local/share}/virtualenv}"
|
||||
PYENV_DIR="${PYENVS_HOME:-$XDG_DATA_HOME}/virtualenv}"
|
||||
function chpwd_activate(){
|
||||
[[ "$(pwd)" == "/" ]] && return 0
|
||||
for pydir in $(ls $PYENV_DIR); do
|
||||
|
|
12
.gitmodules
vendored
12
.gitmodules
vendored
|
@ -1,21 +1,21 @@
|
|||
[submodule ".config/nvim"]
|
||||
path = .config/nvim
|
||||
url = https://git.snaile.de/luca/snailvim
|
||||
url = https://github.com/ssnailed/snailvim
|
||||
[submodule ".local/src/dwm"]
|
||||
path = .local/src/dwm
|
||||
url = https://git.snaile.de/luca/dwm
|
||||
url = https://github.com/ssnailed/dwm
|
||||
[submodule ".local/src/dwmblocks"]
|
||||
path = .local/src/dwmblocks
|
||||
url = https://git.snaile.de/luca/dwmblocks
|
||||
url = https://github.com/ssnailed/dwmblocks
|
||||
[submodule ".local/src/dmenu"]
|
||||
path = .local/src/dmenu
|
||||
url = https://git.snaile.de/luca/dmenu
|
||||
url = https://github.com/ssnailed/dmenu
|
||||
[submodule ".local/share/icons/tokyonight"]
|
||||
path = .local/share/icons/tokyonight
|
||||
url = https://git.snaile.de/luca/tokyonight-icons
|
||||
url = https://github.com/ssnailed/tokyonight-icons
|
||||
[submodule ".local/share/themes/tokyonight"]
|
||||
path = .local/share/themes/tokyonight
|
||||
url = https://git.snaile.de/luca/tokyonight-theme
|
||||
url = https://github.com/ssnailed/tokyonight-theme
|
||||
[submodule ".config/zsh/plugins/fast-syntax-highlighting"]
|
||||
path = .config/zsh/plugins/fast-syntax-highlighting
|
||||
url = https://github.com/zdharma-continuum/fast-syntax-highlighting
|
||||
|
|
|
@ -6,14 +6,14 @@ RED='\033[1;30m'
|
|||
NC='\033[0m'
|
||||
dotfiles="${1:-$HOME/.dotfiles}"
|
||||
|
||||
printf "${BLUE}Changing directory to $dotfiles${NC}\n"
|
||||
printf "%bChanging directory to %s %b\n" "$BLUE" "$dotfiles" "$NC"
|
||||
if ! cd "$dotfiles"; then
|
||||
printf "${RED}Could not CD into $dotfiles${NC}\n"
|
||||
printf "%bCould not CD into %s%b\n" "$RED" "$dotfiles" "$NC"
|
||||
exit
|
||||
fi
|
||||
printf "\n"
|
||||
|
||||
printf "${BLUE}Stashing existing changes...${NC}\n"
|
||||
printf "%bStashing existing changes...%b\n" "$BLUE" "$NC"
|
||||
stash_result=$(git stash push -m "sync-dotfiles: Before syncing dotfiles")
|
||||
needs_pop=1
|
||||
if [ "$stash_result" = "No local changes to save" ]; then
|
||||
|
@ -21,39 +21,39 @@ if [ "$stash_result" = "No local changes to save" ]; then
|
|||
fi
|
||||
printf "\n"
|
||||
|
||||
printf "${BLUE}Pulling updates from dotfiles repo...${NC}\n"
|
||||
printf "%bPulling updates from dotfiles repo...%b\n" "$BLUE" "$NC"
|
||||
git pull origin main
|
||||
git submodule update --remote --recursive --init
|
||||
printf "\n"
|
||||
|
||||
if [ $needs_pop -eq 1 ]; then
|
||||
printf "${BLUE}Popping stashed changes...${NC}\n"
|
||||
printf "%bPopping stashed changes...%b\n" "$BLUE" "$NC"
|
||||
git stash pop
|
||||
fi
|
||||
printf "\n"
|
||||
|
||||
unmerged_files=$(git diff --name-only --diff-filter=U)
|
||||
if [ -n "$unmerged_files" ]; then
|
||||
printf "${RED}The following files have merge conflicts after popping the stash:${NC}\n"
|
||||
printf "%bThe following files have merge conflicts after popping the stash:%b\n" "$RED" "$NC"
|
||||
printf "\n"
|
||||
printf %"s\n" "$unmerged_files\n"
|
||||
else
|
||||
stow -t "$HOME" . || printf "${RED}Stow uninstalled or not in path!${NC}\n"
|
||||
stow -t "$HOME" . || printf "%bStow uninstalled or not in path!%b\n" "$RED" "$NC"
|
||||
fi
|
||||
|
||||
printf "${BLUE}Generating librewolf profiles...${NC}\n"
|
||||
$dotfiles/.librewolf/generate.sh
|
||||
printf "%bGenerating librewolf profiles...%b\n" "$BLUE" "$NC"
|
||||
"$dotfiles"/.librewolf/generate.sh
|
||||
printf "\n"
|
||||
|
||||
printf "Recompile/Install src files? [y/N] \n"
|
||||
read ans
|
||||
[ $ans = "y" ] && for f in $dotfiles/.local/src/*; do
|
||||
read -r ans
|
||||
[ "$ans" = "y" ] && for f in "$dotfiles"/.local/src/*; do
|
||||
if ! cd "$f"; then
|
||||
printf "${RED}Could not CD into $f${NC}\n"
|
||||
printf "%bCould not CD into %s%b\n" "$RED" "$f" "$NC"
|
||||
exit
|
||||
fi
|
||||
sudo make install
|
||||
make clean
|
||||
done
|
||||
|
||||
printf "${GREEN}Dotfiles Synced Successfully!${NC}\n"
|
||||
printf "%bDotfiles Synced Successfully!%b\n" "$GREEN" "$NC"
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Requires ffmpeg (audio splitting) and my `tag` wrapper script.
|
||||
|
||||
[ ! -f "$2" ] && printf "The first file should be the audio, the second should be the timecodes.\\n" && exit
|
||||
|
||||
echo "Enter the album/book title:"
|
||||
read -r booktitle
|
||||
|
||||
echo "Enter the artist/author:"
|
||||
read -r author
|
||||
|
||||
echo "Enter the publication year:"
|
||||
read -r year
|
||||
|
||||
inputaudio="$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")"
|
||||
|
||||
! mkdir -p "$escbook" && echo "Do you have write access in this directory?" && exit 1
|
||||
|
||||
# As long as the extension is in the tag script, it'll work.
|
||||
ext="opus"
|
||||
#ext="${1#*.}"
|
||||
|
||||
# Get the total number of tracks from the number of lines.
|
||||
total="$(wc -l <"$2")"
|
||||
|
||||
while read -r x; do
|
||||
end="$(echo "$x" | cut -d' ' -f1)"
|
||||
|
||||
[ -n "$start" ] &&
|
||||
echo "From $start to $end; $track $title"
|
||||
file="$escbook/$(printf "%.2d" "$track")-$esctitle.$ext"
|
||||
[ -n "$start" ] && echo "Splitting \"$title\"..." &&
|
||||
ffmpeg -nostdin -y -loglevel -8 -i "$inputaudio" -ss "$start" -to "$end" -vn -c copy "$file" &&
|
||||
echo "Tagging \"$title\"..." && tag -a "$author" -A "$booktitle" -t "$title" -n "$track" -N "$total" -d "$year" "$file"
|
||||
title="$(echo "$x" | cut -d' ' -f 2-)"
|
||||
esctitle="$(echo "$title" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")"
|
||||
track="$((track + 1))"
|
||||
start="$end"
|
||||
done <"$2"
|
||||
# The last track must be done outside the loop.
|
||||
echo "From $start to the end: $title"
|
||||
file="$escbook/$(printf "%.2d" "$track")-$esctitle.$ext"
|
||||
echo "Splitting \"$title\"..." && ffmpeg -nostdin -y -loglevel -8 -i "$inputaudio" -ss "$start" -vn -c copy "$file" &&
|
||||
echo "Tagging \"$title\"..." && tag -a "$author" -A "$booktitle" -t "$title" -n "$track" -N "$total" -d "$year" "$file"
|
|
@ -1,14 +0,0 @@
|
|||
#!/bin/sh
|
||||
[ -z "$1" ] && echo "Give either a pdf file or a DOI as an argument." && exit
|
||||
|
||||
if [ -f "$1" ]; then
|
||||
# Try to get DOI from pdfinfo or pdftotext output.
|
||||
doi=$(pdfinfo "$1" | grep -io "doi:.*") ||
|
||||
doi=$(pdftotext "$1" - 2>/dev/null | grep -io "doi:.*" -m 1) ||
|
||||
exit 1
|
||||
else
|
||||
doi="$1"
|
||||
fi
|
||||
|
||||
# Check crossref.org for the bib citation.
|
||||
curl -s "https://api.crossref.org/works/$doi/transform/application/x-bibtex" -w "\\n"
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
cat "${XDG_DATA_HOME:-$HOME/.local/share}"/getkeys/"$1" 2>/dev/null && exit
|
||||
echo "Run command with one of the following arguments for info about that program:"
|
||||
ls "${XDG_DATA_HOME:-$HOME/.local/share}"/getkeys
|
|
@ -1,81 +0,0 @@
|
|||
#!/usr/bin/sh
|
||||
|
||||
usage() {
|
||||
printf "Usage : noisereduce <input video file> <output video file>\n"
|
||||
exit
|
||||
}
|
||||
|
||||
# Tests for requirements
|
||||
ifinstalled ffmpeg || {
|
||||
echo >&2 "We require 'ffmpeg' but it's not installed."
|
||||
exit 1
|
||||
}
|
||||
ifinstalled sox || {
|
||||
echo >&2 "We require 'ffmpeg' but it's not installed."
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ "$#" -ne 2 ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
if [ ! -e "$1" ]; then
|
||||
printf "File not found: %s\n" "$1"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ -e "$2" ]; then
|
||||
printf "File %s already exists, overwrite? [y/N]\n: " "$2"
|
||||
read -r yn
|
||||
case $yn in
|
||||
[Yy]*) ;;
|
||||
*) exit ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
inBasename=$(basename "$1")
|
||||
inExt="${inBasename##*.}"
|
||||
|
||||
isVideoStr=$(ffprobe -v warning -show_streams "$1" | grep codec_type=video)
|
||||
if [ -n "$isVideoStr" ]; then
|
||||
isVideo=1
|
||||
printf "Detected %s as a video file\n" "$inBasename"
|
||||
else
|
||||
isVideo=0
|
||||
printf "Detected %s as an audio file\n" "$inBasename"
|
||||
fi
|
||||
|
||||
printf "Sample noise start time [00:00:00]: "
|
||||
read -r sampleStart
|
||||
if [ -z "$sampleStart" ]; then sampleStart="00:00:00"; fi
|
||||
printf "Sample noise end time [00:00:00.900]: "
|
||||
read -r sampleEnd
|
||||
if [ -z "$sampleEnd" ]; then sampleEnd="00:00:00.900"; fi
|
||||
printf "Noise reduction amount [0.21]: "
|
||||
read -r sensitivity
|
||||
if [ -z "$sensitivity" ]; then sensitivity="0.21"; fi
|
||||
|
||||
tmpVidFile="/tmp/noiseclean_tmpvid.$inExt"
|
||||
tmpAudFile="/tmp/noiseclean_tmpaud.wav"
|
||||
noiseAudFile="/tmp/noiseclean_noiseaud.wav"
|
||||
noiseProfFile="/tmp/noiseclean_noise.prof"
|
||||
tmpAudCleanFile="/tmp/noiseclean_tmpaud-clean.wav"
|
||||
|
||||
printf "Cleaning noise on %s...\n" "$1"
|
||||
|
||||
if [ $isVideo -eq "1" ]; then
|
||||
ffmpeg -v warning -y -i "$1" -qscale:v 0 -vcodec copy -an "$tmpVidFile"
|
||||
ffmpeg -v warning -y -i "$1" -qscale:a 0 "$tmpAudFile"
|
||||
else
|
||||
cp "$1" "$tmpAudFile"
|
||||
fi
|
||||
ffmpeg -v warning -y -i "$1" -vn -ss "$sampleStart" -t "$sampleEnd" "$noiseAudFile"
|
||||
sox "$noiseAudFile" -n noiseprof "$noiseProfFile"
|
||||
sox "$tmpAudFile" "$tmpAudCleanFile" noisered "$noiseProfFile" "$sensitivity"
|
||||
if [ $isVideo -eq "1" ]; then
|
||||
ffmpeg -v warning -y -i "$tmpAudCleanFile" -i "$tmpVidFile" -vcodec copy -qscale:v 0 -qscale:a 0 "$2"
|
||||
else
|
||||
cp "$tmpAudCleanFile" "$2"
|
||||
fi
|
||||
|
||||
printf "Done"
|
|
@ -3,7 +3,7 @@
|
|||
# Helps open a file with xdg-open from mutt in a external program without weird side effects.
|
||||
tempdir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard/files"
|
||||
file="$tempdir/$(basename "$1")"
|
||||
[ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid -f xdg-open"
|
||||
opener="setsid -f xdg-open"
|
||||
mkdir -p "$tempdir"
|
||||
cp -f "$1" "$file"
|
||||
$opener "$file" >/dev/null 2>&1
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Get a one-time password, or add a OTP secret to your pass-otp store.
|
||||
|
||||
# The assumption of this script is that all otp passwords are stored with the
|
||||
# suffix `-otp`. This script automatically appends newly added otps as such.
|
||||
|
||||
# For OTP passwords to be generated properly, it is important for the local
|
||||
# computer to have its time properly synced. This can be done with the command
|
||||
# below which requires the package `ntp`.
|
||||
|
||||
ifinstalled pass pass-otp
|
||||
|
||||
dir="${PASSWORD_STORE_DIR}"
|
||||
|
||||
choice="$({
|
||||
echo "🆕add"
|
||||
echo "🕙sync-time"
|
||||
ls ${dir}/*-otp.gpg
|
||||
} | sed "s/.*\///;s/-otp.gpg//" | dmenu -p "Pick a 2FA:")"
|
||||
|
||||
case $choice in
|
||||
🆕add)
|
||||
ifinstalled maim zbar xclip || exit 1
|
||||
|
||||
temp="$dir/temp.png"
|
||||
otp="otp-test-script"
|
||||
trap 'shred -fu $temp; pass rm $otp' HUP INT QUIT TERM PWR EXIT
|
||||
|
||||
notify-send "Scan the image." "Scan the OTP QR code."
|
||||
|
||||
maim -s "$temp" || exit 1
|
||||
info="$(zbarimg -q "$temp")"
|
||||
info="${info#QR-Code:}"
|
||||
issuer="$(echo "$info" | grep -o "issuer=[A-z0-9]\+")"
|
||||
name="${issuer#issuer=}"
|
||||
|
||||
if echo "$info" | pass otp insert "$otp"; then
|
||||
while true; do
|
||||
export name="$(prinf | dmenu -p "Give this One Time Password a one-word name:")"
|
||||
echo "$name" | grep -q -- "^[A-z0-9-]\+$" && break
|
||||
done
|
||||
pass mv "$otp" "$name-otp"
|
||||
notify-send "Successfully added." "$name-otp has been created."
|
||||
else
|
||||
notify-send "No OTP data found." "Try to scan the image again more precisely."
|
||||
fi
|
||||
|
||||
;;
|
||||
🕙sync-time)
|
||||
ifinstalled ntp || exit 1
|
||||
notify-send -u low "🕙 Synchronizing Time..." "Synching time with remote NTP servers..."
|
||||
updatedata="$(sudo ntpdate pool.ntp.org)" &&
|
||||
notify-send -u low "🕙 Synchronizing Time..." "Done. Time changed by ${updatedata#*offset }"
|
||||
;;
|
||||
*) pass otp -c ${choice}-otp ;;
|
||||
esac
|
|
@ -1,4 +1,7 @@
|
|||
#!/bin/sh
|
||||
# These are the groups that will be toggled between. They take the format <layout>:<variant>
|
||||
# If you want the default US layout, use us:basic
|
||||
groups="us:dvorak de:nodeadkeys"
|
||||
|
||||
index() {
|
||||
echo "$groups" | cut -d ' ' -f "$1"
|
||||
|
@ -7,7 +10,6 @@ index() {
|
|||
if [ "$1" = "-n" ]; then
|
||||
newgroup="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
|
||||
elif [ "$1" = "" ]; then
|
||||
groups="us:dvorak de:nodeadkeys"
|
||||
current="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
|
||||
i=1
|
||||
while [ ! "$found" ]; do
|
||||
|
|
|
@ -1,132 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Give a file with images and timecodes and creates a video slideshow of them.
|
||||
#
|
||||
# Timecodes must be in format 00:00:00.
|
||||
#
|
||||
# Imagemagick and ffmpeg required.
|
||||
|
||||
# Application cache if not stated elsewhere.
|
||||
cache="${XDG_CACHE_HOME:-$HOME/.cache}/slider"
|
||||
|
||||
while getopts "hvrpi:c:a:o:d:f:t:e:x:" o; do case "${o}" in
|
||||
c) bgc="$OPTARG" ;;
|
||||
t) fgc="$OPTARG" ;;
|
||||
f) font="$OPTARG" ;;
|
||||
i) file="$OPTARG" ;;
|
||||
a) audio="$OPTARG" ;;
|
||||
o) outfile="$OPTARG" ;;
|
||||
d) prepdir="$OPTARG" ;;
|
||||
r) redo="$OPTARG" ;;
|
||||
s) ppt="$OPTARG" ;;
|
||||
e) endtime="$OPTARG" ;;
|
||||
x)
|
||||
res="$OPTARG"
|
||||
echo "$res" | grep -qv "^[0-9]\+x[0-9]\+$" &&
|
||||
echo "Resolution must be dimensions separated by a 'x': 1280x720, etc." &&
|
||||
exit 1
|
||||
;;
|
||||
p)
|
||||
echo "Purge old build files in $cache? [y/N]"
|
||||
read -r confirm
|
||||
echo "$confirm" | grep -iq "^y$" && rm -rf "$cache" && echo "Done."
|
||||
exit
|
||||
;;
|
||||
v) verbose=True ;;
|
||||
*) echo "$(basename "$0") usage:
|
||||
-i input timecode list (required)
|
||||
-a audio file
|
||||
-c color of background (use html names, black is default)
|
||||
-t text color for text slides (white is default)
|
||||
-s text font size for text slides (150 is default)
|
||||
-f text font for text slides (sans serif is default)
|
||||
-o output video file
|
||||
-e if no audio given, the time in seconds that the last slide will be shown (5 is default)
|
||||
-x resolution (1920x1080 is default)
|
||||
-d tmp directory
|
||||
-r rerun imagemagick commands even if done previously (in case files or background has changed)
|
||||
-p purge old build files instead of running
|
||||
-v be verbose" && exit 1 ;;
|
||||
|
||||
esac done
|
||||
|
||||
# Check that the input file looks like it should.
|
||||
{ head -n 1 "$file" 2>/dev/null | grep -q "^00:00:00 "; } || {
|
||||
echo "Give an input file with -i." &&
|
||||
echo "The file should look as this example:
|
||||
|
||||
00:00:00 first_image.jpg
|
||||
00:00:03 otherdirectory/next_image.jpg
|
||||
00:00:09 this_image_starts_at_9_seconds.jpg
|
||||
etc...
|
||||
|
||||
Timecodes and filenames must be separated by Tabs." &&
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ -n "${audio+x}" ]; then
|
||||
# Check that the audio file looks like an actual audio file.
|
||||
case "$(file --dereference --brief --mime-type -- "$audio")" in
|
||||
audio/*) ;;
|
||||
*)
|
||||
echo "That doesn't look like an audio file."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
totseconds="$(date '+%s' -d $(ffmpeg -i "$audio" 2>&1 | awk '/Duration/ {print $2}' | sed s/,//))"
|
||||
endtime="$((totseconds - seconds))"
|
||||
fi
|
||||
|
||||
prepdir="${prepdir:-$cache/$file}"
|
||||
outfile="${outfile:-$file.mp4}"
|
||||
prepfile="$prepdir/$file.prep"
|
||||
|
||||
[ -n "${verbose+x}" ] && echo "Preparing images... May take a while depending on the number of files."
|
||||
mkdir -p "$prepdir"
|
||||
|
||||
{
|
||||
while read -r x; do
|
||||
# Get the time from the first column.
|
||||
time="${x%% *}"
|
||||
seconds="$(date '+%s' -d "$time")"
|
||||
# Duration is not used on the first looped item.
|
||||
duration="$((seconds - prevseconds))"
|
||||
|
||||
# Get the filename/text content from the rest.
|
||||
content="${x#* }"
|
||||
base="$(basename "$content")"
|
||||
base="${base%.*}.jpg"
|
||||
|
||||
if [ -f "$content" ]; then
|
||||
# If images have already been made in a previous run, do not recreate
|
||||
# them unless -r was given.
|
||||
{ [ ! -f "$prepdir/$base" ] || [ -n "${redo+x}" ]; } &&
|
||||
convert -size "${res:-1920x1080}" canvas:"${bgc:-black}" -gravity center "$content" -resize 1920x1080 -composite "$prepdir/$base"
|
||||
else
|
||||
{ [ ! -f "$prepdir/$base" ] || [ -n "${redo+x}" ]; } &&
|
||||
convert -size "${res:-1920x1080}" -background "${bgc:-black}" -fill "${fgc:-white}" -font "${font:-Sans}" -pointsize "${ppt:-150}" -gravity center label:"$content" "$prepdir/$base"
|
||||
fi
|
||||
|
||||
# If the first line, do not write yet.
|
||||
[ "$time" = "00:00:00" ] || echo "file '$prevbase'
|
||||
duration $duration"
|
||||
|
||||
# Keep the information required for the next file.
|
||||
prevbase="$base"
|
||||
prevtime="$time"
|
||||
prevseconds="$(date '+%s' -d "$prevtime")"
|
||||
done <"$file"
|
||||
# Do last file which must be given twice as follows
|
||||
echo "file '$base'
|
||||
duration ${endtime:-5}
|
||||
file '$base'"
|
||||
} >"$prepfile"
|
||||
if [ -n "${audio+x}" ]; then
|
||||
ffmpeg -hide_banner -y -f concat -safe 0 -i "$prepfile" -i "$audio" -c:a aac -vsync vfr -c:v libx264 -pix_fmt yuv420p "$outfile"
|
||||
else
|
||||
ffmpeg -hide_banner -y -f concat -safe 0 -i "$prepfile" -vsync vfr -c:v libx264 -pix_fmt yuv420p "$outfile"
|
||||
fi
|
||||
|
||||
# Might also try:
|
||||
# -vf "fps=${fps:-24},format=yuv420p" "$outfile"
|
||||
# but has given some problems.
|
|
@ -1,67 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
err() { echo "Usage:
|
||||
tag [OPTIONS] file
|
||||
Options:
|
||||
-a: artist/author
|
||||
-t: song/chapter title
|
||||
-A: album/book title
|
||||
-n: track/chapter number
|
||||
-N: total number of tracks/chapters
|
||||
-d: year of publication
|
||||
-g: genre
|
||||
-c: comment
|
||||
You will be prompted for title, artist, album and track if not given." && exit 1; }
|
||||
|
||||
while getopts "a:t:A:n:N:d:g:c:f:" o; do case "${o}" in
|
||||
a) artist="${OPTARG}" ;;
|
||||
t) title="${OPTARG}" ;;
|
||||
A) album="${OPTARG}" ;;
|
||||
n) track="${OPTARG}" ;;
|
||||
N) total="${OPTARG}" ;;
|
||||
d) date="${OPTARG}" ;;
|
||||
g) genre="${OPTARG}" ;;
|
||||
c) comment="${OPTARG}" ;;
|
||||
f) file="${OPTARG}" ;;
|
||||
*) printf "Invalid option: -%s\\n" "$OPTARG" && err ;;
|
||||
esac done
|
||||
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
file="$1"
|
||||
|
||||
[ ! -f "$file" ] && echo "Provide file to tag." && err
|
||||
|
||||
[ -z "$title" ] && echo "Enter a title." && read -r title
|
||||
[ -z "$artist" ] && echo "Enter an artist." && read -r artist
|
||||
[ -z "$album" ] && echo "Enter an album." && read -r album
|
||||
[ -z "$track" ] && echo "Enter a track number." && read -r track
|
||||
|
||||
case "$file" in
|
||||
*.ogg) echo "Title=$title
|
||||
Artist=$artist
|
||||
Album=$album
|
||||
Track=$track
|
||||
Total=$total
|
||||
Date=$date
|
||||
Genre=$genre
|
||||
Comment=$comment" | vorbiscomment -w "$file" ;;
|
||||
*.opus) echo "Title=$title
|
||||
Artist=$artist
|
||||
Album=$album
|
||||
Track=$track
|
||||
Total=$total
|
||||
Date=$date
|
||||
Genre=$genre
|
||||
Comment=$comment" | opustags -i -S "$file" ;;
|
||||
*.mp3) eyeD3 -Q --remove-all -a "$artist" -A "$album" -t "$title" -n "$track" -N "$total" -Y "$date" "$file" ;;
|
||||
*.flac) echo "TITLE=$title
|
||||
ARTIST=$artist
|
||||
ALBUM=$album
|
||||
TRACKNUMBER=$track
|
||||
TOTALTRACKS=$total
|
||||
DATE=$date
|
||||
GENRE=$genre
|
||||
DESCRIPTION=$comment" | metaflac --remove-all-tags --import-tags-from=- "$file" ;;
|
||||
*) echo "File type not implemented yet." ;;
|
||||
esac
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 371591a7b6f0f3c9501c52a7b566addbfd804d09
|
Loading…
Add table
Reference in a new issue