test-examples.cmd 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. @echo off
  2. rem Builds rekopub.exe, then converts a set of real articles into
  3. rem test-examples\ for checking on the e-readers. Books from a previous run
  4. rem are replaced (-FORCE). A failure on one URL doesn't stop the others.
  5. rem
  6. rem Run it from Command Prompt or PowerShell:
  7. rem test-examples.cmd (Command Prompt)
  8. rem .\test-examples.cmd (PowerShell)
  9. rem Add "kepub" to make Kobo KEPUBs (.kepub.epub) instead of plain EPUBs:
  10. rem test-examples.cmd kepub
  11. setlocal
  12. set KEPUB=
  13. if /i "%~1"=="kepub" set KEPUB=-KEPUB
  14. rem Work from the folder this script is in, wherever it was started from.
  15. cd /d "%~dp0"
  16. call build.cmd || exit /b 1
  17. echo.
  18. if not exist test-examples mkdir test-examples
  19. set /a ok=0, failed=0
  20. for %%U in (
  21. "https://pluralistic.net/2026/09/12/god-in-the-box/"
  22. "https://arstechnica.com/gadgets/2026/10/kde-turns-30-with-plasma-6-8-remote-upgrades-and-an-x11-farewell/"
  23. "https://www.bbc.com/news/articles/c5ygyww0zk3o"
  24. "https://en.wikipedia.org/wiki/BattleTech"
  25. "https://www.wired.com/story/breadfruit-caribbean-pacific-climate-change-super-food/"
  26. ) do call :convert %%U
  27. echo %ok% converted, %failed% failed. Books are in %CD%\test-examples\
  28. if %failed% gtr 0 exit /b 1
  29. exit /b 0
  30. rem Converts one URL and counts the result. The -SAVE folder is left
  31. rem unquoted: a quoted path ending in a backslash would swallow the quote.
  32. :convert
  33. echo === %~1
  34. rekopub.exe -URL "%~1" -SAVE test-examples\ -FORCE %KEPUB%
  35. if errorlevel 1 (
  36. set /a failed+=1
  37. ) else (
  38. set /a ok+=1
  39. )
  40. echo.
  41. exit /b 0