💾 Archived View for patu.re › snippets.gmi captured on 2022-01-08 at 13:37:38. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
UPDATE entries SET content = regexp_replace(content, 'youtube-nocookie.com', 'invidious.fdn.fr') WHERE content LIKE '%youtube-nocookie.com/embed%';
#!/bin/env bash INDEX_FILE="./indexes/1.18.json" REGEX_EXTRACT="^minecraft/sounds/records/" OBJECTS_DIR="./objects/" OUTPUT_DIR="./output/" echo "Starting extraction..." if [[ ! -f "${INDEX_FILE}" ]] then echo "ERROR: Index file doesn't exist!" exit 1 fi if [[ ! -d "${OBJECTS_DIR}" ]] then echo "ERROR: Objects directory doesn't exist!" exit 1 fi if [[ ! -d "${OUTPUT_DIR}" ]] then echo "WARNING: Output directory doesn't exist! Creating a new one." mkdir -p "${OUTPUT_DIR}" fi for FILE in $(jq -r '.objects | keys[]' "${INDEX_FILE}" | grep "${REGEX_EXTRACT}") do HASH="$(jq -r .objects.\"${FILE}\".hash "${INDEX_FILE}")" PATH_ORIGIN="${OBJECTS_DIR}/${HASH:0:2}/${HASH}" DIR_DEST="${OUTPUT_DIR}/$(dirname ${FILE})" PATH_DEST="${OUTPUT_DIR}/${FILE}" if [[ ! -f "${PATH_ORIGIN}" ]] then echo "ERROR: File ${PATH_ORIGIN} (${FILE}) doesn't exist!" exit 1 fi if [[ ! -d "${DIR_DEST}" ]] then echo "WARNING: ${DIR_DEST} doesn't exist! Creating." mkdir -p ${DIR_DEST} fi cp -f ${PATH_ORIGIN} ${PATH_DEST} done echo "Done!" exit 0