Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

fix(calibre): stop ebook-convert only when it stalls, not after 10 minutes (#651)

KnifeLemon232a15faaa31
diff --git a/src/Filee.App/Assets/i18n/ar.json b/src/Filee.App/Assets/i18n/ar.json
index 2e478d2e..10b1b9d8 100644
--- a/src/Filee.App/Assets/i18n/ar.json
+++ b/src/Filee.App/Assets/i18n/ar.json
@@ -96,6 +96,7 @@
"error.live_photo_hdr": "لا يحتوي FFmpeg هذا على مرشح zscale، لذا لا يمكن تحويل فيديو HDR هذا إلى Live / Motion Photo. يحتوي FFmpeg الذي ينزّله Filee عليه",
"error.rhwp_timeout": "لم يتمكن rhwp من إكمال هذا المستند الطويل في الوقت المحدد",
"error.rhwp_timeout_calibre": "لم يتمكن rhwp من إكمال هذا المستند الطويل في الوقت المحدد. للكتب الإلكترونية، انقل Calibre فوق محرك كتابة HWPX من الإعدادات ← المحركات، ليُنشئ Calibre ملف PDF بسرعة أكبر بكثير",
+ "error.engine_stalled": "توقف المحرك عن الاستجابة: لم يحرز أي تقدم لفترة طويلة، لذا تم إيقافه",
"error.needs_shaping": "يحتاج هذا النص إلى LibreOffice لتحويله بصورة صحيحة. ثبّته من الإعدادات ← المحركات",
"error.runtime_missing": "أحد ملفات وقت تشغيل Microsoft Visual C++ التي يحتاجها هذا المحرك مفقود أو قديم. حدّث Filee أو أعد تثبيته، أو ثبّت Microsoft Visual C++ Redistributable ‏(x64)",
"error.conversion_failed": "أبلغ المحرك عن خطأ",
diff --git a/src/Filee.App/Assets/i18n/de.json b/src/Filee.App/Assets/i18n/de.json
index bd6d4181..29461384 100644
--- a/src/Filee.App/Assets/i18n/de.json
+++ b/src/Filee.App/Assets/i18n/de.json
@@ -96,6 +96,7 @@
"error.live_photo_hdr": "Dieser FFmpeg-Version fehlt der zscale-Filter. Deshalb lässt sich dieses HDR-Video nicht in ein Live / Motion Photo umwandeln. Der FFmpeg-Download von Filee enthält den Filter",
"error.rhwp_timeout": "rhwp konnte dieses lange Dokument nicht rechtzeitig fertigstellen",
"error.rhwp_timeout_calibre": "rhwp konnte dieses lange Dokument nicht rechtzeitig fertigstellen. Verschiebe bei E-Books Calibre unter Einstellungen → Module über den HWPX-Writer. Calibre erstellt die PDF deutlich schneller",
+ "error.engine_stalled": "Das Modul reagiert nicht mehr: Es kam lange nicht voran und wurde beendet",
"error.needs_shaping": "Diese Schrift benötigt LibreOffice für eine korrekte Konvertierung. Installiere es unter Einstellungen → Module",
"error.runtime_missing": "Eine von diesem Modul benötigte Microsoft-Visual-C++-Laufzeitdatei fehlt oder ist veraltet. Aktualisiere Filee, installiere es neu oder installiere Microsoft Visual C++ Redistributable (x64)",
"error.conversion_failed": "Das Modul hat einen Fehler gemeldet",
diff --git a/src/Filee.App/Assets/i18n/en.json b/src/Filee.App/Assets/i18n/en.json
index f41855fa..19e09238 100644
--- a/src/Filee.App/Assets/i18n/en.json
+++ b/src/Filee.App/Assets/i18n/en.json
@@ -102,6 +102,7 @@
"error.live_photo_hdr": "This FFmpeg has no zscale filter, so this HDR video can't become a Live / Motion Photo. Filee's FFmpeg download has it",
"error.rhwp_timeout": "rhwp couldn't finish this long document in time",
"error.rhwp_timeout_calibre": "rhwp couldn't finish this long document in time. For an e-book, move Calibre above the HWPX writer in Settings → Engines, and Calibre makes the PDF much faster",
+ "error.engine_stalled": "The engine stopped responding: it showed no progress for a long time, so it was stopped",
"error.needs_shaping": "This script needs LibreOffice to convert correctly. Install it in Settings → Engines",
"error.runtime_missing": "A Microsoft Visual C++ runtime file this engine needs is missing or outdated. Update or reinstall Filee, or install the Microsoft Visual C++ Redistributable (x64)",
"error.conversion_failed": "The engine reported an error",
diff --git a/src/Filee.App/Assets/i18n/es.json b/src/Filee.App/Assets/i18n/es.json
index 18f3d58d..b0b57c63 100644
--- a/src/Filee.App/Assets/i18n/es.json
+++ b/src/Filee.App/Assets/i18n/es.json
@@ -96,6 +96,7 @@
"error.live_photo_hdr": "Este FFmpeg no tiene el filtro zscale, así que este vídeo HDR no puede convertirse en Live Photo ni Motion Photo. El FFmpeg que descarga Filee lo tiene",
"error.rhwp_timeout": "rhwp no pudo terminar este documento largo a tiempo",
"error.rhwp_timeout_calibre": "rhwp no pudo terminar este documento largo a tiempo. Para un libro electrónico, mueve Calibre por encima del escritor HWPX en Ajustes → Motores; Calibre genera el PDF mucho más rápido",
+ "error.engine_stalled": "El motor dejó de responder: no avanzó durante mucho tiempo y se detuvo",
"error.needs_shaping": "Este sistema de escritura necesita LibreOffice para convertirse bien. Instálalo en Ajustes → Motores",
"error.runtime_missing": "Falta un archivo del runtime de Microsoft Visual C++ que necesita este motor, o está desactualizado. Actualiza o reinstala Filee, o instala Microsoft Visual C++ Redistributable (x64)",
"error.conversion_failed": "El motor devolvió un error",
diff --git a/src/Filee.App/Assets/i18n/fr.json b/src/Filee.App/Assets/i18n/fr.json
index c5d243b5..649526e5 100644
--- a/src/Filee.App/Assets/i18n/fr.json
+++ b/src/Filee.App/Assets/i18n/fr.json
@@ -102,6 +102,7 @@
"error.live_photo_hdr": "Ce FFmpeg n'a pas le filtre zscale : cette vidéo HDR ne peut donc pas devenir une Live Photo ou une Motion Photo. Le FFmpeg téléchargé par Filee l'inclut",
"error.rhwp_timeout": "rhwp n'a pas pu terminer ce long document à temps",
"error.rhwp_timeout_calibre": "rhwp n'a pas pu terminer ce long document à temps. Pour un livre numérique, placez Calibre au-dessus du rédacteur HWPX dans Paramètres → Moteurs : Calibre produira le PDF bien plus vite",
+ "error.engine_stalled": "Le moteur ne répond plus : il n'a pas progressé pendant longtemps et a été arrêté",
"error.needs_shaping": "Cette écriture nécessite LibreOffice pour être convertie correctement. Installez-le dans Paramètres → Moteurs",
"error.runtime_missing": "Un fichier du runtime Microsoft Visual C++ requis par ce moteur est manquant ou obsolète. Mettez à jour ou réinstallez Filee, ou installez Microsoft Visual C++ Redistributable (x64)",
"error.conversion_failed": "Le moteur a signalé une erreur",
diff --git a/src/Filee.App/Assets/i18n/hi.json b/src/Filee.App/Assets/i18n/hi.json
index a3e798a5..3b97e92b 100644
--- a/src/Filee.App/Assets/i18n/hi.json
+++ b/src/Filee.App/Assets/i18n/hi.json
@@ -96,6 +96,7 @@
"error.live_photo_hdr": "इस FFmpeg में zscale फ़िल्टर नहीं है, इसलिए यह HDR वीडियो लाइव / मोशन फ़ोटो नहीं बन सकता। Filee से डाउनलोड होने वाले FFmpeg में यह है",
"error.rhwp_timeout": "rhwp इस लंबे दस्तावेज़ को समय पर पूरा नहीं कर सका",
"error.rhwp_timeout_calibre": "rhwp इस लंबे दस्तावेज़ को समय पर पूरा नहीं कर सका। ई-बुक के लिए, सेटिंग्स → इंजन में Calibre को HWPX writer के ऊपर ले जाएँ, तब Calibre PDF बहुत तेज़ी से बनाएगा",
+ "error.engine_stalled": "इंजन ने जवाब देना बंद कर दिया: लंबे समय तक कोई प्रगति नहीं हुई, इसलिए इसे रोक दिया गया",
"error.needs_shaping": "इस लिपि को सही ढंग से कन्वर्ट करने के लिए LibreOffice चाहिए। इसे सेटिंग्स → इंजन में इंस्टॉल करें",
"error.runtime_missing": "इस इंजन के लिए ज़रूरी Microsoft Visual C++ रनटाइम फ़ाइल नहीं मिली या पुरानी है। Filee को अपडेट करें या फिर से इंस्टॉल करें, या Microsoft Visual C++ Redistributable (x64) इंस्टॉल करें",
"error.conversion_failed": "इंजन ने एक त्रुटि बताई",
diff --git a/src/Filee.App/Assets/i18n/ja.json b/src/Filee.App/Assets/i18n/ja.json
index b6960a36..9f32f397 100644
--- a/src/Filee.App/Assets/i18n/ja.json
+++ b/src/Filee.App/Assets/i18n/ja.json
@@ -96,6 +96,7 @@
"error.live_photo_hdr": "このFFmpegにはzscaleフィルターがないため、HDR動画をLive Photo/モーションフォトにできません。FileeからダウンロードするFFmpegにはあります",
"error.rhwp_timeout": "文書が長いため、rhwpが制限時間内に処理を終えられませんでした",
"error.rhwp_timeout_calibre": "文書が長いため、rhwpが制限時間内に処理を終えられませんでした。電子書籍の場合は、「設定」→「変換エンジン」でCalibreを「HWPX writer」より上に移動してください。CalibreならPDFを大幅に速く作成できます",
+ "error.engine_stalled": "変換エンジンが応答しなくなりました。長時間進まなかったため停止しました",
"error.needs_shaping": "この文字体系の文書を正しく変換するにはLibreOfficeが必要です。「設定」→「変換エンジン」でインストールしてください",
"error.runtime_missing": "このエンジンに必要なMicrosoft Visual C++ランタイムのファイルがないか、古くなっています。Filee を更新または再インストールするか、Microsoft Visual C++ 再頒布可能パッケージ(x64)をインストールしてください",
"error.conversion_failed": "変換エンジンからエラーが報告されました",
diff --git a/src/Filee.App/Assets/i18n/ko.json b/src/Filee.App/Assets/i18n/ko.json
index 09604dda..7a88be7c 100644
--- a/src/Filee.App/Assets/i18n/ko.json
+++ b/src/Filee.App/Assets/i18n/ko.json
@@ -102,6 +102,7 @@
"error.live_photo_hdr": "이 FFmpeg에는 zscale 필터가 없어서 HDR 동영상을 라이브/모션 포토로 만들 수 없어요. Filee에서 내려받는 FFmpeg에는 있어요",
"error.rhwp_timeout": "문서가 길어서 rhwp가 제한 시간 안에 끝내지 못했어요",
"error.rhwp_timeout_calibre": "문서가 길어서 rhwp가 제한 시간 안에 끝내지 못했어요. 전자책이라면 설정 → 변환 엔진에서 Calibre를 HWPX writer보다 위로 옮겨 주세요. Calibre가 PDF를 훨씬 빨리 만들어요",
+ "error.engine_stalled": "엔진이 응답하지 않아요. 오랫동안 진행되지 않아서 중지했어요",
"error.needs_shaping": "이 문자는 LibreOffice가 있어야 제대로 변환돼요. 설정 → 변환 엔진에서 설치해 주세요",
"error.runtime_missing": "이 엔진에 필요한 Microsoft Visual C++ 런타임 파일이 없거나 오래됐어요. Filee를 업데이트하거나 다시 설치하거나, Microsoft Visual C++ 재배포 가능 패키지(x64)를 설치해 주세요",
"error.conversion_failed": "엔진에서 오류가 발생했어요",
diff --git a/src/Filee.App/Assets/i18n/ne.json b/src/Filee.App/Assets/i18n/ne.json
index dade701b..6f69a2e4 100644
--- a/src/Filee.App/Assets/i18n/ne.json
+++ b/src/Filee.App/Assets/i18n/ne.json
@@ -96,6 +96,7 @@
"error.live_photo_hdr": "यस FFmpeg मा zscale फिल्टर छैन, त्यसैले यो HDR भिडियो लाइभ / मोशन फोटो बन्न सक्दैन। Filee को FFmpeg डाउनलोडमा यो उपलब्ध छ",
"error.rhwp_timeout": "rhwp ले यस लामो कागजातलाई समयमै पूरा गर्न सकेन",
"error.rhwp_timeout_calibre": "rhwp ले यस लामो कागजातलाई समयमै पूरा गर्न सकेन। इ-पुस्तकका लागि, सेटिङहरू → इन्जिनहरूमा गएर Calibre लाई HWPX writer भन्दा माथि सार्नुहोस्, र Calibre ले PDF धेरै छिटो बनाउनेछ",
+ "error.engine_stalled": "इन्जिनले प्रतिक्रिया दिन बन्द गर्‍यो: लामो समयसम्म कुनै प्रगति नभएकाले यसलाई रोकियो",
"error.needs_shaping": "यस लिपिलाई सही रूपमा रूपान्तरण गर्न LibreOffice आवश्यक पर्दछ। यसलाई सेटिङहरू → इन्जिनहरूमा स्थापना गर्नुहोस्",
"error.runtime_missing": "यो इन्जिनलाई आवश्यक पर्ने Microsoft Visual C++ रनटाइम फाइल फेला परेन वा पुरानो भयो। Filee लाई अपडेट वा पुन: स्थापना गर्नुहोस्, वा Microsoft Visual C++ Redistributable (x64) स्थापना गर्नुहोस्",
"error.conversion_failed": "इन्जिनले त्रुटि रिपोर्ट गर्‍यो",
diff --git a/src/Filee.App/Assets/i18n/pl.json b/src/Filee.App/Assets/i18n/pl.json
index 0c7af06e..394fcd81 100644
--- a/src/Filee.App/Assets/i18n/pl.json
+++ b/src/Filee.App/Assets/i18n/pl.json
@@ -102,6 +102,7 @@
"error.live_photo_hdr": "Ten FFmpeg nie ma filtra zscale, więc z tego wideo HDR nie powstanie Live Photo ani Motion Photo. FFmpeg pobierany przez Filee go ma",
"error.rhwp_timeout": "rhwp nie zdążył przetworzyć tego długiego dokumentu",
"error.rhwp_timeout_calibre": "rhwp nie zdążył przetworzyć tego długiego dokumentu. Dla e-booka przenieś Calibre nad HWPX writer w Ustawienia → Silniki, a Calibre zrobi PDF znacznie szybciej",
+ "error.engine_stalled": "Silnik przestał odpowiadać: długo nie robił postępów, więc został zatrzymany",
"error.needs_shaping": "To pismo wymaga LibreOffice do poprawnej konwersji. Zainstaluj go w Ustawienia → Silniki",
"error.runtime_missing": "Brakuje pliku środowiska Microsoft Visual C++ potrzebnego temu silnikowi albo jest on nieaktualny. Zaktualizuj lub zainstaluj ponownie Filee albo zainstaluj Microsoft Visual C++ Redistributable (x64)",
"error.conversion_failed": "Silnik zgłosił błąd",
diff --git a/src/Filee.App/Assets/i18n/pt-BR.json b/src/Filee.App/Assets/i18n/pt-BR.json
index 88d47fda..302aeeb9 100644
--- a/src/Filee.App/Assets/i18n/pt-BR.json
+++ b/src/Filee.App/Assets/i18n/pt-BR.json
@@ -102,6 +102,7 @@
"error.live_photo_hdr": "Este FFmpeg não tem o filtro zscale, então este vídeo HDR não pode virar Live / Motion Photo. O FFmpeg que o Filee baixa tem esse filtro",
"error.rhwp_timeout": "O rhwp não conseguiu terminar este documento longo a tempo",
"error.rhwp_timeout_calibre": "O rhwp não conseguiu terminar este documento longo a tempo. Para um e-book, coloque o Calibre acima do gravador de HWPX em Configurações → Motores. O Calibre gera o PDF bem mais rápido",
+ "error.engine_stalled": "O motor parou de responder: ficou muito tempo sem progresso e foi interrompido",
"error.needs_shaping": "Este alfabeto precisa do LibreOffice para converter corretamente. Instale-o em Configurações → Motores",
"error.runtime_missing": "Falta um arquivo do tempo de execução do Microsoft Visual C++ que este motor precisa, ou ele está desatualizado. Atualize ou reinstale o Filee, ou instale o Microsoft Visual C++ Redistributable (x64)",
"error.conversion_failed": "O motor informou um erro",
diff --git a/src/Filee.App/Assets/i18n/pt-PT.json b/src/Filee.App/Assets/i18n/pt-PT.json
index f89ce25c..6003988a 100644
--- a/src/Filee.App/Assets/i18n/pt-PT.json
+++ b/src/Filee.App/Assets/i18n/pt-PT.json
@@ -102,6 +102,7 @@
"error.live_photo_hdr": "Este FFmpeg não tem o filtro zscale, pelo que este vídeo HDR não pode ser convertido em Live / Motion Photo. A versão do FFmpeg que o Filee disponibiliza para descarregar inclui esse filtro",
"error.rhwp_timeout": "O rhwp não conseguiu concluir este documento longo a tempo",
"error.rhwp_timeout_calibre": "O rhwp não conseguiu concluir este documento longo a tempo. Para um livro digital, coloca o Calibre acima do gerador HWPX em Definições → Motores. O Calibre cria o PDF muito mais depressa",
+ "error.engine_stalled": "O motor deixou de responder: esteve muito tempo sem progresso e foi parado",
"error.needs_shaping": "Este sistema de escrita precisa do LibreOffice para ser convertido corretamente. Instala-o em Definições → Motores",
"error.runtime_missing": "Um componente de execução do Microsoft Visual C++ necessário a este motor está em falta ou desatualizado. Atualiza ou reinstala o Filee, ou instala o Microsoft Visual C++ Redistributable (x64)",
"error.conversion_failed": "O motor comunicou um erro",
diff --git a/src/Filee.App/Assets/i18n/ru.json b/src/Filee.App/Assets/i18n/ru.json
index 47f36cb2..f9c8b44b 100644
--- a/src/Filee.App/Assets/i18n/ru.json
+++ b/src/Filee.App/Assets/i18n/ru.json
@@ -102,6 +102,7 @@
"error.live_photo_hdr": "В этом FFmpeg нет фильтра zscale, поэтому из этого HDR-видео нельзя сделать Live Photo или Motion Photo. В FFmpeg, который скачивает Filee, он есть",
"error.rhwp_timeout": "rhwp не успел обработать этот длинный документ",
"error.rhwp_timeout_calibre": "rhwp не успел обработать этот длинный документ. Для электронной книги поставьте Calibre выше HWPX writer в разделе «Настройки → Движки» — так Calibre сделает PDF намного быстрее",
+ "error.engine_stalled": "Движок перестал отвечать: он долго не продвигался и был остановлен",
"error.needs_shaping": "Чтобы правильно сконвертировать текст в этой системе письма, нужен LibreOffice. Установите его в разделе «Настройки → Движки»",
"error.runtime_missing": "Не хватает файла среды выполнения Microsoft Visual C++, нужного этому движку, или он устарел. Обновите или переустановите Filee либо установите Microsoft Visual C++ Redistributable (x64)",
"error.conversion_failed": "Движок сообщил об ошибке",
diff --git a/src/Filee.App/Assets/i18n/th.json b/src/Filee.App/Assets/i18n/th.json
index ff9466b6..b5259424 100644
--- a/src/Filee.App/Assets/i18n/th.json
+++ b/src/Filee.App/Assets/i18n/th.json
@@ -96,6 +96,7 @@
"error.live_photo_hdr": "FFmpeg นี้ไม่มีตัวกรอง zscale จึงไม่สามารถแปลงวิดีโอ HDR นี้เป็น Live / Motion Photo ได้ (FFmpeg ที่ Filee ดาวน์โหลดจะมีตัวกรองนี้)",
"error.rhwp_timeout": "rhwp ไม่สามารถประมวลผลเอกสารขนาดยาวนี้ได้ทันเวลา",
"error.rhwp_timeout_calibre": "rhwp ไม่สามารถประมวลผลเอกสารขนาดยาวนี้ได้ทันเวลา สำหรับอีบุ๊ก ให้ย้าย Calibre ไปไว้เหนือตัวเขียน HWPX ใน การตั้งค่า → เครื่องมือแปลงไฟล์ Calibre จะสร้าง PDF ได้เร็วกว่ามาก",
+ "error.engine_stalled": "เครื่องมือแปลงไฟล์หยุดตอบสนอง: ไม่มีความคืบหน้าเป็นเวลานาน จึงถูกหยุดการทำงาน",
"error.needs_shaping": "ภาษานี้ต้องใช้ LibreOffice เพื่อแปลงให้ถูกต้อง ติดตั้งได้ในการตั้งค่า → เครื่องมือแปลงไฟล์",
"error.runtime_missing": "ไฟล์รันไทม์ Microsoft Visual C++ ที่เครื่องมือนี้ต้องใช้ขาดหายไปหรือล้าสมัย โปรดอัปเดตหรือติดตั้ง Filee ใหม่ หรือติดตั้ง Microsoft Visual C++ Redistributable (x64)",
"error.conversion_failed": "เครื่องมือแปลงไฟล์รายงานข้อผิดพลาด",
diff --git a/src/Filee.App/Assets/i18n/tr.json b/src/Filee.App/Assets/i18n/tr.json
index ad1043c9..b7c226ef 100644
--- a/src/Filee.App/Assets/i18n/tr.json
+++ b/src/Filee.App/Assets/i18n/tr.json
@@ -96,6 +96,7 @@
"error.live_photo_hdr": "Bu FFmpeg'de zscale filtresi yok; bu yüzden HDR video Live / Motion Photo'ya dönüştürülemiyor. Filee'nin indirdiği FFmpeg bu filtreyi içerir",
"error.rhwp_timeout": "rhwp bu uzun belgeyi zamanında tamamlayamadı",
"error.rhwp_timeout_calibre": "rhwp bu uzun belgeyi zamanında tamamlayamadı. E-kitaplar için Ayarlar → Dönüştürme motorları bölümünde Calibre'yi HWPX yazıcısının üstüne taşıyın; Calibre PDF'yi çok daha hızlı oluşturur",
+ "error.engine_stalled": "Motor yanıt vermeyi bıraktı: uzun süre ilerleme göstermediği için durduruldu",
"error.needs_shaping": "Bu yazı sisteminin doğru dönüştürülmesi için LibreOffice gerekli. Ayarlar → Dönüştürme motorları bölümünden kurun",
"error.runtime_missing": "Bu motorun ihtiyaç duyduğu bir Microsoft Visual C++ çalışma zamanı dosyası eksik veya eski. Filee'yi güncelleyin ya da yeniden kurun veya Microsoft Visual C++ Redistributable (x64) yükleyin",
"error.conversion_failed": "Motor bir hata bildirdi",
diff --git a/src/Filee.App/Assets/i18n/zh-CN.json b/src/Filee.App/Assets/i18n/zh-CN.json
index e0b384c6..ebeed441 100644
--- a/src/Filee.App/Assets/i18n/zh-CN.json
+++ b/src/Filee.App/Assets/i18n/zh-CN.json
@@ -102,6 +102,7 @@
"error.live_photo_hdr": "此 FFmpeg 没有 zscale 滤镜,无法把 HDR 视频制作成实况/动态照片。Filee 下载的 FFmpeg 带有该滤镜",
"error.rhwp_timeout": "文档太长,rhwp 未能在时限内完成",
"error.rhwp_timeout_calibre": "文档太长,rhwp 未能在时限内完成。如果是电子书,请在“设置 → 转换引擎”中把 Calibre 移到 HWPX writer 之上,Calibre 生成 PDF 要快得多",
+ "error.engine_stalled": "转换引擎停止响应:长时间没有进展,已将其停止",
"error.needs_shaping": "这种文字需要 LibreOffice 才能正确转换,请在“设置 → 转换引擎”中安装",
"error.runtime_missing": "此引擎所需的 Microsoft Visual C++ 运行库文件缺失或版本过旧。请更新或重新安装 Filee,或安装 Microsoft Visual C++ 可再发行程序包 (x64)",
"error.conversion_failed": "转换引擎出错",
diff --git a/src/Filee.App/Assets/i18n/zh-TW.json b/src/Filee.App/Assets/i18n/zh-TW.json
index ae6a3806..91de133f 100644
--- a/src/Filee.App/Assets/i18n/zh-TW.json
+++ b/src/Filee.App/Assets/i18n/zh-TW.json
@@ -102,6 +102,7 @@
"error.live_photo_hdr": "此 FFmpeg 沒有 zscale 濾鏡,無法把 HDR 影片製作成原況/動態相片。Filee 下載的 FFmpeg 帶有該濾鏡",
"error.rhwp_timeout": "文件太長,rhwp 未能在時限內完成",
"error.rhwp_timeout_calibre": "文件太長,rhwp 未能在時限內完成。如果是電子書,請在「設定 → 轉換引擎」中把 Calibre 移到 HWPX writer 之上,Calibre 產生 PDF 要快得多",
+ "error.engine_stalled": "轉換引擎停止回應:長時間沒有進展,已將其停止",
"error.needs_shaping": "這種文字需要 LibreOffice 才能正確轉換,請在「設定 → 轉換引擎」中安裝",
"error.runtime_missing": "此引擎所需的 Microsoft Visual C++ 執行階段程式庫檔案缺失或版本過舊。請更新或重新安裝 Filee,或安裝 Microsoft Visual C++ 可轉散發套件 (x64)",
"error.conversion_failed": "轉換引擎出錯",
diff --git a/src/Filee.Engines/Ebooks/CalibreConverter.cs b/src/Filee.Engines/Ebooks/CalibreConverter.cs
index 931dc21a..64c0b378 100644
--- a/src/Filee.Engines/Ebooks/CalibreConverter.cs
+++ b/src/Filee.Engines/Ebooks/CalibreConverter.cs
@@ -19,7 +19,12 @@ namespace Filee.Engines.Ebooks;
/// <summary>Conversions through calibre's ebook-convert.</summary>
public sealed partial class CalibreConverter : IConverter
{
- private static readonly TimeSpan Timeout = TimeSpan.FromMinutes(10);
+ /// <summary>
+ /// ebook-convert prints its progress ("34% Running transforms on e-book...") as it works, so a book takes as long as
+ /// it needs: a 300 MB CHM made into a PDF passed the former fixed 10 minutes (#651). Only this long without a single
+ /// line means calibre is stuck. As long as that limit was, so no conversion that finished before stops now.
+ /// </summary>
+ internal static readonly TimeSpan StallTimeout = TimeSpan.FromMinutes(10);
/// <summary>Formats only calibre reads.</summary>
internal static readonly string[] Inputs = ["lit", "lrf", "chm", "pdb", "pml", "rb", "snb", "tcr", "oeb"];
@@ -80,10 +85,12 @@ public sealed partial class CalibreConverter : IConverter
["CALIBRE_TEMP_DIR"] = Directory.CreateDirectory(Path.Combine(work, "temp")).FullName,
["CALIBRE_OVERRIDE_LANG"] = "en", // English messages in the error details, whatever the Windows language
["PYTHONIOENCODING"] = "utf-8",
+ ["PYTHONUNBUFFERED"] = "1", // each progress line as it is printed: the stall watch counts on them
};
progress?.Report(0.02);
- var result = await ProcessRunner.RunAsync(executable, [input, temp, .. OutputOptions(step.To)], Timeout, cancellationToken,
- workingDirectory: work, environment: environment, onOutput: line => ReportProgress(line, progress));
+ var result = await ProcessRunner.RunAsync(executable, [input, temp, .. OutputOptions(step.To)], Timeout.InfiniteTimeSpan,
+ cancellationToken, workingDirectory: work, environment: environment, onOutput: line => ReportProgress(line, progress),
+ stallTimeout: StallTimeout);
if (result.ExitCode != 0 || !File.Exists(temp))
throw new InvalidOperationException($"Calibre failed (exit {result.ExitCode}). {LastLines(result.StandardError.Trim().Length > 0 ? result.StandardError : result.StandardOutput)}");
diff --git a/src/Filee.Engines/Infrastructure/ProcessRunner.cs b/src/Filee.Engines/Infrastructure/ProcessRunner.cs
index d3671a80..8861783b 100644
--- a/src/Filee.Engines/Infrastructure/ProcessRunner.cs
+++ b/src/Filee.Engines/Infrastructure/ProcessRunner.cs
@@ -1,7 +1,9 @@
-// Runs command line engines (LibreOffice, rhwp, ...) with a timeout, cancellation and captured output.
+// Runs command line engines (LibreOffice, rhwp, ...) with a timeout, cancellation and captured output. Engines that
+// report their progress while they work (calibre) can be stopped when they go silent instead (see StallWatch).
using System.Diagnostics;
using System.Text;
+using Filee.Core.Conversion;
namespace Filee.Engines.Infrastructure;
@@ -11,14 +13,24 @@ public sealed record ProcessResult(int ExitCode, string StandardOutput, string S
/// <summary>Helper for starting external tools safely.</summary>
public static class ProcessRunner
{
+ /// <summary>The reason shown when a program stopped writing anything for the stall limit and was stopped.</summary>
+ public const string StalledErrorKey = "error.engine_stalled";
+
/// <summary>
/// Starts <paramref name="executable"/> with the given arguments (no shell, arguments are escaped),
/// waits for it to exit and kills the whole process tree on timeout or cancellation.
/// </summary>
- /// <exception cref="Filee.Core.Conversion.ConversionRefusedException">
- /// Windows could not start the program because a DLL is missing (see <see cref="AppLocalRuntime"/>).
+ /// <exception cref="ConversionRefusedException">
+ /// Windows could not start the program because a DLL is missing (see <see cref="AppLocalRuntime"/>), or it stalled
+ /// (<see cref="StalledErrorKey"/>).
/// </exception>
+ /// <exception cref="TimeoutException">The program did not exit within <paramref name="timeout"/>; it was killed.</exception>
+ /// <param name="timeout">The longest the program may run; <see cref="Timeout.InfiniteTimeSpan"/> for no limit.</param>
/// <param name="onOutput">Called with every line of standard output and error as it arrives (e.g. to parse progress).</param>
+ /// <param name="stallTimeout">
+ /// When set, the program is also killed once it has written nothing (no line on either stream) for this long: for
+ /// engines that keep reporting progress, so a long run that does goes on and a hung one stops early.
+ /// </param>
public static async Task<ProcessResult> RunAsync(
string executable,
IEnumerable<string> arguments,
@@ -26,7 +38,8 @@ public static class ProcessRunner
CancellationToken cancellationToken,
string? workingDirectory = null,
IDictionary<string, string>? environment = null,
- Action<string>? onOutput = null)
+ Action<string>? onOutput = null,
+ TimeSpan? stallTimeout = null)
{
var psi = new ProcessStartInfo(executable)
{
@@ -47,8 +60,9 @@ public static class ProcessRunner
using var process = new Process { StartInfo = psi };
var stdout = new StringBuilder();
var stderr = new StringBuilder();
- process.OutputDataReceived += (_, e) => { if (e.Data is not null) { lock (stdout) stdout.AppendLine(e.Data); onOutput?.Invoke(e.Data); } };
- process.ErrorDataReceived += (_, e) => { if (e.Data is not null) { lock (stderr) stderr.AppendLine(e.Data); onOutput?.Invoke(e.Data); } };
+ var watch = stallTimeout is { } limit ? new StallWatch(limit) : null;
+ process.OutputDataReceived += (_, e) => { if (e.Data is not null) { watch?.Touch(); lock (stdout) stdout.AppendLine(e.Data); onOutput?.Invoke(e.Data); } };
+ process.ErrorDataReceived += (_, e) => { if (e.Data is not null) { watch?.Touch(); lock (stderr) stderr.AppendLine(e.Data); onOutput?.Invoke(e.Data); } };
if (!process.Start())
throw new InvalidOperationException($"Could not start {executable}.");
@@ -59,7 +73,14 @@ public static class ProcessRunner
timeoutCts.CancelAfter(timeout);
try
{
- await process.WaitForExitAsync(timeoutCts.Token);
+ var exited = process.WaitForExitAsync(timeoutCts.Token);
+ if (watch is null)
+ await exited;
+ else if (!await watch.WaitAsync(exited, timeoutCts.Token))
+ {
+ TryKill(process);
+ throw new ConversionRefusedException(StalledErrorKey, $"{Path.GetFileName(executable)}, {Describe(watch.Limit)}");
+ }
}
catch (OperationCanceledException)
{
@@ -74,6 +95,10 @@ public static class ProcessRunner
return new ProcessResult(process.ExitCode, stdout.ToString(), stderr.ToString());
}
+ /// <summary>"10 min", or "30 s" below a minute.</summary>
+ internal static string Describe(TimeSpan limit) =>
+ limit >= TimeSpan.FromMinutes(1) ? $"{limit.TotalMinutes:0} min" : $"{limit.TotalSeconds:0} s";
+
private static void TryKill(Process process)
{
try
diff --git a/src/Filee.Engines/Infrastructure/StallWatch.cs b/src/Filee.Engines/Infrastructure/StallWatch.cs
new file mode 100644
index 00000000..000b814a
--- /dev/null
+++ b/src/Filee.Engines/Infrastructure/StallWatch.cs
@@ -0,0 +1,43 @@
+// Tells a program that is still working from one that hangs: every line it writes is a sign of life, and one that
+// writes nothing for longer than the limit is treated as stuck. Engines that report their progress all the time
+// (FFmpeg, calibre) may then run as long as a big file needs instead of up to a fixed time.
+
+using System.Diagnostics;
+
+namespace Filee.Engines.Infrastructure;
+
+/// <summary>Watches a running program's output for a stall.</summary>
+/// <param name="limit">How long the program may stay silent before it counts as stuck.</param>
+internal sealed class StallWatch(TimeSpan limit)
+{
+ private static readonly TimeSpan DefaultInterval = TimeSpan.FromSeconds(1);
+
+ private long _lastActivity = Stopwatch.GetTimestamp();
+
+ public TimeSpan Limit { get; } = limit;
+
+ /// <summary>Records a sign of life (a line of output); called from the output reader threads.</summary>
+ public void Touch() => Volatile.Write(ref _lastActivity, Stopwatch.GetTimestamp());
+
+ /// <summary>True once the program has written nothing for longer than <see cref="Limit"/>.</summary>
+ public bool IsStalled => Stopwatch.GetElapsedTime(Volatile.Read(ref _lastActivity)) > Limit;
+
+ /// <summary>
+ /// Waits until <paramref name="exited"/> completes, checking every <paramref name="interval"/> (a second when
+ /// null) whether the program stalled first.
+ /// </summary>
+ /// <returns>True when it exited; false when it stalled and still runs (the caller kills it).</returns>
+ /// <exception cref="OperationCanceledException"><paramref name="cancellationToken"/> was cancelled.</exception>
+ public async Task<bool> WaitAsync(Task exited, CancellationToken cancellationToken, TimeSpan? interval = null)
+ {
+ while (!exited.IsCompleted)
+ {
+ await Task.WhenAny(exited, Task.Delay(interval ?? DefaultInterval, cancellationToken));
+ cancellationToken.ThrowIfCancellationRequested();
+ if (!exited.IsCompleted && IsStalled)
+ return false;
+ }
+ await exited;
+ return true;
+ }
+}
diff --git a/src/Filee.Engines/Media/FfmpegRunner.cs b/src/Filee.Engines/Media/FfmpegRunner.cs
index eba84e03..781db4a2 100644
--- a/src/Filee.Engines/Media/FfmpegRunner.cs
+++ b/src/Filee.Engines/Media/FfmpegRunner.cs
@@ -1,6 +1,6 @@
// Runs ffmpeg.exe and turns its machine-readable progress output into a position in seconds. Unlike ProcessRunner
// there is no overall timeout (a feature film legitimately encodes for an hour); a process that stops reporting
-// for a long time is treated as hung and killed, and cancellation always kills the whole process tree.
+// for a long time is treated as hung and killed (StallWatch), and cancellation always kills the whole process tree.
using System.Diagnostics;
using System.Globalization;
@@ -18,7 +18,6 @@ internal static class FfmpegRunner
/// </summary>
public static readonly TimeSpan DefaultStallTimeout = TimeSpan.FromMinutes(10);
- private static readonly TimeSpan WatchInterval = TimeSpan.FromSeconds(1);
private const int KeptErrorLines = 40;
/// <summary>Key of the per-frame stats line the GIF palette pass writes (seconds, see MediaEncoding).</summary>
@@ -54,13 +53,14 @@ internal static class FfmpegRunner
psi.Environment["SVT_LOG"] = "1";
using var process = new Process { StartInfo = psi };
- var lastActivity = Stopwatch.GetTimestamp();
+ var limit = stallTimeout ?? DefaultStallTimeout;
+ var watch = new StallWatch(limit);
var errors = new Queue<string>();
process.OutputDataReceived += (_, e) =>
{
if (e.Data is null)
return;
- Volatile.Write(ref lastActivity, Stopwatch.GetTimestamp());
+ watch.Touch();
if (ParsePosition(e.Data) is { } seconds)
onPosition?.Invoke(seconds);
};
@@ -68,7 +68,7 @@ internal static class FfmpegRunner
{
if (e.Data is null)
return;
- Volatile.Write(ref lastActivity, Stopwatch.GetTimestamp());
+ watch.Touch();
lock (errors)
{
errors.Enqueue(e.Data);
@@ -84,21 +84,13 @@ internal static class FfmpegRunner
process.BeginOutputReadLine();
process.BeginErrorReadLine();
- var limit = stallTimeout ?? DefaultStallTimeout;
try
{
- var exited = process.WaitForExitAsync(cancellationToken);
- while (!exited.IsCompleted)
+ if (!await watch.WaitAsync(process.WaitForExitAsync(cancellationToken), cancellationToken))
{
- await Task.WhenAny(exited, Task.Delay(WatchInterval, cancellationToken));
- cancellationToken.ThrowIfCancellationRequested();
- if (!exited.IsCompleted && Stopwatch.GetElapsedTime(Volatile.Read(ref lastActivity)) > limit)
- {
- Kill(process);
- throw new TimeoutException($"FFmpeg stopped responding (no progress for {limit.TotalMinutes:0} minutes) and was stopped.");
- }
+ Kill(process);
+ throw new TimeoutException($"FFmpeg stopped responding (no progress for {limit.TotalMinutes:0} minutes) and was stopped.");
}
- await exited;
}
catch (OperationCanceledException)
{
diff --git a/tests/Filee.Engines.Tests/StallWatchTests.cs b/tests/Filee.Engines.Tests/StallWatchTests.cs
new file mode 100644
index 00000000..6eaee953
--- /dev/null
+++ b/tests/Filee.Engines.Tests/StallWatchTests.cs
@@ -0,0 +1,118 @@
+// The stall watch that lets calibre (#651) and FFmpeg run as long as they keep reporting progress, and stops them
+// once they go silent. The program is faked: its exit is a task, its output lines are Touch calls.
+
+using System.Diagnostics;
+using Filee.Core.Conversion;
+using Filee.Engines.Ebooks;
+using Filee.Engines.Infrastructure;
+
+namespace Filee.Engines.Tests;
+
+public sealed class StallWatchTests
+{
+ private static readonly TimeSpan Interval = TimeSpan.FromMilliseconds(20);
+
+ [Fact]
+ public async Task A_program_that_keeps_reporting_runs_well_past_the_stall_limit()
+ {
+ var token = TestContext.Current.CancellationToken;
+ var watch = new StallWatch(TimeSpan.FromMilliseconds(300));
+ var exited = new TaskCompletionSource();
+ var started = Stopwatch.StartNew();
+
+ // "34% Running transforms on e-book..." every 50 ms for a second, three times the limit.
+ var output = Task.Run(async () =>
+ {
+ while (started.Elapsed < TimeSpan.FromSeconds(1))
+ {
+ watch.Touch();
+ await Task.Delay(50, token);
+ }
+ exited.SetResult();
+ }, token);
+
+ Assert.True(await watch.WaitAsync(exited.Task, token, Interval));
+ Assert.True(started.Elapsed >= TimeSpan.FromSeconds(1));
+ await output;
+ }
+
+ [Fact]
+ public async Task A_program_that_goes_silent_is_reported_as_stalled()
+ {
+ var token = TestContext.Current.CancellationToken;
+ var watch = new StallWatch(TimeSpan.FromMilliseconds(200));
+ var exited = new TaskCompletionSource(); // never exits
+
+ // A few lines of progress, then nothing.
+ for (var i = 0; i < 3; i++)
+ {
+ await Task.Delay(100, token);
+ watch.Touch();
+ }
+ var silent = Stopwatch.StartNew();
+
+ Assert.False(await watch.WaitAsync(exited.Task, token, Interval));
+ Assert.True(watch.IsStalled);
+ Assert.True(silent.Elapsed >= TimeSpan.FromMilliseconds(190), $"the silence counts from the last line, stalled after {silent.Elapsed}");
+ }
+
+ [Fact]
+ public async Task A_program_that_exits_before_the_limit_is_not_stalled()
+ {
+ var watch = new StallWatch(TimeSpan.FromMinutes(10));
+
+ Assert.True(await watch.WaitAsync(Task.CompletedTask, TestContext.Current.CancellationToken, Interval));
+ Assert.False(watch.IsStalled);
+ }
+
+ [Fact]
+ public async Task Cancelling_stops_the_wait_even_while_the_program_reports()
+ {
+ var watch = new StallWatch(TimeSpan.FromMinutes(10));
+ using var cancel = new CancellationTokenSource(TimeSpan.FromMilliseconds(100));
+
+ await Assert.ThrowsAnyAsync<OperationCanceledException>(() =>
+ watch.WaitAsync(new TaskCompletionSource().Task, cancel.Token, Interval));
+ }
+
+ [Fact]
+ public async Task ProcessRunner_stops_a_silent_program_with_the_stalled_reason()
+ {
+ Assert.SkipUnless(OperatingSystem.IsWindows(), "Windows PowerShell as the silent program.");
+ var started = Stopwatch.StartNew();
+
+ var refused = await Assert.ThrowsAsync<ConversionRefusedException>(() =>
+ ProcessRunner.RunAsync(PowerShell, ["-NoProfile", "-Command", "Start-Sleep -Seconds 60"], Timeout.InfiniteTimeSpan,
+ TestContext.Current.CancellationToken, stallTimeout: TimeSpan.FromSeconds(2)));
+
+ Assert.Equal(ProcessRunner.StalledErrorKey, refused.ErrorKey);
+ Assert.Equal("powershell.exe, 2 s", refused.Detail);
+ Assert.True(started.Elapsed < TimeSpan.FromSeconds(30), $"stopped after {started.Elapsed}");
+ }
+
+ [Fact]
+ public async Task ProcessRunner_cancellation_still_wins_over_the_stall_watch()
+ {
+ Assert.SkipUnless(OperatingSystem.IsWindows(), "Windows PowerShell as the long program.");
+ using var cancel = CancellationTokenSource.CreateLinkedTokenSource(TestContext.Current.CancellationToken);
+ cancel.CancelAfter(TimeSpan.FromMilliseconds(500));
+
+ await Assert.ThrowsAnyAsync<OperationCanceledException>(() =>
+ ProcessRunner.RunAsync(PowerShell, ["-NoProfile", "-Command", "Start-Sleep -Seconds 60"], Timeout.InfiniteTimeSpan,
+ cancel.Token, stallTimeout: TimeSpan.FromMinutes(10)));
+ }
+
+ [Theory]
+ [InlineData(600, "10 min")]
+ [InlineData(120, "2 min")]
+ [InlineData(30, "30 s")]
+ public void The_stall_limit_reads_in_minutes_or_seconds(int seconds, string expected) =>
+ Assert.Equal(expected, ProcessRunner.Describe(TimeSpan.FromSeconds(seconds)));
+
+ [Fact]
+ public void Calibre_stops_only_after_at_least_as_long_a_silence_as_its_former_fixed_limit() =>
+ Assert.True(CalibreConverter.StallTimeout >= TimeSpan.FromMinutes(10));
+
+ private static string PowerShell =>
+ Path.Combine(Environment.SystemDirectory, "WindowsPowerShell", "v1.0", "powershell.exe");
+}