X-Git-Url: https://git.grml.org/?a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;fp=etc%2Fzsh%2Fzshrc;h=146a5bd90f212d04f5f395499f7021db2356b738;hb=91e66592c4348014dda162477eb7116c45a2326e;hp=88950ca2d456f4842e6515cff6cfe581125ff8bf;hpb=f5f88df4df22ed6d3038994d5481c4c50ebefc1f;p=grml-etc-core.git diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 88950ca..146a5bd 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -3437,53 +3437,6 @@ allulimit() { ulimit -t unlimited } -# 2mp3 transcodes flac and ogg to mp3 with bitrate of 192 while preserving basic tags -if check_com lame; then - 2mp3_192() { - emulate -L zsh - setopt extendedglob - unsetopt ksharrays - - local -a DECODE id3tags - local -A tagmap - local tagdata - local RC=0 - tagmap=("(#l)title" --tt "(#l)artist" --ta "(#l)tracknumber" --tn "(#l)genre" --tg "(#l)album" --tl) - - if [[ ${@[(i)*.ogg]} -le ${#@} ]] && ! check_com oggdec; then - echo "ERROR: please install oggdec" >&2 - return 1 - fi - if [[ ${@[(i)*.flac]} -le ${#@} ]] && ! check_com flac; then - echo "ERROR: please install flac" >&2 - return 1 - fi - - for af in "$@"; do - id3tags=() - case "$af" in - (*.flac) - DECODE=(flac -d -c "$af") - tagdata="$(metaflac --export-tags-to=- "$af")" - ;; - (*.ogg) - DECODE=(oggdec -Q -o - "$af") - tagdata="$(ogginfo "$af")" - ;; - (*) continue ;; - esac - for line (${(f)tagdata}) \ - [[ "$line" == (#s)[[:space:]]#(#b)([^=]##)=(*)(#e) && -n $tagmap[(k)$match[1]] ]] && \ - id3tags+=($tagmap[(k)$match[1]] "$match[2]") - [[ ${#id3tags} -gt 0 ]] && id3tags=(--add-id3v2 --ignore-tag-errors $id3tags) - $DECODE[*] | lame -b 192 -v -h --replaygain-fast "${id3tags[@]}" - "${af:r}.mp3" || {RC=$?; print "Error transcoding" "${af}"; } - done - # return 0 if no error or exit code if at least one error happened - return $RC - } - alias ogg2mp3_192 2mp3_192 -fi - #f5# RFC 2396 URL encoding in Z-Shell urlencode() { emulate -L zsh