diff --git a/AAXtoMP3 b/AAXtoMP3 index 67a5088..70d5b84 100755 --- a/AAXtoMP3 +++ b/AAXtoMP3 @@ -394,13 +394,6 @@ trap 'rm -r -f "${working_directory}"' EXIT # Set up some basic working files ASAP. Note the trap will clean this up no matter what. working_directory=`mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir'` metadata_file="${working_directory}/metadata.txt" -# Creating a temp file to store the chapter data collected in save_metadata, as the output -# folder will only be defined after save_metadata has been executed. -# This file is only required when using audible-cli data and executing in single mode to -# get proper chapter titles in single file m4b output. -if [[ "${audibleCli}" == "1" && "${mode}" == "single" ]] ; then - tmp_chapter_file="${working_directory}/chapter.txt" -fi # ----- # Validate the AAX and extract the metadata associated with the file. @@ -534,6 +527,11 @@ save_metadata() { # chapter titles from the .json generated by audible–cli and store # them correctly formatted for mp4chaps in a chapter.txt if [ "${mode}" == "single" ]; then + # Creating a temp file to store the chapter data collected in save_metadata, as the output + # folder will only be defined after save_metadata has been executed. + # This file is only required when using audible-cli data and executing in single mode to + # get proper chapter titles in single file m4b output. + tmp_chapter_file="${working_directory}/chapter.txt" jq -r \ 'def pad(n): tostring | if (n > length) then ((n - length) * "0") + . else . end; .content_metadata.chapter_info.chapters |