Comment on What's up, selfhosters? - The Sunday thread
harsh3466@lemmy.ml 5 weeks ago
I’ve been working on some bash scripts to help manage my media files. I’ve been slowly working on learning more bash and I’m pretty pleased with my progress. After I finish this bash book I’m reading (can’t remember the title atm), I think I’m gonna jump into awk.
Xanza@lemm.ee 5 weeks ago
Bash is a really great shell, but consider trying out a functional shell scripting language like Elvish (which is also a shell). Syntatically it’s pretty similar and not hard to pickup, but it’s stupid powerful. A cool example is updating different servers via ssh in parallel using a
servers.json
file;and a little elvish magic;
Just run the script and boom, done. You can even swap out
peach
which isparallel each
foreach
if you want to do each command procedurally–but I really love using peach, especially with file operations over many different files. Linux is fast, but peach is fuckin’ crazy fast. Especially for deleting files, or one thing that I do is extract internal subs (so they play on my chromecast) in my Jellyfin server, using elvish makes it really fast;fd -e mkv | peach {|x| ffmpeg -i $x -map 0:s:0 $x.srt }
Find all
*.mkv
files, pass the filenames through ffmpeg (using peach) and extract the first subtitle asfilename.mkv.srt
. Takes only about a few seconds to do thousands and thousands of video files. I highly recommend it for home-labbers.