The little things give you away... A collection of various small helper stuff
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

23 lines
684 B

  1. #!/usr/bin/env bash
  2. # Usage: wpull2-children [FILENAME] URL
  3. # FILENAME defaults to wpull.db
  4. # Report all children of a URL
  5. if [[ "$#" -eq 2 ]]; then
  6. filename="$1"
  7. shift
  8. else
  9. filename=wpull.db
  10. fi
  11. if [[ ! -f "${filename}" ]]; then
  12. printf 'Error: %q does not exist or is not a regular file\n' "${filename}" >&2
  13. exit 1
  14. fi
  15. url="$1"
  16. curId="$(sqlite3 "${filename}" 'SELECT id FROM url_strings WHERE url = "'"${url}"'"')"
  17. if [[ -z "${curId}" ]]
  18. then
  19. printf 'Error: %q not found\n' "${url}" >&2
  20. exit 1
  21. fi
  22. sqlite3 "${filename}" 'SELECT queued_urls.*, url_strings.* FROM queued_urls JOIN url_strings ON queued_urls.url_string_id = url_strings.id WHERE parent_url_string_id = '"${curId}"