diff --git a/filter.sh b/filter.sh index 75959c7..fd4cc44 100755 --- a/filter.sh +++ b/filter.sh @@ -183,6 +183,11 @@ function filter_entries { marked_entries+=" $(echo "$unread_entries" | jq --arg url "$url" --arg suchbegriff "$suchbegriff" '.entries[] | select(.feed.site_url | ascii_downcase | contains($url)) | select(.content | ascii_downcase | contains($suchbegriff)) | .id' )" fi fi + # sortiere und forme marked_entries um + # https://unix.stackexchange.com/questions/353321/remove-all-duplicate-word-from-string-using-shell-script + # entfernt doppelte eintraege innerhalb einer zeile + marked_entries=$(echo marked_entries | xargs -n1 | sort -u | xargs | sed -r 's/\s/\, /g') + echo $marked_entries done } function mark_as_read { @@ -193,13 +198,11 @@ function mark_as_read { if [[ $MF_DEBUG -eq 1 ]]; then echo "[DEBUG] mark entries as read" echo "[DEBUG] marked entry ids: $marked_entries" - # https://unix.stackexchange.com/questions/353321/remove-all-duplicate-word-from-string-using-shell-script - # entfernt doppelte eintraege innerhalb einer zeile - echo "$marked_entries" | xargs -n1 | sort -u | xargs | sed -r 's/\s/\, /g' + echo "$marked_entries" fi # wenn NICHT leer # sed wandelt 123 345 456 in 123, 245, 345 um. - if [[ $(echo "$marked_entries" | xargs -n1 | sort -u | xargs | sed -r 's/\s/\, /g') ]]; then + if [[ -n "$marked_entries" ]]; then curl --request PUT --silent --header "X-Auth-Token: $MF_AUTH_TOKEN" --header "Content-Type: application/json" --data "{\"entry_ids\": [$(echo "$marked_entries" | xargs -n1 | sort -u | xargs | sed -r 's/\s/\, /g')], \"status\": \"read\"}" "$MF_API_URL/entries" # gebe entry-titel aus for i in $(echo "$marked_entries" | xargs -n1 | sort -u | xargs); do @@ -232,3 +235,7 @@ case "$1" in sleep "$MF_SLEEP" done esac + + + +# curl --request PUT --header "X-Auth-Token: hLPp23gO8QeZWPYXXXXXXXMs0jG0XTYgNZBgRA=" --header "Content-Type: application/json" --data '{"entry_ids":[388229, 388211], "status":"read"}' https://miniflux.mgrote.net/v1/entries