Skip to content

Commit

Permalink
Added a message in the log for when the kindle-epub-fix script has be…
Browse files Browse the repository at this point in the history
…en run on an epub in convert-library.

Rearranged the CWA Settings page to be more logical and improived the description for the Kindle-EPUB-Fix function
  • Loading branch information
crocodilestick committed Dec 11, 2024
1 parent 7a95d5a commit b8260b4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
21 changes: 12 additions & 9 deletions root/app/calibre-web/cps/templates/cwa_settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,20 @@ <h3>Calibre-Web Automated User Settings</h3><br>
<label for="auto_metadata_enforcement" style="padding-left: 10px;">Enable CWA Automatic Cover & Metadata Enforcement Service</label><br>
<p class="cwa-settings-tooltip">On by default, when active, whenever the Metadata and/or Cover Image is edited in the Web UI, the CWA Metadata Enforcement service will then apply those changes the ebook files themselves. Normally in Stock CW or when this setting is disabled, the changes made are only applied to what you see in the Web UI, not the ebook files themselves. This feature currently only supports files in EPUB or AZW3 format.</p>

{% if cwa_settings['kindle_epub_fixer'] %}
<input type="checkbox" id="kindle_epub_fixer" name="kindle_epub_fixer" value="True" checked style="accent-color: var(--color-secondary);" data-toggle="tooltip" data-placement="right" title="Does NOT require restart for changes to take effect">
{% else %}
<input type="checkbox" id="kindle_epub_fixer" name="kindle_epub_fixer" value="True" style="accent-color: var(--color-secondary);" data-toggle="tooltip" data-placement="right" title="Does NOT require restart for changes to take effect">
{% endif %}
<label for="kindle_epub_fixer" style="padding-left: 10px;">Enable CWA Kindle EPUB Fixer</label><br>
<p class="cwa-settings-tooltip">When active, the encoding among other attributes of all EPUB files processed by CWA will be checked and fixed to ensure maximum compatibility with Amazon's Send-to-Kindle Service.
<br><br>
<i>(TLDR: if you've ever had EPUB files that Amazon just constantly rejects for seemingly no reason, this should prevent that from happening again). This tool was adapted from the <a href="https://kindle-epub-fix.netlify.app/">kindle-epub-fix.netlify.app</a> tool made by <a href="https://github.com/innocenat">innocenat</a>.</i></p>


<h4 style="padding-bottom: 14px;">Web UI Settings</h4>


{% if cwa_settings['cwa_update_notifications'] %}
<input type="checkbox" id="cwa_update_notifications" name="cwa_update_notifications" value="True" checked style="accent-color: var(--color-secondary);" data-toggle="tooltip" data-placement="right" title="Does NOT require restart for changes to take effect">
{% else %}
Expand All @@ -36,15 +48,6 @@ <h4 style="padding-bottom: 14px;">Web UI Settings</h4>
<label for="cwa_update_notifications" style="padding-left: 10px;">Enable CWA Update Notifications</label><br>
<p class="cwa-settings-tooltip">When active, you will no longer receive notifications in the Web UI when a new version of CWA is released</p>

{% if cwa_settings['kindle_epub_fixer'] %}
<input type="checkbox" id="kindle_epub_fixer" name="kindle_epub_fixer" value="True" checked style="accent-color: var(--color-secondary);" data-toggle="tooltip" data-placement="right" title="Does NOT require restart for changes to take effect">
{% else %}
<input type="checkbox" id="kindle_epub_fixer" name="kindle_epub_fixer" value="True" style="accent-color: var(--color-secondary);" data-toggle="tooltip" data-placement="right" title="Does NOT require restart for changes to take effect">
{% endif %}
<label for="kindle_epub_fixer" style="padding-left: 10px;">Enable CWA Kindle EPUB Fixer</label><br>
<p class="cwa-settings-tooltip">When active, the encoding among other attributes of all EPUB files processed by CWA will be checked and fixed to ensure maximum compatibility with Amazon's Send-to-Kindle Service (TLDR: if you've ever had EPUB files that Amazon just constantly rejects for seemingly no reason, this should prevent that from happening again)</p>
<p class="cwa-settings-tooltip"><i>This tool was adapted from the kindle-epub-fix.netlify.app tool made by innocenat</i></p>


<h4 style="padding-bottom: 14px;">Automatic Backup Settings</h4>

Expand Down
1 change: 1 addition & 0 deletions scripts/convert_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ def convert_library(self):
if self.target_format == "epub" and self.kindle_epub_fixer:
try:
EPUBFixer(target_filepath).process()
print_and_log("[convert-library] Resulting EPUB file successfully processed by CWA-EPUB-Fixer!")
except Exception as e:
print_and_log(f"[convert-library] An error occurred while processing {os.path.basename(target_filepath)} with the kindle-epub-fixer. See the following error:\n{e}")

Expand Down

0 comments on commit b8260b4

Please sign in to comment.