Commit ed665e06 authored by Frank Terbeck's avatar Frank Terbeck

atag: Support configuring how to decode base64 data

parent efa7a1c5
......@@ -149,6 +149,14 @@ Contexts:
Styles:
backend | configures which amded binary is used.
base64 | configures a command that can decode base64 encoded
| data; this command has to be able to read such data
| from stdin and produce the decoded version on stdout.
| The default is ( base64 -d ) which works with the
| base64 utility from the GNU coreutils. This style is
| a list style configuring a command with possible
| arguments.
__EOF__
else
......@@ -296,11 +304,12 @@ function ATAG__amded_read_tags() {
# from `amded'; with the difference, that it assumes that we
# will be working with a single file per run only.
setopt noksharrays
local actx ti readmap
local -a amded tags info o
local actx ti readmap bin
local -a amded tags info o base64
actx="read:${file:e}"
zstyle -s ":atag:${actx}" backend bin || bin='amded'
zstyle -a ":atag:${actx}" base64 base64 || base64=( base64 -d )
zstyle -s ":atag:${actx}" read-map readmap || readmap='mp3=id3v2,apetag,id3v1'
if [[ -n $readmap ]]; then
o=( "-R" $readmap )
......@@ -318,7 +327,7 @@ function ATAG__amded_read_tags() {
if [[ ${info[2]} == *$'\n' ]]; then
# Payload ending in a linefeed signals, that we're looking
# at a base64 encoded string. So let's decode it:
info[2]=$(base64 -d <<< ${info[2]})
info[2]=$("${base64[@]}" <<<${info[2]})
fi
atag[${info[1]}]=${info[2]}
done
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment