Skip to content

Instantly share code, notes, and snippets.

@emaphp
Created February 19, 2020 19:04
Show Gist options
  • Select an option

  • Save emaphp/724279dee8431b50458c1341a02e226a to your computer and use it in GitHub Desktop.

Select an option

Save emaphp/724279dee8431b50458c1341a02e226a to your computer and use it in GitHub Desktop.
Personal Bash aliases
# Refreshes the mpd song list
function mpdupdate() {
sudo killall mpd
rm ~/.mpd/mpd.log && rm ~/.mpd/mpdstate && rm ~/.mpd/mpd.db
mpd && sleep 30
# mpc ls | grep "^[A-Z]" | mpc add
}
alias mpcupdate="mpdupdate"
alias music="mpd; ncmpcpp"
# Converts a MP4 to WEBM
function mp4towebm() {
filename=$(basename -- "$1")
filename="${filename%.*}"
ffmpeg -i "$1" -c:v libvpx-vp9 -crf 8 -b:v 0 -c:a libvorbis "${filename}.webm"
}
# Converts a file to MP3 using pacpl
function tomp3() {
pacpl --to mp3 "$1"
}
# Converts all WEBM files in the folder to MP3s
function convertall() {
OIFS="$IFS"
IFS=$'\n'
for file in `find . -type f -name "*.webm"`
do
pacpl --to mp3 $file
done
IFS="$OIFS"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment