Compare commits

..

3 Commits

+73 -2
View File
@@ -257,7 +257,7 @@ function pull {
function push {
if [[ -d .git ]]; then
git push && load-stage && load-prod
git push && eval load-stage && eval load-prod
else
send-master
fi
@@ -479,7 +479,7 @@ function process-video {
return $status
}
alias pv="process-video"
alias qpv="pv ./raw/YouCut*.mp4 $(basename `pwd`).mp4"
alias qpv='pv ./raw/YouCut*.mp4 $(basename `pwd`).mp4'
# Allow converting video to audio and other smaller
# tasks than what process-video is intended to do.
@@ -581,6 +581,75 @@ alias pull-audio="v2a"
alias pa="v2a"
### Web ###
function download-website {
website="$1"
if [[ -z "$website" ]]; then
echo "ERROR: Website not provided. $website"
return
fi
if [[ "$website" != "http"* ]]; then
website="http://$website"
fi
# https://simpleit.rocks/linux/how-to-download-a-website-with-wget-the-right-way/
# Does not simplify the links for offline usage.
# wget --wait=2 \
# --level=inf \
# --limit-rate=20K \
# --recursive \
# --page-requisites \
# --user-agent=Mozilla \
# --no-parent \
# --convert-links \
# --adjust-extension \
# --no-clobber \
# -e robots=off \
# $website &&
# https://www.digitalcitizen.life/how-to-download-entire-website-for-offline-viewing/
# This one is supposed to work too and is much smaller.
# wget --mirror \
# --convert-links \
# --adjust-extension \
# --page-requisites \
# --no-parent \
# $website &&
# Combine the two by using mirow and removing the rate limit.
wget --mirror \
--wait=2 \
--level=inf \
--recursive \
--page-requisites \
--user-agent=Mozilla \
--no-parent \
--convert-links \
--adjust-extension \
--no-clobber \
-e robots=off \
--timeout=15 \
--tries=0 \
--continue \
--waitretry=5 \
--random-wait \
$website &&
{
echo -e "\nSuccess!"
} || {
echo -e "\nERROR: Command reported a failure. (Error code '$?')"
echo "This may mean that the URL was not converted to local links."
echo "Please check the error and contents and try again if needed."
}
}
alias website-download="download-website"
alias curl-site="download-website"
alias pull-site="download-website"
alias curl-www="download-website"
alias pull-www="download-website"
alias www-pull="download-website"
## Finalize ##
# Export all functions! #
@@ -622,3 +691,5 @@ eval "$(declare -F | grep -v _ | sed 's/-f /-fx /')"
[[ $(whoami) != "root" ]] &&
echo "`date` - Shared RC Config - Complete!"
export _LOADED_SHARED_RC=true