Skip to content
This repository has been archived by the owner on Apr 23, 2023. It is now read-only.

Build additional metadata from library.tsv #226

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions AAXtoMP3
Original file line number Diff line number Diff line change
Expand Up @@ -564,11 +564,21 @@ CHAPTER\((.key))NAME=\(.value.title)"' "${extra_chapter_file}" > "${tmp_chapter_
if [[ ! -z "${asin}" ]]; then
lib_entry=$($GREP "^${asin}" "${library_file}")
if [[ ! -z "${lib_entry}" ]]; then
series_title=$(echo "${lib_entry}" | awk -F '\t' '{print $6}')
series_sequence=$(echo "${lib_entry}" | awk -F '\t' '{print $7}')
# Build additional metadata from library.tsv
idx=1 ; tmpmetadata=""
# Remove '\r' is important
for meta in $(head -n 1 "${library_file}" | tr -d '\r')
do
tmpvar=$(echo "${lib_entry}" | awk -v idx=$idx -F '\t' '{print $idx}')
declare -g "$meta"="$tmpvar"
tmpmetadata=$tmpmetadata"\n $meta\t: $tmpvar"
idx=$(($idx+1))
debug "library.tsv: $meta = $tmpvar"
done
tmpmetadata=${tmpmetadata:2}
debug "$tmpmetadata"
$SED -i "/^ Metadata:/a\\
series : ${series_title}\\
series_sequence : ${series_sequence}" "${metadata_file}"
$tmpmetadata" "${metadata_file}"
fi
fi
fi
Expand Down