From b3b79056eb47a0a1a1c98b01171cf93e2db03fe3 Mon Sep 17 00:00:00 2001 From: Alexei Bezborodov Date: Wed, 10 Jan 2024 15:00:59 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D1=91=D0=BD=20=D0=BB?= =?UTF-8?q?=D0=B8=D1=88=D0=BD=D0=B8=D0=B9=20=D0=B2=D1=80=D0=B5=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=BD=D1=8B=D0=B9=20=D1=84=D0=B0=D0=B9=D0=BB=20=D0=98?= =?UTF-8?q?=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=BE=20=D0=B4?= =?UTF-8?q?=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=81?= =?UTF-8?q?=D1=82=D0=B0=D1=80=D1=82=D0=BE=D0=B2=D0=BE=D0=B3=D0=BE=20=D1=82?= =?UTF-8?q?=D0=B5=D0=BA=D1=81=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pdf2video | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pdf2video b/pdf2video index 599122a..e04c013 100755 --- a/pdf2video +++ b/pdf2video @@ -211,19 +211,18 @@ for ((page=1;page<=${page_count};page++)); do [ $verbose ] && echo "------------------------------------------------" [ $verbose ] && echo "Обрабатываем страницу №$page" - page_text_file=$(mktemp -t "pdf2video_page_text_file_${page}_XXXXXXXXXXX.txt" -) page_image_file=$(mktemp -t "pdf2video_page_image_file_${page}_XXXXXXXXXXX.png" ) - pdftotext -f $page -l $page "${input_file}" "$page_text_file" convert -density "$page_resolution" "${input_file}[$(( $page - 1))]" -quality 98 "$page_image_file" - source_text="${start_text} $(cat "${page_text_file}")" + source_text="$(pdftotext -f $page -l $page "${input_file}" -)" + + source_text="${start_text} $source_text" start_text="" # Добавляем только один раз page_mp3_file=$(mktemp -t "pdf2video_page_mp3_file_XXXXXXXXXXX.mp3") - Text2mp3 "${page_text_file}" "${page_mp3_file}" + Text2mp3 <( echo "$source_text" ) "${page_mp3_file}" [ "${timing_file}" != '' ] && echo "$(GetTimeFromSeconds ${cur_timing}) ${source_text//[$'\t\r\n']/' '}" >> "${timing_file}" cur_timing=$(( ${cur_timing} + $(PlayTime "${page_mp3_file}") )) @@ -234,7 +233,6 @@ for ((page=1;page<=${page_count};page++)); do rm "${page_mp3_file}" rm "${page_image_file}" - rm "${page_text_file}" done