Skip to content

Commit

Permalink
Made major changes to the CWA Cover & Metadata Enforcement service. L…
Browse files Browse the repository at this point in the history
…ike the ingest service, it now also supports multiple formats (currently limited to EPUB & AZW3 due to limitations of the calibre ebook-polish function) and can also now be disabled in the CWA Settings panel. The majority of the necessary work has been done to achieve these goals but these changes are currently untested
  • Loading branch information
crocodilestick committed Nov 21, 2024
1 parent fbb2733 commit fc949d2
Show file tree
Hide file tree
Showing 9 changed files with 378 additions and 253 deletions.
File renamed without changes.
3 changes: 2 additions & 1 deletion root/app/calibre-web/cps/cwa_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ def set_cwa_settings():
"auto_backup_conversions",
"auto_zip_backups",
"cwa_update_notifications",
"auto_convert"]
"auto_convert",
"auto_metadata_enforcement"]
string_settings = ["auto_convert_target_format"]
for format in ignorable_formats:
string_settings.append(f"ignore_ingest_{format}")
Expand Down
8 changes: 8 additions & 0 deletions root/app/calibre-web/cps/templates/cwa_settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ <h3>Calibre-Web Automated User Settings</h3><br>
<label for="auto_convert" style="padding-left: 10px;">Enable CWA Auto-Convert</label><br>
<p class="cwa-settings-tooltip">On by default, when active all ingested books will automatically be converted to the target format specified below (epub by default)</p>

{% if cwa_settings['auto_metadata_enforcement'] %}
<input type="checkbox" id="auto_metadata_enforcement" name="auto_metadata_enforcement" value="True" checked style="accent-color: var(--color-secondary);" data-toggle="tooltip" data-placement="right" data-html="true" title="Placeholder">
{% else %}
<input type="checkbox" id="auto_metadata_enforcement" name="auto_metadata_enforcement" value="True" style="accent-color: var(--color-secondary);" data-toggle="tooltip" data-placement="right" data-html="true" title="Placeholder">
{% endif %}
<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>

<h3>CWA Auto-Convert - Choose Target Format for CWA Functions <i>(epub by default)</i></h3>
<p class="cwa-settings-explanation">When the Auto-Convert feature is active, all ingested books will be automatically converted to the format chosen here (except those formats selected in the ignore list below)</p>
<label for="auto_convert_target_format" style="padding-right: 10px; padding-left: 10px;">Choose a target format:</label>
Expand Down
2 changes: 1 addition & 1 deletion root/etc/s6-overlay/s6-rc.d/metadata-change-detector/run
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ echo "[metadata-change-detector]: Watching folder: $WATCH_FOLDER"
s6-setuidgid abc inotifywait -m -e close_write -e moved_to --exclude '^.*\.(swp)$' "$WATCH_FOLDER" |
while read -r directory events filename; do
echo "[metadata-change-detector]: New file detected: $filename"
python3 /app/calibre-web-automated/scripts/cover-enforcer.py "--log" "$filename"
python3 /app/calibre-web-automated/scripts/cover_enforcer.py "--log" "$filename"
done
231 changes: 0 additions & 231 deletions scripts/cover-enforcer.py

This file was deleted.

Loading

0 comments on commit fc949d2

Please sign in to comment.