Browse Source

Invert count/write logic

Previously, write was the actual default action, and in some forms of the command, the action value isn't actually checked against the possible values, so on a typo, it would write instead of count.
master
JustAnotherArchivist 2 years ago
parent
commit
fed64387bd
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      wpull2-requeue

+ 3
- 3
wpull2-requeue View File

@@ -30,12 +30,12 @@ urlpattern="$1"

query='FROM queued_urls JOIN url_strings ON url_string_id = url_strings.id WHERE url LIKE "'"${urlpattern}"'" ESCAPE "\" AND status = "skipped" AND try_count > 3'

if [[ "${action}" == 'count' ]]
if [[ "${action}" == 'write' ]]
then
sqlite3 "${filename}" "SELECT COUNT(queued_urls.id) ${query}"
sqlite3 "${filename}" 'UPDATE queued_urls SET status = "todo", try_count = 0, status_code = NULL WHERE id IN (SELECT queued_urls.id '"${query}"')'
elif [[ "${action}" == 'print' ]]
then
sqlite3 "${filename}" "SELECT queued_urls.*, url_strings.* ${query}"
else
sqlite3 "${filename}" 'UPDATE queued_urls SET status = "todo", try_count = 0, status_code = NULL WHERE id IN (SELECT queued_urls.id '"${query}"')'
sqlite3 "${filename}" "SELECT COUNT(queued_urls.id) ${query}"
fi

Loading…
Cancel
Save