소스 검색

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 년 전
부모
커밋
fed64387bd
1개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. +3
    -3
      wpull2-requeue

+ 3
- 3
wpull2-requeue 파일 보기

@@ -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' 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 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' ]] elif [[ "${action}" == 'print' ]]
then then
sqlite3 "${filename}" "SELECT queued_urls.*, url_strings.* ${query}" sqlite3 "${filename}" "SELECT queued_urls.*, url_strings.* ${query}"
else 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 fi

불러오는 중...
취소
저장