Combining json style output and filtering #2918
bananaabandit
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have the below filtering which @dgtlmoon kindly provided me with which works great to strip out the (changed) lines and only leave the (into) and then remove the substring (into) leaving just the updated text:
{% for line in diff_full.split('\n') %}
{% set clean_line = line.strip() %}
{% if clean_line.startswith('(into)') %}
{{ clean_line.replace('(into)', '').strip() }}
{% endif %}
{% endfor %}
I also have the below json ntfy compatible template which works with a standard text string or a sanitised {{ diff_full | tojson }} entry in the message field (again much thanks to @dgtlmoon):
posts://ntfy.domain.com?auth=secretstuff
{
"topic": "secretsuff",
"message": {{ diff_full | tojson }},
"url": {{ watch_url | tojson }},
"actions": [
{
"action": "view",
"label": "Open URL",
"url": {{ watch_url | tojson }},
"clear": true
}
]
}
Is there any way I could combine the two so that the filtering could be passed into the message? I have had many tries and consulted the various AIs but its a bit beyond my limited skills unfortunately! Many thanks!
Beta Was this translation helpful? Give feedback.
All reactions