Compare commits
62 Commits
b9709088a7
...
new-setup-
| Author | SHA1 | Date | |
|---|---|---|---|
| d19e60cfc3 | |||
| 0ee1e7666e | |||
| c7845e62d9 | |||
| 2a57ce8837 | |||
| a529cd6560 | |||
| 589abb9e46 | |||
| 6df4a1e506 | |||
| 10c6e8e06c | |||
| f70bc8b9cd | |||
| dad6be889f | |||
| e979d1094c | |||
| ce1599466e | |||
| e5e8f309e5 | |||
| 8ff9c338b5 | |||
| 173bda9eb0 | |||
| 06bbc0c995 | |||
| f19e84e1a5 | |||
| 1a46964bd7 | |||
| 0e91857946 | |||
| bb31351404 | |||
| 7b031d3127 | |||
| c05131d38f | |||
| 418d1ae956 | |||
| e614936478 | |||
| 5bed58e55c | |||
| 6800f7ccc4 | |||
| 40eb9aa808 | |||
| 53082c6034 | |||
| f084b19637 | |||
| 4323bd9721 | |||
| 28c88ca5f1 | |||
| 4464e4f681 | |||
| 08a26b6716 | |||
| 84b221bdb9 | |||
| 2e07b0c85f | |||
| d664ba882c | |||
| 2f9dc3aba7 | |||
| f0248008a6 | |||
| 7e586d284d | |||
| 816a0be564 | |||
| cef7886859 | |||
| 9e07b24cf7 | |||
| 12969578aa | |||
| 89d5709677 | |||
| 2343c46b89 | |||
| 9371817937 | |||
| 8eccc9659a | |||
| 45d3fa244a | |||
| 2640761dc5 | |||
| 0227534656 | |||
| 78fd8f6d45 | |||
| 736bab22ec | |||
| 0a7bb3c2a1 | |||
| c0dd5208a0 | |||
| 7c828c01f1 | |||
| c1e333e7db | |||
| 4238273951 | |||
| 7f121ab292 | |||
| f30f6eaa69 | |||
| 221985eca2 | |||
| 06f155f3f7 | |||
| 648e9bcce5 |
@@ -36,11 +36,6 @@ error() {
|
|||||||
printf "${BOLD}${RED}$1${NORMAL}\n"
|
printf "${BOLD}${RED}$1${NORMAL}\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
abort() {
|
|
||||||
error "\nAborting..."
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
reload() {
|
reload() {
|
||||||
test -f ~/.env.loader && . ~/.env.loader
|
test -f ~/.env.loader && . ~/.env.loader
|
||||||
}
|
}
|
||||||
@@ -130,37 +125,37 @@ open_explorer_here() {
|
|||||||
|
|
||||||
# Dev build
|
# Dev build
|
||||||
b() {
|
b() {
|
||||||
if [ -f build ]; then ./build $@ ; else test -f build.sh && ./build.sh $@ ; fi
|
test -f build && ./build $@ ; test -f build.sh && ./build.sh $@ ; test -f build.jai && ./build.jai $@
|
||||||
}
|
}
|
||||||
|
|
||||||
# fast dev build
|
# fast dev build
|
||||||
bf() {
|
bf() {
|
||||||
if [ -f build ]; then ./build $@ -fast ; else test -f build.sh && ./build.sh $@ -fast ; fi
|
test -f build && ./build $@ -fast ; test -f build.sh && ./build.sh $@ -fast ; test -f build.jai && ./build.jai $@
|
||||||
}
|
}
|
||||||
|
|
||||||
# Optimized dev build
|
# Optimized dev build
|
||||||
bb() {
|
bb() {
|
||||||
if [ -f build ]; then ./build -o 1 $@ ; else test -f build.sh && ./build.sh -o 1 $@ ; fi
|
test -f build && ./build $@ -o 1 ; test -f build.sh && ./build.sh $@ -o 1 ; test -f build.jai && ./build.jai -release $@
|
||||||
}
|
}
|
||||||
|
|
||||||
# Production build
|
# Production build
|
||||||
bp() {
|
bp() {
|
||||||
if [ -f build ]; then ./build -p p $@ ; else test -f build.sh && ./build.sh -p p $@ ; fi
|
test -f build && ./build $@ -p p ; test -f build.sh && ./build.sh $@ -p p ; test -f build.jai && ./build.jai -release $@ - -prod
|
||||||
}
|
}
|
||||||
|
|
||||||
# Profiling build
|
# Profiling build
|
||||||
bpf() {
|
bpf() {
|
||||||
if [ -f build ]; then ./build -p pf $@ ; else test -f build.sh && ./build.sh -p pf $@ ; fi
|
test -f build && ./build $@ -p pf ; test -f build.sh && ./build.sh $@ -p pf
|
||||||
}
|
}
|
||||||
|
|
||||||
# GPU profiling build
|
# GPU profiling build
|
||||||
bgpf() {
|
bgpf() {
|
||||||
if [ -f build ]; then ./build -p gpu $@ ; else test -f build.sh && ./build.sh -p gpu $@ ; fi
|
test -f build && ./build $@ -p gpu ; test -f build.sh && ./build.sh $@ -p gpu
|
||||||
}
|
}
|
||||||
|
|
||||||
# Run build
|
# Run build
|
||||||
r() {
|
r() {
|
||||||
if [ -f run ]; then ./run $@ ; else test -f run.sh && ./run.sh $@ ; fi
|
test -f run && ./run $@ ; test -f run.sh && ./run.sh $@
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build then run
|
# Build then run
|
||||||
@@ -194,7 +189,7 @@ alias ls='ls -F --color'
|
|||||||
alias l='ls -lh'
|
alias l='ls -lh'
|
||||||
alias ll='ls -lha'
|
alias ll='ls -lha'
|
||||||
|
|
||||||
alias aliases='vim ~/.dotfiles/aliases'
|
alias aliases='vim ~/.aliases'
|
||||||
alias al='aliases'
|
alias al='aliases'
|
||||||
|
|
||||||
if [[ "${platform,,}" == *'ming'* ]]; then
|
if [[ "${platform,,}" == *'ming'* ]]; then
|
||||||
@@ -217,7 +212,7 @@ check_signature() {
|
|||||||
local sig_file="$4"
|
local sig_file="$4"
|
||||||
|
|
||||||
if [[ $hashes_file == "" || $pem_file == "" || $sig_file == "" ]]; then
|
if [[ $hashes_file == "" || $pem_file == "" || $sig_file == "" ]]; then
|
||||||
error "Format: $0 <hashes file (e.g. sha512 hashes)> <pem file> <sig file>\n"
|
error "Usage: <hashes file (e.g. sha512 hashes)> <pem file> <sig file>"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -283,6 +278,8 @@ custom_grep() {
|
|||||||
local include_list=("$@")
|
local include_list=("$@")
|
||||||
local include_arg=""
|
local include_arg=""
|
||||||
if [[ $include_list != "" ]]; then
|
if [[ $include_list != "" ]]; then
|
||||||
|
# We're looping like this instead of for var in "$@", because that way of looping is affecting
|
||||||
|
# my shell environment. Very strange!
|
||||||
for i in "${include_list[@]}"; do
|
for i in "${include_list[@]}"; do
|
||||||
include_arg+="--include=\*${i} "
|
include_arg+="--include=\*${i} "
|
||||||
done
|
done
|
||||||
@@ -316,9 +313,13 @@ alias grep-dev='grep_dev'
|
|||||||
|
|
||||||
COMPRESSION_ON=1
|
COMPRESSION_ON=1
|
||||||
COMPRESSION_OFF=0
|
COMPRESSION_OFF=0
|
||||||
|
|
||||||
SHORTNAME_ON=1
|
SHORTNAME_ON=1
|
||||||
SHORTNAME_OFF=0
|
SHORTNAME_OFF=0
|
||||||
|
|
||||||
|
TRANSCRIBE_ON=1
|
||||||
|
TRANSCRIBE_OFF=0
|
||||||
|
|
||||||
make_vid_dir_and_cd_into() {
|
make_vid_dir_and_cd_into() {
|
||||||
local url="$1"
|
local url="$1"
|
||||||
local dir_name="$2"
|
local dir_name="$2"
|
||||||
@@ -342,79 +343,78 @@ make_vid_dir_and_cd_into() {
|
|||||||
|
|
||||||
error=$?
|
error=$?
|
||||||
if [[ ! $error -eq 0 ]]; then
|
if [[ ! $error -eq 0 ]]; then
|
||||||
error "Error: failed to create directory. Aborting.\n"
|
error "Error: failed to create directory. Aborting."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function my_transcribe_video() {
|
||||||
|
file="$1"
|
||||||
|
output="$2"
|
||||||
|
if [[ $file == "" ]]; then
|
||||||
|
printf "Usage: <input video> <optional output name>\n"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if [[ $output == "" ]]; then
|
||||||
|
output="${1%.*}" # just use the input name without the extension.
|
||||||
|
fi
|
||||||
|
# Tiny is fast and semi-accurate, so whatever.
|
||||||
|
# Base is pretty good overall. It has good punctuation inserting and
|
||||||
|
# catches most words. Small and medium can do better word detection at
|
||||||
|
# times, but suffer from bad punctuation. Medium is particularly bad and
|
||||||
|
# not adding commas and periods.
|
||||||
|
transcribe-video "$file" "$output" tiny base
|
||||||
|
}
|
||||||
|
|
||||||
|
function my_transcribe_video_all_models() {
|
||||||
|
file="$1"
|
||||||
|
output="$2"
|
||||||
|
if [[ $file == "" ]]; then
|
||||||
|
printf "Usage: <input video> <optional output name>\n"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if [[ $output == "" ]]; then
|
||||||
|
output="${1%.*}" # just use the input name without the extension.
|
||||||
|
fi
|
||||||
|
transcribe-video "$file" "$output" tiny base small medium
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Download YouTube videos. Note that yt-dlp downloads a lot faster than streamlink.
|
# Download YouTube videos. Note that yt-dlp downloads a lot faster than streamlink.
|
||||||
dl_youtube_vid() {
|
download_youtube_vid() {
|
||||||
local format="$1"
|
local format="$1"
|
||||||
local shortname="$2"
|
local shortname="$2"
|
||||||
local make_folder="$3"
|
local transcribe="$3"
|
||||||
local url="$4"
|
|
||||||
shift 4
|
local make_folder="$4"
|
||||||
|
local url="$5"
|
||||||
|
shift 5
|
||||||
local opts="$@"
|
local opts="$@"
|
||||||
|
|
||||||
if [[ $url == "" ]]; then
|
if [[ $url == "" ]]; then
|
||||||
error "Format: $0 <make folder?> <url> <optional args>\n"
|
error "Usage: <make folder?> <url> <optional args>"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [[ $format == "" ]]; then
|
|
||||||
printf "${BOLD}No format given; using best available.${NORMAL}\n"
|
|
||||||
# Download best mp4 video and best m4a audio, then merge.
|
|
||||||
format="bv*[ext=mp4]+ba[ext=m4a]"
|
|
||||||
opts+=" --merge-output-format mp4"
|
|
||||||
fi
|
|
||||||
|
|
||||||
opts+=" --write-subs --sub-lang en --embed-subs"
|
if [[ $shortname == "1" || $transcribe == "1" ]]; then
|
||||||
|
printf "${BOLD}Downloading Youtube vid "
|
||||||
if [[ $make_folder == "1" ]]; then
|
if [[ $shortname == "1" ]]; then printf "| ${YELLOW}using short name${NORMAL}${BOLD} "; fi
|
||||||
make_vid_dir_and_cd_into $url ""
|
if [[ $transcribe == "1" ]]; then printf "| ${YELLOW}audio transcription on${NORMAL}${BOLD} "; fi
|
||||||
if [[ $? -ne 0 ]]; then
|
printf "\n\n${NORMAL}"
|
||||||
return
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $shortname -eq 0 ]]; then
|
|
||||||
local name_format="%(upload_date>%Y-%m-%d)s-%(title)s-yt-%(id)s.%(ext)s"
|
|
||||||
else
|
else
|
||||||
local name_format="%(upload_date>%Y-%m-%d)s-shortname-yt-%(id)s.%(ext)s"
|
printf "${BOLD}Downloading Youtube vid\n\n${NORMAL}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local cmd="yt-dlp.exe -f $format -o \"$name_format\" $opts $url"
|
|
||||||
eval $cmd # Need to eval in order to preserve the quotes wrapping the filename format string.
|
|
||||||
|
|
||||||
# Removing any trailing subtitle files
|
|
||||||
rm *.vtt *.srt 2>/dev/null
|
|
||||||
|
|
||||||
if [[ $make_folder == "1" ]]; then
|
|
||||||
cd ..
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Download YouTube video and flip horizontally.
|
|
||||||
dl_youtube_vid_and_hflip() {
|
|
||||||
local format="$1"
|
|
||||||
local make_folder="$2"
|
|
||||||
local url="$3"
|
|
||||||
shift 3
|
|
||||||
local opts="$@"
|
|
||||||
|
|
||||||
if [[ $url == "" ]]; then
|
|
||||||
error "Format: $0 <make folder?> <url> <optional args>\n"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
if [[ $format == "" ]]; then
|
if [[ $format == "" ]]; then
|
||||||
printf "${BOLD}No format given; using best available.${NORMAL}\n"
|
printf "${BOLD}No format given; using best available.${NORMAL}\n"
|
||||||
# Download best mp4 video and best m4a audio, then merge.
|
# Download best mp4 video.
|
||||||
format="bv*[ext=mp4]+ba[ext=m4a]"
|
format="bv*[ext=mp4]+ba[ext=m4a]"
|
||||||
opts+=" --merge-output-format mp4"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
opts+=" --write-sub --sub-lang en --embed-subs"
|
# We're assuming we'll always have an mp4 video only and audio track to merge.
|
||||||
|
opts+=" --merge-output-format mp4 --write-subs --sub-lang en --embed-subs"
|
||||||
|
|
||||||
if [[ $make_folder == "1" ]]; then
|
if [[ $make_folder == "1" ]]; then
|
||||||
make_vid_dir_and_cd_into $url ""
|
make_vid_dir_and_cd_into $url ""
|
||||||
@@ -423,24 +423,40 @@ dl_youtube_vid_and_hflip() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local filename=$(yt-dlp.exe --get-filename -f $format -o "%(upload_date>%Y-%m-%d)s-%(title)s-yt-%(id)s.%(ext)s" $url)
|
if [[ $shortname == "0" ]]; then
|
||||||
|
local name_format="%(upload_date>%Y-%m-%d)s-%(title)s-yt-%(id)s"
|
||||||
|
else
|
||||||
|
local name_format="%(upload_date>%Y-%m-%d)s-shortname-yt-%(id)s"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get the video filename.
|
||||||
|
local filename=$(yt-dlp.exe --get-filename -f $format -o "$name_format.%(ext)s" $opts $url)
|
||||||
|
printf "filename: $filename\n"
|
||||||
|
|
||||||
|
# Download
|
||||||
local cmd="yt-dlp.exe -f $format -o \"$filename\" $opts $url"
|
local cmd="yt-dlp.exe -f $format -o \"$filename\" $opts $url"
|
||||||
eval $cmd # Need to eval in order to preserve the quotes wrapping the filename format string.
|
eval $cmd # Need to eval in order to preserve the quotes wrapping the filename format string.
|
||||||
|
error=$?
|
||||||
|
|
||||||
|
if [[ $error -ne 0 ]]; then
|
||||||
|
error "Error: Failed to download '$url'"
|
||||||
|
if [[ $make_folder == "1" ]]; then cd ..; fi
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
# Removing any trailing subtitle files
|
# Removing any trailing subtitle files
|
||||||
rm *.vtt *.srt 2>/dev/null
|
rm *.vtt *.srt 2>/dev/null
|
||||||
|
|
||||||
# Flip
|
if [[ $transcribe == "1" ]]; then
|
||||||
ffmpeg -i "$filename" -vf hflip -c:a copy "copy_${filename}"
|
my_transcribe_video "$filename"
|
||||||
mv "copy_${filename}" "$filename"
|
|
||||||
|
|
||||||
if [[ $make_folder == "1" ]]; then
|
|
||||||
cd ..
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ $make_folder == "1" ]]; then cd ..; fi
|
||||||
|
|
||||||
|
printf "${BOLD}Finished downloading ${YELLOW}$filename${NORMAL}\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
dl_youtube_playlist() {
|
download_youtube_playlist() {
|
||||||
local format="$1"
|
local format="$1"
|
||||||
local url="$2"
|
local url="$2"
|
||||||
local dir_name="$3"
|
local dir_name="$3"
|
||||||
@@ -448,9 +464,12 @@ dl_youtube_playlist() {
|
|||||||
local opts="$@"
|
local opts="$@"
|
||||||
|
|
||||||
if [[ $url == "" ]]; then
|
if [[ $url == "" ]]; then
|
||||||
error "Format: $0 <url> <directory name (optional)> <optional args>\n"
|
error "Usage: <url> <directory name (optional)> <optional args>"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
printf "${BOLD}Downloading Youtube playlist\n\n${NORMAL}"
|
||||||
|
|
||||||
if [[ $format == "" ]]; then
|
if [[ $format == "" ]]; then
|
||||||
printf "${BOLD}No format given; using best available.${NORMAL}\n"
|
printf "${BOLD}No format given; using best available.${NORMAL}\n"
|
||||||
# Download best mp4 video and best m4a audio, then merge.
|
# Download best mp4 video and best m4a audio, then merge.
|
||||||
@@ -473,11 +492,60 @@ dl_youtube_playlist() {
|
|||||||
# Removing any trailing subtitle files
|
# Removing any trailing subtitle files
|
||||||
rm *.vtt *.srt 2>/dev/null
|
rm *.vtt *.srt 2>/dev/null
|
||||||
|
|
||||||
cd ..
|
if [[ $dir_name == "1" ]]; then cd ..; fi
|
||||||
|
|
||||||
|
printf "${BOLD}Finished downloading the playlist\n${NORMAL}"
|
||||||
|
}
|
||||||
|
|
||||||
|
download_youtube_playlist_list() {
|
||||||
|
local url="$1"
|
||||||
|
local output_name="$2"
|
||||||
|
shift 2
|
||||||
|
local opts="$@"
|
||||||
|
|
||||||
|
if [[ $url == "" || $output_name == "" ]]; then
|
||||||
|
error "Usage: <url> <output name> <optional args>"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "${BOLD}Downloading Youtube playlist video list\n\n${NORMAL}"
|
||||||
|
|
||||||
|
local cmd="yt-dlp.exe --ignore-errors -O \"%(playlist_index)s-%(title)s--%(id)s\" --skip-download $opts $url"
|
||||||
|
eval $cmd 1>"${output_name}.txt" # Need to eval in order to preserve the quotes wrapping the filename format string.
|
||||||
|
|
||||||
|
printf "${BOLD}Finished downloading the playlist video list\n${NORMAL}"
|
||||||
|
}
|
||||||
|
|
||||||
|
download_youtube_uploads_list() {
|
||||||
|
local include_descriptions="$1"
|
||||||
|
|
||||||
|
local url="$2"
|
||||||
|
local output_name="$3"
|
||||||
|
shift 3
|
||||||
|
local opts="$@"
|
||||||
|
|
||||||
|
if [[ $url == "" || $output_name == "" ]]; then
|
||||||
|
error "Usage: <url> <output name> <optional args>"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local cmd=""
|
||||||
|
|
||||||
|
if [[ $include_descriptions == "1" ]]; then
|
||||||
|
printf "${BOLD}Downloading Youtube uploads list with descriptions\n\n${NORMAL}"
|
||||||
|
cmd="yt-dlp.exe --ignore-errors -O \"@@@ %(video_autonumber)s-%(upload_date>%Y-%m-%d)s--%(title)s--%(id)s\" --skip-download --get-description $opts $url"
|
||||||
|
else
|
||||||
|
printf "${BOLD}Downloading Youtube uploads list\n\n${NORMAL}"
|
||||||
|
cmd="yt-dlp.exe --ignore-errors -O \"%(video_autonumber)s-%(upload_date>%Y-%m-%d)s--%(title)s--%(id)s\" --skip-download $opts $url"
|
||||||
|
fi
|
||||||
|
|
||||||
|
eval $cmd 1>"${output_name}.txt" # Need to eval in order to preserve the quotes wrapping the filename format string.
|
||||||
|
|
||||||
|
printf "${BOLD}Finished downloading the upload list\n${NORMAL}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Download Twitch chat transcript
|
# Download Twitch chat transcript
|
||||||
actually_dl_twitch_chat() {
|
actually_download_twitch_chat() {
|
||||||
local url="$1"
|
local url="$1"
|
||||||
local filename="$2"
|
local filename="$2"
|
||||||
|
|
||||||
@@ -488,16 +556,18 @@ actually_dl_twitch_chat() {
|
|||||||
else
|
else
|
||||||
error "Video doesn't have a chat transcript."
|
error "Video doesn't have a chat transcript."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
printf "${BOLD}Finished downloading ${YELLOW}$filename${NORMAL}\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
dl_twitch_chat() {
|
download_twitch_chat() {
|
||||||
local make_folder="$1"
|
local make_folder="$1"
|
||||||
local url="$2"
|
local url="$2"
|
||||||
shift 2
|
shift 2
|
||||||
local opts="$@"
|
local opts="$@"
|
||||||
|
|
||||||
if [[ $url == "" ]]; then
|
if [[ $url == "" ]]; then
|
||||||
error "Format: $0 <url>\n"
|
error "Usage: <url>"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -508,11 +578,9 @@ dl_twitch_chat() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
actually_dl_twitch_chat $url "$(yt-dlp.exe --get-filename -o "%(upload_date>%Y-%m-%d)s-%(title)s-tw-%(id)s" $opts $url)"
|
actually_download_twitch_chat $url "$(yt-dlp.exe --get-filename -o "%(upload_date>%Y-%m-%d)s-%(title)s-tw-%(id)s.chat" $opts $url)"
|
||||||
|
|
||||||
if [[ $make_folder == "1" ]]; then
|
if [[ $make_folder == "1" ]]; then cd ..; fi
|
||||||
cd ..
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Download Twitch videos, both VODs and live streams. Pass a Twitch account URL to download a live stream.
|
# Download Twitch videos, both VODs and live streams. Pass a Twitch account URL to download a live stream.
|
||||||
@@ -526,17 +594,18 @@ dl_twitch_chat() {
|
|||||||
# To extract a portion of a video, you have to first download the entire file and then use the
|
# To extract a portion of a video, you have to first download the entire file and then use the
|
||||||
# `trim-video` or `compress-video-and-trim` scripts.
|
# `trim-video` or `compress-video-and-trim` scripts.
|
||||||
#
|
#
|
||||||
dl_twitch_vid() {
|
download_twitch_vid() {
|
||||||
local format="$1"
|
local format="$1"
|
||||||
local shortname="$2"
|
local shortname="$2"
|
||||||
local compress="$3"
|
local compress="$3"
|
||||||
local make_folder="$4"
|
local transcribe="$4"
|
||||||
local url="$5"
|
local make_folder="$5"
|
||||||
shift 5
|
local url="$6"
|
||||||
|
shift 6
|
||||||
local opts="$@"
|
local opts="$@"
|
||||||
|
|
||||||
if [[ $url == "" ]]; then
|
if [[ $url == "" ]]; then
|
||||||
error "Format: $0 <make folder?> <url> <optional args>\n"
|
error "Usage: <make folder?> <url> <optional args>"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -551,10 +620,14 @@ dl_twitch_vid() {
|
|||||||
printf "${BOLD}Subscriber VOD. Will use yt-dlp to download.${NORMAL}\n"
|
printf "${BOLD}Subscriber VOD. Will use yt-dlp to download.${NORMAL}\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $compress -eq 0 ]]; then
|
if [[ $shortname == "1" || $compress == "1" || $transcribe == "1" ]]; then
|
||||||
printf "${BOLD}Downloading Twitch vid with no compression.${NORMAL}\n"
|
printf "${BOLD}Downloading Twitch vid "
|
||||||
|
if [[ $shortname == "1" ]]; then printf "| ${YELLOW}using short name${NORMAL}${BOLD} "; fi
|
||||||
|
if [[ $compress == "1" ]]; then printf "| ${YELLOW}compression on${NORMAL}${BOLD} "; fi
|
||||||
|
if [[ $transcribe == "1" ]]; then printf "| ${YELLOW}audio transcription on${NORMAL}${BOLD} "; fi
|
||||||
|
printf "\n\n${NORMAL}"
|
||||||
else
|
else
|
||||||
printf "${BOLD}Downloading Twitch vid with compression.${NORMAL}\n"
|
printf "${BOLD}Downloading Twitch vid\n\n${NORMAL}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local yt_dlp_format=""
|
local yt_dlp_format=""
|
||||||
@@ -577,69 +650,82 @@ dl_twitch_vid() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $shortname -eq 0 ]]; then
|
if [[ $shortname == "0" ]]; then
|
||||||
local name_format="%(upload_date>%Y-%m-%d)s-%(title)s-tw-%(id)s"
|
local name_format="%(upload_date>%Y-%m-%d)s-%(title)s-tw-%(id)s"
|
||||||
else
|
else
|
||||||
local name_format="%(upload_date>%Y-%m-%d)s-shortname-tw-%(id)s"
|
local name_format="%(upload_date>%Y-%m-%d)s-shortname-tw-%(id)s"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Download Twitch chat transcript
|
# Download Twitch chat transcript
|
||||||
actually_dl_twitch_chat $url "$(yt-dlp.exe --get-filename -o "$name_format" $opts $url)"
|
actually_download_twitch_chat $url "$(yt-dlp.exe --get-filename -o "$name_format" $opts $url)"
|
||||||
|
|
||||||
# Get the video filename.
|
# Get the video filename.
|
||||||
local filename=$(yt-dlp.exe --get-filename -o "$name_format.%(ext)s" $opts $url)
|
local filename=$(yt-dlp.exe --get-filename -f $yt_dlp_format -o "$name_format.%(ext)s" $opts $url)
|
||||||
|
|
||||||
# Download
|
# Download
|
||||||
if [[ $subscriber_vod -eq 0 ]]; then
|
if [[ $subscriber_vod == "0" ]]; then
|
||||||
local cmd="streamlink.exe --twitch-low-latency --twitch-disable-ads --twitch-disable-hosting --force --force-progress $opts $url $streamlink_format -O | ffmpeg -i pipe:0 -c copy \"$filename\""
|
local cmd="streamlink.exe --twitch-low-latency --twitch-disable-ads --twitch-disable-hosting --force --force-progress $opts $url $streamlink_format -O | ffmpeg -i pipe:0 -c copy \"$filename\""
|
||||||
else
|
else
|
||||||
local cmd="yt-dlp.exe -f $yt_dlp_format -o \"$filename\" $opts $url"
|
local cmd="yt-dlp.exe -f $yt_dlp_format -o \"$filename\" $opts $url"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
eval $cmd # Need to eval in order to preserve the quotes wrapping the filename format string.
|
printf "${YELLOW}${BOLD}Downloading video\n${NORMAL}"
|
||||||
|
|
||||||
|
eval $cmd # Need to eval in order to preserve the quotes wrapping the filename format string.
|
||||||
error=$?
|
error=$?
|
||||||
if [[ $error -eq 0 ]]; then
|
|
||||||
if [[ $compress -eq 1 ]]; then
|
if [[ $error -ne 0 ]]; then
|
||||||
|
error "Error: Failed to download '$url'"
|
||||||
|
if [[ $make_folder == "1" ]]; then cd ..; fi
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $compress == "1" ]]; then
|
||||||
local temp_name="temp_${RANDOM}"
|
local temp_name="temp_${RANDOM}"
|
||||||
# 1 arg = use GPU
|
# 0=cpu, 1=gpu
|
||||||
compress-video 0 "$filename" "$temp_name"
|
compress-video "$filename" "$temp_name" 0
|
||||||
extension="${filename##*.}"
|
extension="${filename##*.}"
|
||||||
mv "$filename" "orig_$filename"
|
mv "$filename" "orig_$filename"
|
||||||
mv $temp_name.$extension "$filename"
|
mv $temp_name.$extension "$filename"
|
||||||
printf "${BOLD}Make sure to delete the original video file${NORMAL}\n"
|
printf "${BOLD}Make sure to delete the original video file\n${NORMAL}"
|
||||||
fi
|
|
||||||
else
|
|
||||||
error "Error: Failed to download '$url'\n"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $make_folder == "1" ]]; then
|
if [[ $transcribe == "1" ]]; then
|
||||||
cd ..
|
my_transcribe_video "$filename"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ $make_folder == "1" ]]; then cd ..; fi
|
||||||
|
|
||||||
|
printf "${BOLD}Finished downloading ${YELLOW}$filename${NORMAL}\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Download Vimeo videos.
|
# Download Vimeo videos.
|
||||||
# Can download an embedded vid. You might need to save the site cookies if the vid is behind a paywall.
|
# Can download an embedded vid. You might need to save the site cookies if the vid is behind a paywall.
|
||||||
# e.g. yt-dlp.exe -F --cookies cookies.txt --referer https://gillyandkeeves.tv https://player.vimeo.com/video/756941969
|
# e.g. --cookies cookies.txt --referer https://gillyandkeeves.tv https://player.vimeo.com/video/756941969
|
||||||
# The vid ID can be found by looking at the embed's iframe src attribute.
|
# The vid ID can be found by looking at the embed's iframe src attribute.
|
||||||
dl_vimeo_vid() {
|
download_vimeo_vid() {
|
||||||
local format="$1"
|
local shortname="$1"
|
||||||
local shortname="$2"
|
local compress="$2"
|
||||||
local compress="$3"
|
local transcribe="$3"
|
||||||
local make_folder="$4"
|
local format="$4"
|
||||||
local url="$5"
|
local make_folder="$5"
|
||||||
|
local url="$6"
|
||||||
shift 5
|
shift 5
|
||||||
local opts="$@"
|
local opts="$@"
|
||||||
|
|
||||||
if [[ $url == "" ]]; then
|
if [[ $format == "" || $url == "" ]]; then
|
||||||
error "Format: $0 <make folder?> <url> <optional args>\n"
|
error "Usage: <format> <make folder?> <url> <optional args>"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $compress -eq 0 ]]; then
|
if [[ $shortname == "1" || $compress == "1" || $transcribe == "1" ]]; then
|
||||||
printf "${BOLD}Downloading Vimeo vid with no compression.${NORMAL}\n"
|
printf "${BOLD}Downloading Vimeo vid "
|
||||||
|
if [[ $shortname == "1" ]]; then printf "| ${YELLOW}using short name${NORMAL}${BOLD} "; fi
|
||||||
|
if [[ $compress == "1" ]]; then printf "| ${YELLOW}compression on${NORMAL}${BOLD} "; fi
|
||||||
|
if [[ $transcribe == "1" ]]; then printf "| ${YELLOW}audio transcription on${NORMAL}${BOLD} "; fi
|
||||||
|
printf "\n\n${NORMAL}"
|
||||||
else
|
else
|
||||||
printf "${BOLD}Downloading Vimeo vid with compression.${NORMAL}.\n"
|
printf "${BOLD}Downloading Vimeo vid\n\n${NORMAL}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $make_folder == "1" ]]; then
|
if [[ $make_folder == "1" ]]; then
|
||||||
@@ -649,7 +735,7 @@ dl_vimeo_vid() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $shortname -eq 0 ]]; then
|
if [[ $shortname == "0" ]]; then
|
||||||
local name_format="%(upload_date>%Y-%m-%d)s-%(title)s-vimeo-%(id)s"
|
local name_format="%(upload_date>%Y-%m-%d)s-%(title)s-vimeo-%(id)s"
|
||||||
else
|
else
|
||||||
local name_format="%(upload_date>%Y-%m-%d)s-shortname-vimeo-%(id)s"
|
local name_format="%(upload_date>%Y-%m-%d)s-shortname-vimeo-%(id)s"
|
||||||
@@ -663,33 +749,39 @@ dl_vimeo_vid() {
|
|||||||
|
|
||||||
error=$?
|
error=$?
|
||||||
if [[ $error -eq 0 ]]; then
|
if [[ $error -eq 0 ]]; then
|
||||||
if [[ $compress -eq 1 ]]; then
|
if [[ $compress == "1" ]]; then
|
||||||
local temp_name="temp_${RANDOM}"
|
local temp_name="temp_${RANDOM}"
|
||||||
# 1 arg = use GPU
|
# 0=cpu, 1=gpu
|
||||||
compress-video 1 "$filename" "$temp_name"
|
compress-video "$filename" "$temp_name" 0
|
||||||
extension="${filename##*.}"
|
extension="${filename##*.}"
|
||||||
mv "$filename" "orig_$filename"
|
mv "$filename" "orig_$filename"
|
||||||
mv $temp_name.$extension "$filename"
|
mv $temp_name.$extension "$filename"
|
||||||
printf "${BOLD}Make sure to delete the original video file${NORMAL}\n"
|
printf "${BOLD}Make sure to delete the original video file${NORMAL}\n"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
error "Error: Failed to download '$url'\n"
|
error "Error: Failed to download '$url'"
|
||||||
|
if [[ $make_folder == "1" ]]; then cd ..; fi
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $make_folder == "1" ]]; then
|
if [[ $transcribe == "1" ]]; then
|
||||||
cd ..
|
my_transcribe_video "$filename"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ $make_folder == "1" ]]; then cd ..; fi
|
||||||
|
|
||||||
|
printf "${BOLD}Finished downloading ${YELLOW}$filename${NORMAL}\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Download Twitter videos.
|
# Download Twitter videos.
|
||||||
dl_twitter_vid() {
|
download_twitter_vid() {
|
||||||
local format="$1"
|
local format="$1"
|
||||||
local make_folder="$2"
|
local make_folder="$2"
|
||||||
local url="$3"
|
local url="$3"
|
||||||
local vid_name="$4"
|
local vid_name="$4"
|
||||||
|
|
||||||
if [[ $url == "" ]]; then
|
if [[ $url == "" ]]; then
|
||||||
error "Format: $0 <make folder?> <url> <optional filename> <optional args>\n"
|
error "Usage: <make folder?> <url> <optional filename> <optional args>"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -724,21 +816,76 @@ dl_twitter_vid() {
|
|||||||
|
|
||||||
error=$?
|
error=$?
|
||||||
if [[ $error -eq 1 ]]; then
|
if [[ $error -eq 1 ]]; then
|
||||||
error "Error: Failed to download '$url'\n"
|
error "Error: Failed to download '$url'"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $make_folder == "1" ]]; then cd ..; fi
|
||||||
|
|
||||||
|
printf "${BOLD}Finished downloading ${YELLOW}$filename${NORMAL}\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Download Instagram videos.
|
||||||
|
download_instagram_vid() {
|
||||||
|
local transcribe="$1"
|
||||||
|
|
||||||
|
local make_folder="$2"
|
||||||
|
local url="$3"
|
||||||
|
local vid_name="$4"
|
||||||
|
|
||||||
|
if [[ $url == "" ]]; then
|
||||||
|
error "Usage: <make folder?> <url> <optional filename> <optional args>"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "${BOLD}Downloading Instagram vid.${NORMAL}\n"
|
||||||
|
|
||||||
|
if [[ $vid_name == "" ]]; then
|
||||||
|
local name_format="%(upload_date>%Y-%m-%d)s-%(title)s-ig-%(id)s"
|
||||||
|
local opts=""
|
||||||
|
else
|
||||||
|
local name_format="%(upload_date>%Y-%m-%d)s-${vid_name}-ig-%(id)s"
|
||||||
|
shift 4
|
||||||
|
local opts="$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $make_folder == "1" ]]; then
|
if [[ $make_folder == "1" ]]; then
|
||||||
cd ..
|
make_vid_dir_and_cd_into $url $vid_name $opts
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
format="b" # best available
|
||||||
|
|
||||||
|
# Download the video.
|
||||||
|
local filename=$(yt-dlp.exe --get-filename -f $format -o "$name_format.%(ext)s" $opts $url)
|
||||||
|
|
||||||
|
local cmd="yt-dlp.exe -f $format -o \"$filename\" $opts $url"
|
||||||
|
eval $cmd # Need to eval in order to preserve the quotes wrapping the filename format string.
|
||||||
|
|
||||||
|
error=$?
|
||||||
|
if [[ $error -eq 1 ]]; then
|
||||||
|
error "Error: Failed to download '$url'"
|
||||||
|
if [[ $make_folder == "1" ]]; then cd ..; fi
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $transcribe == "1" ]]; then
|
||||||
|
transcribe "$filename"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $make_folder == "1" ]]; then cd ..; fi
|
||||||
|
|
||||||
|
printf "${BOLD}Finished downloading ${YELLOW}$filename${NORMAL}\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Download MP4 video.
|
# Download MP4 video.
|
||||||
dl_mp4() {
|
download_mp4() {
|
||||||
local url="$1"
|
local url="$1"
|
||||||
local filename="$2"
|
local filename="$2"
|
||||||
|
|
||||||
if [[ $url == "" || $filename == "" ]]; then
|
if [[ $url == "" || $filename == "" ]]; then
|
||||||
error "Format: $0 <url> <filename>\n"
|
error "Usage: <url> <filename>"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -748,7 +895,7 @@ dl_mp4() {
|
|||||||
curl "$url" -o $temp_name
|
curl "$url" -o $temp_name
|
||||||
|
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
error "Error: failed to download.\n"
|
error "Error: failed to download."
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -756,12 +903,12 @@ dl_mp4() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Download from m3u8 stream to mp4.
|
# Download from m3u8 stream to mp4.
|
||||||
dl_from_m3u8() {
|
download_from_m3u8() {
|
||||||
local m3u8_path="$1"
|
local m3u8_path="$1"
|
||||||
local filename="$2"
|
local filename="$2"
|
||||||
|
|
||||||
if [[ $m3u8_path == "" || $filename == "" ]]; then
|
if [[ $m3u8_path == "" || $filename == "" ]]; then
|
||||||
error "Format: $0 <m3u8 path> <filename>\n"
|
error "Usage: <m3u8 path> <filename>"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -769,102 +916,138 @@ dl_from_m3u8() {
|
|||||||
ffmpeg.exe -protocol_whitelist file,https,crypto,tls,tcp -i $m3u8_path -acodec copy -vcodec copy "${filename}.mp4"
|
ffmpeg.exe -protocol_whitelist file,https,crypto,tls,tcp -i $m3u8_path -acodec copy -vcodec copy "${filename}.mp4"
|
||||||
|
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
error "Error: failed to download.\n"
|
error "Error: failed to download."
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "${BOLD}Finished downloading ${YELLOW}$filename${NORMAL}\n"
|
printf "${BOLD}Finished downloading ${YELLOW}$filename${NORMAL}\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Download Instagram video and flip horizontally.
|
|
||||||
dl_instagram_vid_and_hflip() {
|
|
||||||
local url="$1"
|
|
||||||
local filename="$2"
|
|
||||||
|
|
||||||
if [[ $url == "" || $filename == "" ]]; then
|
|
||||||
error "Format: $0 <url> <filename>\n"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
temp_name="temp_${RANDOM}.mp4"
|
|
||||||
|
|
||||||
printf "${BOLD}Downloading: ${YELLOW}$filename${NORMAL}\n"
|
|
||||||
curl "$url" -o $temp_name
|
|
||||||
|
|
||||||
if [[ $? -ne 0 ]]; then
|
|
||||||
error "Error: failed to download.\n"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Flip
|
|
||||||
ffmpeg -i $temp_name -vf hflip -c:a copy "copy_$temp_name"
|
|
||||||
mv copy_${temp_name} "$filename.mp4"
|
|
||||||
rm $temp_name
|
|
||||||
}
|
|
||||||
|
|
||||||
|
#-------------------------------------------------
|
||||||
# YouTube Vid DL
|
# YouTube Vid DL
|
||||||
alias yt='dl_youtube_vid "" $SHORTNAME_OFF'
|
#-------------------------------------------------
|
||||||
alias yt-shortname='dl_youtube_vid "" $SHORTNAME_ON'
|
alias yt-list='download_youtube_uploads_list 0 '
|
||||||
alias yt-1080='dl_youtube_vid "137+140" $SHORTNAME_OFF'
|
alias yt-list-desc='download_youtube_uploads_list 1 '
|
||||||
alias yt-1080-shortname='dl_youtube_vid "137+140" $SHORTNAME_ON'
|
|
||||||
alias yt-720='dl_youtube_vid "136+140" $SHORTNAME_OFF'
|
|
||||||
alias yt-720-shortname='dl_youtube_vid "136+140" $SHORTNAME_ON'
|
|
||||||
|
|
||||||
alias yt-playlist='dl_youtube_playlist ""'
|
alias yt='download_youtube_vid "" $SHORTNAME_OFF $TRANSCRIBE_OFF'
|
||||||
alias yt-playlist-1080='dl_youtube_playlist "137+140"'
|
alias yt-shortname='download_youtube_vid "" $SHORTNAME_ON $TRANSCRIBE_OFF'
|
||||||
alias yt-playlist-720='dl_youtube_playlist "136+140"'
|
alias yt-1080='download_youtube_vid "137+140" $SHORTNAME_OFF $TRANSCRIBE_OFF'
|
||||||
alias yt-playlist-tiny='dl_youtube_playlist "160+140"'
|
alias yt-1080-shortname='download_youtube_vid "137+140" $SHORTNAME_ON $TRANSCRIBE_OFF'
|
||||||
|
alias yt-720='download_youtube_vid "136+140" $SHORTNAME_OFF $TRANSCRIBE_OFF'
|
||||||
|
alias yt-720-shortname='download_youtube_vid "136+140" $SHORTNAME_ON $TRANSCRIBE_OFF'
|
||||||
|
#TRANSCRIPTION ON
|
||||||
|
alias ytt='download_youtube_vid "" $SHORTNAME_OFF $TRANSCRIBE_ON'
|
||||||
|
alias yt-shortname-t='download_youtube_vid "" $SHORTNAME_ON $TRANSCRIBE_ON'
|
||||||
|
alias yt-1080-t='download_youtube_vid "137+140" $SHORTNAME_OFF $TRANSCRIBE_ON'
|
||||||
|
alias yt-1080-shortname-t='download_youtube_vid "137+140" $SHORTNAME_ON $TRANSCRIBE_ON'
|
||||||
|
alias yt-720-t='download_youtube_vid "136+140" $SHORTNAME_OFF $TRANSCRIBE_ON'
|
||||||
|
alias yt-720-shortname-t='download_youtube_vid "136+140" $SHORTNAME_ON $TRANSCRIBE_ON'
|
||||||
|
#---------------------------
|
||||||
|
alias yt-playlist='download_youtube_playlist ""'
|
||||||
|
alias yt-playlist-list='download_youtube_playlist_list '
|
||||||
|
alias yt-playlist-1080='download_youtube_playlist "137+140"'
|
||||||
|
alias yt-playlist-720='download_youtube_playlist "136+140"'
|
||||||
|
alias yt-playlist-tiny='download_youtube_playlist "160+140"'
|
||||||
alias yt-audio='yt-dlp.exe -f "140"'
|
alias yt-audio='yt-dlp.exe -f "140"'
|
||||||
alias yt-and-hflip='dl_youtube_vid_and_hflip "137+140"' # 1080p
|
|
||||||
|
|
||||||
|
#-------------------------------------------------
|
||||||
# Twitch Vid DL
|
# Twitch Vid DL
|
||||||
alias tw='dl_twitch_vid "" $SHORTNAME_OFF $COMPRESSION_OFF'
|
#-------------------------------------------------
|
||||||
alias tw-compressed='dl_twitch_vid "" $SHORTNAME_OFF $COMPRESSION_ON'
|
alias tw-chat='download_twitch_chat'
|
||||||
alias tw-shortname='dl_twitch_vid "" $SHORTNAME_ON $COMPRESSION_OFF'
|
|
||||||
alias tw-shortname-compressed='dl_twitch_vid "" $SHORTNAME_ON $COMPRESSION_ON'
|
|
||||||
alias tw-custom='dl_twitch_vid '
|
|
||||||
alias tw-chat='dl_twitch_chat'
|
|
||||||
|
|
||||||
alias tw-1080='dl_twitch_vid "1080" $SHORTNAME_OFF $COMPRESSION_OFF'
|
alias tw='download_twitch_vid "" $SHORTNAME_OFF $COMPRESSION_OFF $TRANSCRIBE_OFF'
|
||||||
alias tw-1080-compressed='dl_twitch_vid "1080" $SHORTNAME_OFF $COMPRESSION_ON'
|
alias tw-compressed='download_twitch_vid "" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||||
alias tw-1080-shortname='dl_twitch_vid "1080" $SHORTNAME_ON $COMPRESSION_OFF'
|
alias tw-shortname='download_twitch_vid "" $SHORTNAME_ON $COMPRESSION_OFF $TRANSCRIBE_OFF'
|
||||||
alias tw-1080-shortname-compressed='dl_twitch_vid "1080" $SHORTNAME_ON $COMPRESSION_ON'
|
alias tw-shortname-compressed='download_twitch_vid "" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||||
|
alias tw-source='download_twitch_vid "Source" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||||
|
alias tw-custom='download_twitch_vid '
|
||||||
|
#TRANSCRIPTION ON
|
||||||
|
alias twt='download_twitch_vid "" $SHORTNAME_OFF $COMPRESSION_OFF $TRANSCRIBE_ON'
|
||||||
|
alias tw-compressed-t='download_twitch_vid "" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||||
|
alias tw-shortname-t='download_twitch_vid "" $SHORTNAME_ON $COMPRESSION_OFF $TRANSCRIBE_ON'
|
||||||
|
alias tw-shortname-compressed-t='download_twitch_vid "" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||||
|
alias tw-source-t='download_twitch_vid "Source" "Source" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||||
|
|
||||||
alias tw-1080p60='dl_twitch_vid "1080p60" $SHORTNAME_OFF $COMPRESSION_OFF'
|
#1080p
|
||||||
alias tw-1080p50='dl_twitch_vid "1080p50" $SHORTNAME_OFF $COMPRESSION_OFF'
|
alias tw-1080='download_twitch_vid "1080" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||||
alias tw-1080p60-compressed='dl_twitch_vid "1080p60" $SHORTNAME_OFF $COMPRESSION_ON'
|
alias tw-1080-compressed='download_twitch_vid "1080" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||||
alias tw-1080p50-compressed='dl_twitch_vid "1080p50" $SHORTNAME_OFF $COMPRESSION_ON'
|
alias tw-1080-shortname='download_twitch_vid "1080" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||||
alias tw-1080p60-shortname='dl_twitch_vid "1080p60" $SHORTNAME_ON $COMPRESSION_OFF'
|
alias tw-1080-shortname-compressed='download_twitch_vid "1080" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||||
alias tw-1080p50-shortname='dl_twitch_vid "1080p50" $SHORTNAME_ON $COMPRESSION_OFF'
|
#TRANSCRIPTION ON
|
||||||
alias tw-1080p60-shortname-compressed='dl_twitch_vid "1080p60" $SHORTNAME_ON $COMPRESSION_ON'
|
alias tw-1080-t='download_twitch_vid "1080" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||||
alias tw-1080p50-shortname-compressed='dl_twitch_vid "1080p50" $SHORTNAME_ON $COMPRESSION_ON'
|
alias tw-1080-compressed-t='download_twitch_vid "1080" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||||
|
alias tw-1080-shortname-t='download_twitch_vid "1080" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||||
|
alias tw-1080-shortname-compressed-t='download_twitch_vid "1080" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||||
|
|
||||||
alias tw-720='dl_twitch_vid "720p" $SHORTNAME_OFF $COMPRESSION_OFF'
|
#1080p60/50
|
||||||
alias tw-720-compressed='dl_twitch_vid "720p" $SHORTNAME_OFF $COMPRESSION_ON'
|
alias tw-1080p60='download_twitch_vid "1080p60" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||||
alias tw-720-shortname='dl_twitch_vid "720p" $SHORTNAME_ON $COMPRESSION_OFF'
|
alias tw-1080p50='download_twitch_vid "1080p50" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||||
alias tw-720p60='dl_twitch_vid "720p60" $SHORTNAME_OFF $COMPRESSION_OFF'
|
alias tw-1080p60-compressed='download_twitch_vid "1080p60" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||||
alias tw-720p60-shortname='dl_twitch_vid "720p60" $SHORTNAME_ON $COMPRESSION_OFF'
|
alias tw-1080p50-compressed='download_twitch_vid "1080p50" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||||
|
alias tw-1080p60-shortname='download_twitch_vid "1080p60" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||||
|
alias tw-1080p50-shortname='download_twitch_vid "1080p50" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||||
|
alias tw-1080p60-shortname-compressed='download_twitch_vid "1080p60" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||||
|
alias tw-1080p50-shortname-compressed='download_twitch_vid "1080p50" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||||
|
#TRANSCRIPTION ON
|
||||||
|
alias tw-1080p60-t='download_twitch_vid "1080p60" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||||
|
alias tw-1080p50-t='download_twitch_vid "1080p50" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||||
|
alias tw-1080p60-compressed-t='download_twitch_vid "1080p60" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||||
|
alias tw-1080p50-compressed-t='download_twitch_vid "1080p50" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||||
|
alias tw-1080p60-shortname-t='download_twitch_vid "1080p60" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||||
|
alias tw-1080p50-shortname-t='download_twitch_vid "1080p50" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||||
|
alias tw-1080p60-shortname-compressed-t='download_twitch_vid "1080p60" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||||
|
alias tw-1080p50-shortname-compressed-t='download_twitch_vid "1080p50" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||||
|
|
||||||
alias tw-4k='dl_twitch_vid "2160p" $SHORTNAME_OFF $COMPRESSION_OFF'
|
#720p
|
||||||
alias tw-4k-compressed='dl_twitch_vid "2160p" $SHORTNAME_OFF $COMPRESSION_ON'
|
alias tw-720='download_twitch_vid "720p" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||||
alias tw-4k-shortname='dl_twitch_vid "2160p" $SHORTNAME_ON $COMPRESSION_OFF'
|
alias tw-720-compressed='download_twitch_vid "720p" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||||
alias tw-4k-shortname-compressed='dl_twitch_vid "2160p" $SHORTNAME_ON $COMPRESSION_ON'
|
alias tw-720-shortname='download_twitch_vid "720p" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||||
|
alias tw-720p60='download_twitch_vid "720p60" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||||
|
alias tw-720p60-shortname='download_twitch_vid "720p60" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||||
|
#TRANSCRIPTION ON
|
||||||
|
alias tw-720-t='download_twitch_vid "720p" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||||
|
alias tw-720-compressed-t='download_twitch_vid "720p" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||||
|
alias tw-720-shortname-t='download_twitch_vid "720p" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||||
|
alias tw-720p60-t='download_twitch_vid "720p60" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||||
|
alias tw-720p60-shortname-t='download_twitch_vid "720p60" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||||
|
|
||||||
alias tw-source='dl_twitch_vid "Source" $SHORTNAME_OFF $COMPRESSION_OFF'
|
#4k
|
||||||
|
alias tw-4k='download_twitch_vid "2160p" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||||
|
alias tw-4k-compressed='download_twitch_vid "2160p" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||||
|
alias tw-4k-shortname='download_twitch_vid "2160p" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||||
|
alias tw-4k-shortname-compressed='download_twitch_vid "2160p" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||||
|
#TRANSCRIPTION ON
|
||||||
|
alias tw-4k-t='download_twitch_vid "2160p" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||||
|
alias tw-4k-compressed-t='download_twitch_vid "2160p" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||||
|
alias tw-4k-shortname-t='download_twitch_vid "2160p" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||||
|
alias tw-4k-shortname-compressed-t='download_twitch_vi "2160p" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||||
|
|
||||||
|
|
||||||
|
#-------------------------------------------------
|
||||||
# Vimeo Vid DL
|
# Vimeo Vid DL
|
||||||
alias vimeo='dl_vimeo_vid "Original" $SHORTNAME_OFF $COMPRESSION_OFF'
|
#-------------------------------------------------
|
||||||
alias vimeo-compressed='dl_vimeo_vid "Original" $SHORTNAME_OFF $COMPRESSION_ON'
|
alias vimeo='download_vimeo_vid $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||||
|
alias vimeo-t='download_vimeo_vid $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||||
|
alias vimeo-compressed='download_vimeo_vid $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||||
|
alias vimeo-compressed-t='download_vimeo_vid $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||||
|
|
||||||
|
#-------------------------------------------------
|
||||||
# Instagram Vid DL
|
# Instagram Vid DL
|
||||||
alias ig-download-and-hflip='dl_instagram_vid_and_hflip '
|
#-------------------------------------------------
|
||||||
|
alias ig='download_instagram_vid $TRANSCRIBE_OFF'
|
||||||
|
alias igt='download_instagram_vid $TRANSCRIBE_ON'
|
||||||
|
|
||||||
|
#-------------------------------------------------
|
||||||
# Twitter Vid DL
|
# Twitter Vid DL
|
||||||
alias twitter='dl_twitter_vid "" '
|
#-------------------------------------------------
|
||||||
|
alias twitter='download_twitter_vid "" '
|
||||||
|
|
||||||
|
#-------------------------------------------------
|
||||||
# Misc
|
# Misc
|
||||||
alias download-mp4='dl_mp4'
|
#-------------------------------------------------
|
||||||
alias download-from-m3u8='dl_from_m3u8'
|
alias download-mp4='download_mp4'
|
||||||
|
alias download-from-m3u8='download_from_m3u8'
|
||||||
|
|
||||||
####################################################################################################
|
####################################################################################################
|
||||||
# Video Compression
|
# Video Compression
|
||||||
@@ -875,11 +1058,11 @@ function _compress_video_hard() {
|
|||||||
local name="$1"
|
local name="$1"
|
||||||
local out="$2"
|
local out="$2"
|
||||||
if [[ name == "" || out == "" ]]; then
|
if [[ name == "" || out == "" ]]; then
|
||||||
error "Format: cmd <source> <dest>\n"
|
error "Usage: cmd <source> <dest>"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
# 1 arg = use GPU
|
# 0=cpu, 1=gpu
|
||||||
compress-video-with-crf 1 $crf "$name" "$out"
|
compress-video-with-crf $crf "$name" "$out" 0
|
||||||
}
|
}
|
||||||
|
|
||||||
alias compress-video-hard='_compress_video_hard'
|
alias compress-video-hard='_compress_video_hard'
|
||||||
@@ -953,7 +1136,7 @@ alias gaup='git add --update -p'
|
|||||||
alias gb='git branch -v'
|
alias gb='git branch -v'
|
||||||
alias gbb='git bisect bad'
|
alias gbb='git bisect bad'
|
||||||
alias gbd='git branch -D'
|
alias gbd='git branch -D'
|
||||||
alias gbdr='git branch -Dr'
|
alias gbdr='git branch -Dr' # Delete a remote tracking branch; useful when the remote no longer exists and branch pruning isn't removing the lingering tracking branches.
|
||||||
alias gbg='git bisect good'
|
alias gbg='git bisect good'
|
||||||
alias gbl='git branch --all'
|
alias gbl='git branch --all'
|
||||||
alias gblm='git blame -wMC'
|
alias gblm='git blame -wMC'
|
||||||
@@ -1002,6 +1185,7 @@ alias gmffs='git merge --ff-only --squash'
|
|||||||
alias gmtheirs='git merge -Xtheirs'
|
alias gmtheirs='git merge -Xtheirs'
|
||||||
alias gp='git push'
|
alias gp='git push'
|
||||||
alias gpa='git push --all && echo "pushing tags..." && git push --tags'
|
alias gpa='git push --all && echo "pushing tags..." && git push --tags'
|
||||||
|
alias gpaf='git push --all -f && echo "pushing tags..." && git push --tags -f'
|
||||||
alias gpf='git push -f'
|
alias gpf='git push -f'
|
||||||
alias gpff='git pull --ff-only'
|
alias gpff='git pull --ff-only'
|
||||||
alias gplu='git pull --set-upstream origin HEAD'
|
alias gplu='git pull --set-upstream origin HEAD'
|
||||||
@@ -1053,10 +1237,11 @@ alias gsp3='git stash pop stash@{3}'
|
|||||||
alias gsp4='git stash pop stash@{4}'
|
alias gsp4='git stash pop stash@{4}'
|
||||||
alias gsp5='git stash pop stash@{6}'
|
alias gsp5='git stash pop stash@{6}'
|
||||||
alias gsp6='git stash pop stash@{7}'
|
alias gsp6='git stash pop stash@{7}'
|
||||||
alias gt='git tag -s' # Signed
|
alias gt='git tag' # Unsigned
|
||||||
alias gta='git tag -a'
|
alias gta='git tag -a'
|
||||||
alias gtd='git tag -d'
|
alias gtd='git tag -d'
|
||||||
alias gtl='git tag -l'
|
alias gtl='git tag -l'
|
||||||
|
alias gts='git tag -s' # Signed
|
||||||
alias gx='git reset --hard'
|
alias gx='git reset --hard'
|
||||||
alias gxx='git reset --hard HEAD~1'
|
alias gxx='git reset --hard HEAD~1'
|
||||||
alias gxom='git reset --hard origin/master'
|
alias gxom='git reset --hard origin/master'
|
||||||
@@ -13,16 +13,20 @@ esac
|
|||||||
export PLATFORM=$platform
|
export PLATFORM=$platform
|
||||||
export PLATFORM_OS=$platform_os
|
export PLATFORM_OS=$platform_os
|
||||||
|
|
||||||
test -f "$HOME/.env.platform" && . "$HOME/.env.platform"
|
os_lower="${platform_os,,}"
|
||||||
|
test -f "$HOME/dotfiles/${os_lower}/env.platform" && . "$HOME/dotfiles/${os_lower}/env.platform"
|
||||||
|
|
||||||
test -f "$HOME/.env.common-pre" && . "$HOME/.env.common-pre"
|
test -f "$HOME/.env.common-pre" && . "$HOME/.env.common-pre"
|
||||||
test -f "$HOME/.env.private" && . "$HOME/.env.private"
|
test -f "$HOME/.env.private" && . "$HOME/.env.private"
|
||||||
test -f "$HOME/.env.common-post" && . "$HOME/.env.common-post"
|
test -f "$HOME/.env.common-post" && . "$HOME/.env.common-post"
|
||||||
|
|
||||||
test -f "$HOME/.aliases" && . "$HOME/.aliases"
|
test -f "$HOME/.aliases" && . "$HOME/.aliases"
|
||||||
test -f "$HOME/.aliases.common" && . "$HOME/.aliases.common"
|
test -f "$HOME/.aliases.common" && . "$HOME/.aliases.common"
|
||||||
test -f "$HOME/.aliases.private" && . "$HOME/.aliases.private"
|
test -f "$HOME/.aliases.private" && . "$HOME/.aliases.private"
|
||||||
|
|
||||||
if [[ $_MC_SET_ENV_PATH -ne 1 ]]; then
|
if [[ $_MC_SET_ENV_PATH -ne 1 ]]; then
|
||||||
test -d "$HOME/bin" && export PATH=$HOME/bin/:$PATH
|
test -d "$HOME/bin" && export PATH=$HOME/bin/:$PATH
|
||||||
|
#TODO: remove this
|
||||||
test -d "$HOME/.dotfiles/bin" && export PATH=$HOME/.dotfiles/bin/:$PATH
|
test -d "$HOME/.dotfiles/bin" && export PATH=$HOME/.dotfiles/bin/:$PATH
|
||||||
fi
|
fi
|
||||||
|
|
||||||
5
.gitattributes
vendored
Normal file
5
.gitattributes
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# All text files will have LF line endings, except batch files.
|
||||||
|
* text=auto
|
||||||
|
|
||||||
|
# Preserve crlf in batch files when checking in.
|
||||||
|
*.bat text eol=crlf
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
[include]
|
[include]
|
||||||
path = ~/.gitconfig.platform
|
|
||||||
path = ~/.gitconfig.private
|
path = ~/.gitconfig.private
|
||||||
[init]
|
[init]
|
||||||
defaultBranch = master
|
defaultBranch = master
|
||||||
@@ -7,11 +6,25 @@
|
|||||||
summary = true
|
summary = true
|
||||||
tool = vimdiff
|
tool = vimdiff
|
||||||
[core]
|
[core]
|
||||||
excludesfile = ~/.gitignore
|
excludesfile = ~/.gitignore.global
|
||||||
hookspath = ~/.git_hooks
|
hookspath = ~/.git_hooks
|
||||||
preloadindex = true
|
preloadindex = true
|
||||||
fscache = true
|
fscache = true
|
||||||
editor = vim
|
editor = vim
|
||||||
|
# I used to have this set to true, which would result in checked out files
|
||||||
|
# being converted to CRLF line endings and commits converting to LF. I'm
|
||||||
|
# tired of this conversion shit though so I'm turning it off and will be
|
||||||
|
# enforcing LF line endings via a combination of editorconfig and
|
||||||
|
# gitattribute files on a per-project basis. This should make sure that
|
||||||
|
# anyone contributing to my projects will be committing LF line endings.
|
||||||
|
# The only exception is that the gitattributes files will commit batch
|
||||||
|
# files with CRLF to avoid Windows glitches.
|
||||||
|
#
|
||||||
|
# I used these posts for reference:
|
||||||
|
# https://markentier.tech/posts/2021/10/autocrlf-true-considered-harmful/
|
||||||
|
# https://troyready.com/blog/git-windows-dont-convert-line-endings.html
|
||||||
|
#
|
||||||
|
autocrlf = false
|
||||||
[push]
|
[push]
|
||||||
default = upstream
|
default = upstream
|
||||||
[pull]
|
[pull]
|
||||||
10
.gitignore
vendored
10
.gitignore
vendored
@@ -1,9 +1 @@
|
|||||||
vim/.netrwhist
|
*
|
||||||
vim/bundle/*
|
|
||||||
vim/plugged/*
|
|
||||||
vim/undo
|
|
||||||
vim/undo/*
|
|
||||||
vim/autoload/plug.vim.old
|
|
||||||
config/openbox/lxde-rc.xml
|
|
||||||
*.pyc
|
|
||||||
!bin
|
|
||||||
|
|||||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +0,0 @@
|
|||||||
[submodule "vim/bundle/Vundle.vim"]
|
|
||||||
path = vim/bundle/Vundle.vim
|
|
||||||
url = https://github.com/VundleVim/Vundle.vim.git
|
|
||||||
162
.vim/colors/campo-dark-blue.vim
Normal file
162
.vim/colors/campo-dark-blue.vim
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
" A simple dark vim colorscheme.
|
||||||
|
" Created by Michael Campagnaro (https://git.michael.is)
|
||||||
|
|
||||||
|
if has('termguicolors')
|
||||||
|
" Supports 24-bit color range
|
||||||
|
set termguicolors
|
||||||
|
let g:campo_theme_use_rainbow_parens = 0
|
||||||
|
else
|
||||||
|
echoerr "This theme requires 'termguicolors' support!"
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !has("gui_running") && &t_Co != 88 && &t_Co != 256
|
||||||
|
echoerr "Don't have expected color support!"
|
||||||
|
endif
|
||||||
|
|
||||||
|
set background=dark
|
||||||
|
hi clear
|
||||||
|
syntax reset
|
||||||
|
|
||||||
|
source $HOME/.vim/colors/utils
|
||||||
|
let g:colors_name = "campo-dark-blue"
|
||||||
|
|
||||||
|
" Shared colors
|
||||||
|
let s:blue = "3699cc"
|
||||||
|
let s:purple = "ce93d8"
|
||||||
|
let s:grey = "b0bec5"
|
||||||
|
let s:orange = "ffb74d"
|
||||||
|
let s:yellow = "fff176"
|
||||||
|
let s:green = "88b888"
|
||||||
|
let s:red = "ef2929"
|
||||||
|
let s:text = "f1f1e8" " A majority of the syntax will use this.
|
||||||
|
let s:bg = "072730"
|
||||||
|
let s:select = "546e8f"
|
||||||
|
let s:window = "37474f"
|
||||||
|
let s:comment = "5dea82"
|
||||||
|
let s:tab = "03404a"
|
||||||
|
let s:error = "e40e0e"
|
||||||
|
let s:proc = "0eefcb"
|
||||||
|
let s:warn = "dcd53e"
|
||||||
|
let s:spell = "aaf53e"
|
||||||
|
|
||||||
|
" Vim
|
||||||
|
call X("Normal", s:text, s:bg, "")
|
||||||
|
call X("LineNr", s:grey, "", "")
|
||||||
|
call X("NonText", s:text, "", "")
|
||||||
|
call X("SpecialKey", s:blue, "", "")
|
||||||
|
call X("Search", s:text, s:select, "")
|
||||||
|
call X("TabLineSel", s:text, s:bg, "bold")
|
||||||
|
call X("TabLine", "dddddd", s:tab, "none")
|
||||||
|
call X("TabLineFill", "", s:tab, "none") " The tab line region that doesn't contain tab entries.
|
||||||
|
call X("StatusLine", s:window, s:text, "reverse")
|
||||||
|
call X("StatusLineNC", s:window, s:comment, "reverse")
|
||||||
|
call X("VertSplit", s:window, s:window, "none")
|
||||||
|
call X("Visual", "", s:select, "")
|
||||||
|
call X("Directory", s:blue, "", "")
|
||||||
|
call X("ModeMsg", s:green, "", "")
|
||||||
|
call X("MoreMsg", s:green, "", "")
|
||||||
|
call X("Question", s:green, "", "")
|
||||||
|
call X("MatchParen", "", s:select, "")
|
||||||
|
call X("Folded", s:comment, s:bg, "")
|
||||||
|
call X("FoldColumn", s:comment, s:bg, "")
|
||||||
|
call X("SpellBad", s:spell, s:bg, "bold")
|
||||||
|
call X("SpellCap", s:text, s:bg, "") " A word that should start with a capital
|
||||||
|
call X("SpellLocal", s:spell, s:bg, "bold") " Correctly spelled but used in another region.
|
||||||
|
call X("SpellRare", s:text, s:bg, "") " A correctly spelled that is hardly ever used. Don't care about this.
|
||||||
|
call X("ErrorMsg", s:error, s:bg, "bold")
|
||||||
|
if version >= 700
|
||||||
|
call X("PMenu", s:text, s:select, "none") " Autocompletion menu
|
||||||
|
call X("PMenuSel", s:text, "027990", "bold") " Selected autocompletion item
|
||||||
|
call X("SignColumn", "", s:bg, "none")
|
||||||
|
call X("CursorLine", "", "022f36", "none") " Horizontal line at the cursor.
|
||||||
|
call X("CursorColumn", "", "022c33", "none") " Vertical line at the cursor.
|
||||||
|
end
|
||||||
|
if version >= 703
|
||||||
|
call X("ColorColumn", "", "022c33", "none") " Vertical line set by colorcolumn option.
|
||||||
|
end
|
||||||
|
|
||||||
|
" Standard Highlighting
|
||||||
|
call X("Comment", s:comment, "", "")
|
||||||
|
call X("Title", s:comment, "", "")
|
||||||
|
call X("Cursor", "", s:text, "")
|
||||||
|
call X("Identifier", s:grey, "", "none")
|
||||||
|
call X("Statement", s:text, "", "") " 'return', 'goto', 'case', 'break', etc
|
||||||
|
call X("Conditional", s:text, "", "")
|
||||||
|
call X("Repeat", s:text, "", "") " 'for' and 'while'
|
||||||
|
call X("Structure", "ae90ea", "", "")
|
||||||
|
call X("Function", s:proc, "", "")
|
||||||
|
call X("Constant", s:text, "", "") " Constants, e.g. SOME_CONST
|
||||||
|
call X("Boolean", s:text, "", "") " true, false
|
||||||
|
call X("String", s:text, "", "")
|
||||||
|
call X("Special", s:text, "", "")
|
||||||
|
call X("PreProc", s:text, "", "")
|
||||||
|
call X("Operator", s:text, "", "none")
|
||||||
|
call X("Type", s:text, "", "") " Data types
|
||||||
|
call X("Define", "a5bce4", "", "none")
|
||||||
|
call X("Include", s:text, "", "") " #include in C/C++
|
||||||
|
call X("Number", s:text, "", "")
|
||||||
|
|
||||||
|
" Notes
|
||||||
|
call X("Todo", "b8fbb0", s:bg, "underline")
|
||||||
|
call X("Bugs", "d8fbb0", s:bg, "standout")
|
||||||
|
call X("Notes", "ffffff", s:bg, "standout")
|
||||||
|
call X("Notices", s:warn, s:bg, "bold")
|
||||||
|
|
||||||
|
" Build markers
|
||||||
|
call X("BuildError", s:error, s:bg, "bold")
|
||||||
|
call X("BuildWarn", s:warn, s:bg, "bold")
|
||||||
|
call X("BuildInfo", s:text, s:bg, "bold")
|
||||||
|
|
||||||
|
" Jai Highlighting
|
||||||
|
call X("jaiVariableDeclaration", s:text, "", "")
|
||||||
|
call X("jaiTagNote", s:orange, "", "bold")
|
||||||
|
|
||||||
|
" airblade/vim-gitgutter
|
||||||
|
call X("GitGutterAdd", s:green, "", "")
|
||||||
|
call X("GitGutterDelete", s:red, "", "")
|
||||||
|
call X("GitGutterChange", s:yellow, "", "")
|
||||||
|
call X("GitGutterChangeDelete", s:orange, "", "")
|
||||||
|
|
||||||
|
" C Highlighting
|
||||||
|
call X("cType", s:text, "", "")
|
||||||
|
call X("cStorageClass", s:text, "", "")
|
||||||
|
call X("cConditional", s:text, "", "")
|
||||||
|
call X("cRepeat", s:text, "", "")
|
||||||
|
|
||||||
|
" Python Highlighting
|
||||||
|
call X("pythonInclude", s:red, "", "")
|
||||||
|
call X("pythonStatement", s:blue, "", "")
|
||||||
|
call X("pythonConditional", s:purple, "", "")
|
||||||
|
call X("pythonRepeat", s:purple, "", "")
|
||||||
|
call X("pythonException", s:purple, "", "")
|
||||||
|
call X("pythonFunction", s:proc, "", "")
|
||||||
|
call X("pythonSelf", s:grey, "", "")
|
||||||
|
call X("pythonOperator", s:purple, "", "")
|
||||||
|
call X("pythonExtraOperator", s:purple, "", "")
|
||||||
|
call X("pythonClass", s:proc, "", "")
|
||||||
|
call X("pythonDecorator", s:orange, "", "")
|
||||||
|
call X("pythonDocstring", s:comment, "", "")
|
||||||
|
call X("pythonBuiltinObj", s:yellow, "", "")
|
||||||
|
call X("pythonBuiltinType", s:orange, "", "")
|
||||||
|
call X("pythonNumber", s:orange, "", "")
|
||||||
|
|
||||||
|
" JS Highlighting
|
||||||
|
call X("javaScriptBraces", s:text, "", "")
|
||||||
|
call X("javaScriptFunction", s:purple, "", "")
|
||||||
|
call X("javaScriptConditional", s:purple, "", "")
|
||||||
|
call X("javaScriptRepeat", s:purple, "", "")
|
||||||
|
call X("javaScriptNumber", s:orange, "", "")
|
||||||
|
call X("javaScriptMember", s:orange, "", "")
|
||||||
|
|
||||||
|
" HTML Highlighting
|
||||||
|
call X("htmlTag", s:text, "", "")
|
||||||
|
call X("htmlTagName", s:text, "", "")
|
||||||
|
call X("htmlArg", s:text, "", "")
|
||||||
|
call X("htmlScriptTag", s:blue, "", "")
|
||||||
|
|
||||||
|
" Diff Highlighting
|
||||||
|
call X("DiffAdd", s:window, s:green, "none")
|
||||||
|
call X("DiffDelete", s:window, s:red, "none")
|
||||||
|
call X("DiffChange", s:window, s:yellow, "none")
|
||||||
|
call X("DiffText", s:bg, s:yellow, "none")
|
||||||
|
|
||||||
@@ -447,9 +447,6 @@ if has("gui_running") || &t_Co == 88 || &t_Co == 256
|
|||||||
call <SID>X("bladeKeyword", s:blue, "", "")
|
call <SID>X("bladeKeyword", s:blue, "", "")
|
||||||
|
|
||||||
" Diff Highlighting
|
" Diff Highlighting
|
||||||
call <SID>X("diffAdded", "", s:green, "none")
|
|
||||||
call <SID>X("diffRemoved", "", s:red, "none")
|
|
||||||
call <SID>X("diffChanged", "", s:yellow, "none")
|
|
||||||
call <SID>X("DiffAdd", s:window, s:green, "none")
|
call <SID>X("DiffAdd", s:window, s:green, "none")
|
||||||
call <SID>X("DiffDelete", s:window, s:red, "none")
|
call <SID>X("DiffDelete", s:window, s:red, "none")
|
||||||
call <SID>X("DiffChange", s:window, s:yellow, "none")
|
call <SID>X("DiffChange", s:window, s:yellow, "none")
|
||||||
@@ -414,9 +414,6 @@ if has("gui_running") || &t_Co == 88 || &t_Co == 256
|
|||||||
call <SID>X("bladeKeyword", s:blue, "", "")
|
call <SID>X("bladeKeyword", s:blue, "", "")
|
||||||
|
|
||||||
" Diff Highlighting
|
" Diff Highlighting
|
||||||
call <SID>X("diffAdded", "", s:green, "none")
|
|
||||||
call <SID>X("diffRemoved", "", s:red, "none")
|
|
||||||
call <SID>X("diffChanged", "", s:yellow, "none")
|
|
||||||
call <SID>X("DiffAdd", s:window, s:green, "none")
|
call <SID>X("DiffAdd", s:window, s:green, "none")
|
||||||
call <SID>X("DiffDelete", s:window, s:red, "none")
|
call <SID>X("DiffDelete", s:window, s:red, "none")
|
||||||
call <SID>X("DiffChange", s:window, s:yellow, "none")
|
call <SID>X("DiffChange", s:window, s:yellow, "none")
|
||||||
@@ -432,9 +432,6 @@ if has("gui_running") || &t_Co == 88 || &t_Co == 256
|
|||||||
call <SID>X("bladeKeyword", s:blue, "", "")
|
call <SID>X("bladeKeyword", s:blue, "", "")
|
||||||
|
|
||||||
" Diff Highlighting
|
" Diff Highlighting
|
||||||
call <SID>X("diffAdded", "", s:green, "none")
|
|
||||||
call <SID>X("diffRemoved", "", s:red, "none")
|
|
||||||
call <SID>X("diffChanged", "", s:yellow, "none")
|
|
||||||
call <SID>X("DiffAdd", s:window, s:green, "none")
|
call <SID>X("DiffAdd", s:window, s:green, "none")
|
||||||
call <SID>X("DiffDelete", s:window, s:red, "none")
|
call <SID>X("DiffDelete", s:window, s:red, "none")
|
||||||
call <SID>X("DiffChange", s:window, s:yellow, "none")
|
call <SID>X("DiffChange", s:window, s:yellow, "none")
|
||||||
@@ -45,9 +45,9 @@ if has("gui_running") || &t_Co == 256
|
|||||||
hi PmenuSel cterm=bold,reverse ctermfg=250 ctermbg=black gui=reverse guifg=#bcbcbc guibg=#0a0a0a
|
hi PmenuSel cterm=bold,reverse ctermfg=250 ctermbg=black gui=reverse guifg=#bcbcbc guibg=#0a0a0a
|
||||||
hi SpecialKey cterm=NONE ctermfg=16 ctermbg=255 gui=NONE guifg=#eeeeee guibg=#0a0a0a
|
hi SpecialKey cterm=NONE ctermfg=16 ctermbg=255 gui=NONE guifg=#eeeeee guibg=#0a0a0a
|
||||||
hi MatchParen cterm=bold ctermfg=white ctermbg=black gui=NONE guifg=#bcbcbc guibg=#454545
|
hi MatchParen cterm=bold ctermfg=white ctermbg=black gui=NONE guifg=#bcbcbc guibg=#454545
|
||||||
hi CursorLine cterm=NONE ctermfg=NONE ctermbg=233 gui=NONE guifg=NONE guibg=#222222
|
hi CursorLine cterm=NONE ctermfg=NONE ctermbg=233 gui=NONE guifg=NONE guibg=#111111
|
||||||
hi CursorColumn cterm=NONE ctermfg=NONE ctermbg=233 gui=NONE guifg=NONE guibg=#222222
|
hi CursorColumn cterm=NONE ctermfg=NONE ctermbg=233 gui=NONE guifg=NONE guibg=#111111
|
||||||
hi ColorColumn cterm=NONE ctermfg=NONE ctermbg=255 gui=NONE guifg=NONE guibg=#222222 " The column line set by colorcolumn
|
hi ColorColumn cterm=NONE ctermfg=NONE ctermbg=255 gui=NONE guifg=NONE guibg=#171717 " The column line set by colorcolumn
|
||||||
hi StatusLine cterm=bold,reverse ctermfg=245 ctermbg=black gui=bold,reverse guifg=#8a8a8a guibg=#0a0a0a
|
hi StatusLine cterm=bold,reverse ctermfg=245 ctermbg=black gui=bold,reverse guifg=#8a8a8a guibg=#0a0a0a
|
||||||
hi StatusLineNC cterm=reverse ctermfg=236 ctermbg=black gui=reverse guifg=#303030 guibg=#0a0a0a
|
hi StatusLineNC cterm=reverse ctermfg=236 ctermbg=black gui=reverse guifg=#303030 guibg=#0a0a0a
|
||||||
hi Visual cterm=reverse ctermfg=250 ctermbg=black gui=reverse guifg=#bcbcbc guibg=#0a0a0a
|
hi Visual cterm=reverse ctermfg=250 ctermbg=black gui=reverse guifg=#bcbcbc guibg=#0a0a0a
|
||||||
@@ -81,8 +81,6 @@ highlight! link Todo Keyword
|
|||||||
highlight! link Label Keyword
|
highlight! link Label Keyword
|
||||||
highlight! link Define Keyword
|
highlight! link Define Keyword
|
||||||
highlight! link DiffAdd Keyword
|
highlight! link DiffAdd Keyword
|
||||||
highlight! link diffAdded Keyword
|
|
||||||
highlight! link diffCommon Keyword
|
|
||||||
highlight! link Directory Keyword
|
highlight! link Directory Keyword
|
||||||
highlight! link PreCondit Keyword
|
highlight! link PreCondit Keyword
|
||||||
highlight! link PreProc Keyword
|
highlight! link PreProc Keyword
|
||||||
@@ -101,11 +99,9 @@ highlight! link iCursor SpecialKey
|
|||||||
highlight! link SpellLocal SpellCap
|
highlight! link SpellLocal SpellCap
|
||||||
highlight! link NonText NonText
|
highlight! link NonText NonText
|
||||||
highlight! link DiffDelete Comment
|
highlight! link DiffDelete Comment
|
||||||
highlight! link diffRemoved Comment
|
|
||||||
highlight! link PmenuSbar Visual
|
highlight! link PmenuSbar Visual
|
||||||
highlight! link VisualNOS Visual
|
highlight! link VisualNOS Visual
|
||||||
highlight! link VertSplit VertSplit
|
highlight! link VertSplit VertSplit
|
||||||
highlight! link Cursor StatusLine
|
highlight! link Cursor StatusLine
|
||||||
highlight! link Underlined SpellRare
|
highlight! link Underlined SpellRare
|
||||||
highlight! link rstEmphasis SpellRare
|
highlight! link rstEmphasis SpellRare
|
||||||
highlight! link diffChanged DiffChange
|
|
||||||
@@ -79,8 +79,6 @@ highlight! link Todo Keyword
|
|||||||
highlight! link Label Keyword
|
highlight! link Label Keyword
|
||||||
highlight! link Define Keyword
|
highlight! link Define Keyword
|
||||||
highlight! link DiffAdd Keyword
|
highlight! link DiffAdd Keyword
|
||||||
highlight! link diffAdded Keyword
|
|
||||||
highlight! link diffCommon Keyword
|
|
||||||
highlight! link Directory Keyword
|
highlight! link Directory Keyword
|
||||||
highlight! link PreCondit Keyword
|
highlight! link PreCondit Keyword
|
||||||
highlight! link PreProc Keyword
|
highlight! link PreProc Keyword
|
||||||
@@ -100,10 +98,8 @@ highlight! link SpellLocal SpellCap
|
|||||||
highlight! link LineNr Comment
|
highlight! link LineNr Comment
|
||||||
highlight! link NonText NonText
|
highlight! link NonText NonText
|
||||||
highlight! link DiffDelete Comment
|
highlight! link DiffDelete Comment
|
||||||
highlight! link diffRemoved Comment
|
|
||||||
highlight! link VisualNOS Visual
|
highlight! link VisualNOS Visual
|
||||||
highlight! link VertSplit VertSplit
|
highlight! link VertSplit VertSplit
|
||||||
highlight! link Cursor StatusLine
|
highlight! link Cursor StatusLine
|
||||||
highlight! link Underlined SpellRare
|
highlight! link Underlined SpellRare
|
||||||
highlight! link rstEmphasis SpellRare
|
highlight! link rstEmphasis SpellRare
|
||||||
highlight! link diffChanged DiffChange
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
" A simple light colorscheme.
|
" A simple light colorscheme.
|
||||||
" Maintainer: Michael Campagnaro <mikecampo@gmail.com>
|
" Maintainer: Michael Campagnaro
|
||||||
" Version: 1.0
|
" Version: 1.0
|
||||||
"
|
"
|
||||||
" Adapted from https://github.com/tek256/simple-dark
|
" Adapted from https://github.com/tek256/simple-dark
|
||||||
@@ -81,8 +81,6 @@ highlight! link Todo Keyword
|
|||||||
highlight! link Label Keyword
|
highlight! link Label Keyword
|
||||||
highlight! link Define Keyword
|
highlight! link Define Keyword
|
||||||
highlight! link DiffAdd Keyword
|
highlight! link DiffAdd Keyword
|
||||||
highlight! link diffAdded Keyword
|
|
||||||
highlight! link diffCommon Keyword
|
|
||||||
highlight! link Directory Keyword
|
highlight! link Directory Keyword
|
||||||
highlight! link PreCondit Keyword
|
highlight! link PreCondit Keyword
|
||||||
highlight! link PreProc Keyword
|
highlight! link PreProc Keyword
|
||||||
@@ -102,10 +100,8 @@ highlight! link SpellLocal SpellCap
|
|||||||
highlight! link LineNr Comment
|
highlight! link LineNr Comment
|
||||||
highlight! link NonText NonText
|
highlight! link NonText NonText
|
||||||
highlight! link DiffDelete Comment
|
highlight! link DiffDelete Comment
|
||||||
highlight! link diffRemoved Comment
|
|
||||||
highlight! link VisualNOS Visual
|
highlight! link VisualNOS Visual
|
||||||
highlight! link VertSplit VertSplit
|
highlight! link VertSplit VertSplit
|
||||||
highlight! link Cursor StatusLine
|
highlight! link Cursor StatusLine
|
||||||
highlight! link Underlined SpellRare
|
highlight! link Underlined SpellRare
|
||||||
highlight! link rstEmphasis SpellRare
|
highlight! link rstEmphasis SpellRare
|
||||||
highlight! link diffChanged DiffChange
|
|
||||||
@@ -377,9 +377,6 @@ if has("gui_running") || &t_Co == 88 || &t_Co == 256
|
|||||||
call <SID>X("htmlScriptTag", s:blue, "", "")
|
call <SID>X("htmlScriptTag", s:blue, "", "")
|
||||||
|
|
||||||
" Diff Highlighting
|
" Diff Highlighting
|
||||||
call <SID>X("diffAdded", "", s:green, "none")
|
|
||||||
call <SID>X("diffRemoved", "", s:red, "none")
|
|
||||||
call <SID>X("diffChanged", "", s:yellow, "none")
|
|
||||||
call <SID>X("DiffAdd", s:window, s:green, "none")
|
call <SID>X("DiffAdd", s:window, s:green, "none")
|
||||||
call <SID>X("DiffDelete", s:window, s:red, "none")
|
call <SID>X("DiffDelete", s:window, s:red, "none")
|
||||||
call <SID>X("DiffChange", s:window, s:yellow, "none")
|
call <SID>X("DiffChange", s:window, s:yellow, "none")
|
||||||
209
.vim/colors/utils
Normal file
209
.vim/colors/utils
Normal file
@@ -0,0 +1,209 @@
|
|||||||
|
" Hex color conversion functions are from https://github.com/vim-scripts/desert256.vim/blob/master/colors/desert256.vim
|
||||||
|
|
||||||
|
" Returns an approximate grey index for the given grey level
|
||||||
|
function! GreyNumber(x)
|
||||||
|
if &t_Co == 88
|
||||||
|
if a:x < 23
|
||||||
|
return 0
|
||||||
|
elseif a:x < 69
|
||||||
|
return 1
|
||||||
|
elseif a:x < 103
|
||||||
|
return 2
|
||||||
|
elseif a:x < 127
|
||||||
|
return 3
|
||||||
|
elseif a:x < 150
|
||||||
|
return 4
|
||||||
|
elseif a:x < 173
|
||||||
|
return 5
|
||||||
|
elseif a:x < 196
|
||||||
|
return 6
|
||||||
|
elseif a:x < 219
|
||||||
|
return 7
|
||||||
|
elseif a:x < 243
|
||||||
|
return 8
|
||||||
|
else
|
||||||
|
return 9
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
if a:x < 14
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
let l:n = (a:x - 8) / 10
|
||||||
|
let l:m = (a:x - 8) % 10
|
||||||
|
if l:m < 5
|
||||||
|
return l:n
|
||||||
|
else
|
||||||
|
return l:n + 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" Returns the actual grey level represented by the grey index
|
||||||
|
function! GreyLevel(n)
|
||||||
|
if &t_Co == 88
|
||||||
|
if a:n == 0
|
||||||
|
return 0
|
||||||
|
elseif a:n == 1
|
||||||
|
return 46
|
||||||
|
elseif a:n == 2
|
||||||
|
return 92
|
||||||
|
elseif a:n == 3
|
||||||
|
return 115
|
||||||
|
elseif a:n == 4
|
||||||
|
return 139
|
||||||
|
elseif a:n == 5
|
||||||
|
return 162
|
||||||
|
elseif a:n == 6
|
||||||
|
return 185
|
||||||
|
elseif a:n == 7
|
||||||
|
return 208
|
||||||
|
elseif a:n == 8
|
||||||
|
return 231
|
||||||
|
else
|
||||||
|
return 255
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
if a:n == 0
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 8 + (a:n * 10)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" Returns the palette index for the given grey index
|
||||||
|
function! GreyColor(n)
|
||||||
|
if &t_Co == 88
|
||||||
|
if a:n == 0
|
||||||
|
return 16
|
||||||
|
elseif a:n == 9
|
||||||
|
return 79
|
||||||
|
else
|
||||||
|
return 79 + a:n
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
if a:n == 0
|
||||||
|
return 16
|
||||||
|
elseif a:n == 25
|
||||||
|
return 231
|
||||||
|
else
|
||||||
|
return 231 + a:n
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" Returns an approximate colour index for the given colour level
|
||||||
|
function! RGBNumber(x)
|
||||||
|
if &t_Co == 88
|
||||||
|
if a:x < 69
|
||||||
|
return 0
|
||||||
|
elseif a:x < 172
|
||||||
|
return 1
|
||||||
|
elseif a:x < 230
|
||||||
|
return 2
|
||||||
|
else
|
||||||
|
return 3
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
if a:x < 75
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
let l:n = (a:x - 55) / 40
|
||||||
|
let l:m = (a:x - 55) % 40
|
||||||
|
if l:m < 20
|
||||||
|
return l:n
|
||||||
|
else
|
||||||
|
return l:n + 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" Returns the actual colour level for the given colour index
|
||||||
|
function! RGBLevel(n)
|
||||||
|
if &t_Co == 88
|
||||||
|
if a:n == 0
|
||||||
|
return 0
|
||||||
|
elseif a:n == 1
|
||||||
|
return 139
|
||||||
|
elseif a:n == 2
|
||||||
|
return 205
|
||||||
|
else
|
||||||
|
return 255
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
if a:n == 0
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 55 + (a:n * 40)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" Returns the palette index for the given R/G/B colour indices
|
||||||
|
function! RGBColor(x, y, z)
|
||||||
|
if &t_Co == 88
|
||||||
|
return 16 + (a:x * 16) + (a:y * 4) + a:z
|
||||||
|
else
|
||||||
|
return 16 + (a:x * 36) + (a:y * 6) + a:z
|
||||||
|
endif
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" Returns the palette index to approximate the given R/G/B colour levels
|
||||||
|
function! Color(r, g, b)
|
||||||
|
" Get the closest grey
|
||||||
|
let l:gx = GreyNumber(a:r)
|
||||||
|
let l:gy = GreyNumber(a:g)
|
||||||
|
let l:gz = GreyNumber(a:b)
|
||||||
|
|
||||||
|
" Get the closest colour
|
||||||
|
let l:x = RGBNumber(a:r)
|
||||||
|
let l:y = RGBNumber(a:g)
|
||||||
|
let l:z = RGBNumber(a:b)
|
||||||
|
|
||||||
|
if l:gx == l:gy && l:gy == l:gz
|
||||||
|
" There are two possibilities
|
||||||
|
let l:dgr = GreyLevel(l:gx) - a:r
|
||||||
|
let l:dgg = GreyLevel(l:gy) - a:g
|
||||||
|
let l:dgb = GreyLevel(l:gz) - a:b
|
||||||
|
let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb)
|
||||||
|
let l:dr = RGBLevel(l:gx) - a:r
|
||||||
|
let l:dg = RGBLevel(l:gy) - a:g
|
||||||
|
let l:db = RGBLevel(l:gz) - a:b
|
||||||
|
let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db)
|
||||||
|
if l:dgrey < l:drgb
|
||||||
|
" Use the grey
|
||||||
|
return GreyColor(l:gx)
|
||||||
|
else
|
||||||
|
" Use the colour
|
||||||
|
return RGBColor(l:x, l:y, l:z)
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
" Only one possibility
|
||||||
|
return RGBColor(l:x, l:y, l:z)
|
||||||
|
endif
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" Returns the palette index to approximate the 'rrggbb' hex string
|
||||||
|
function! RGB(rgb)
|
||||||
|
let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0
|
||||||
|
let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0
|
||||||
|
let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0
|
||||||
|
|
||||||
|
return Color(l:r, l:g, l:b)
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" Sets the highlighting for the given group
|
||||||
|
function! X(group, fg, bg, attr)
|
||||||
|
if a:fg != ""
|
||||||
|
exec "hi " . a:group . " guifg=#" . a:fg . " ctermfg=" . RGB(a:fg)
|
||||||
|
endif
|
||||||
|
if a:bg != ""
|
||||||
|
exec "hi " . a:group . " guibg=#" . a:bg . " ctermbg=" . RGB(a:bg)
|
||||||
|
endif
|
||||||
|
if a:attr != ""
|
||||||
|
exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr
|
||||||
|
endif
|
||||||
|
endfun
|
||||||
|
|
||||||
0
vim/scripts/scmindent.rkt → .vim/scripts/scmindent.rkt
Executable file → Normal file
0
vim/scripts/scmindent.rkt → .vim/scripts/scmindent.rkt
Executable file → Normal file
@@ -266,3 +266,12 @@ throughs
|
|||||||
throughs
|
throughs
|
||||||
incentivise
|
incentivise
|
||||||
malware
|
malware
|
||||||
|
foofy
|
||||||
|
memcpy
|
||||||
|
strlen
|
||||||
|
u8
|
||||||
|
s64
|
||||||
|
Sculpey
|
||||||
|
grey
|
||||||
|
googly
|
||||||
|
favour
|
||||||
BIN
.vim/spell/en.utf-8.add.spl
Normal file
BIN
.vim/spell/en.utf-8.add.spl
Normal file
Binary file not shown.
11
README.md
11
README.md
@@ -1,11 +0,0 @@
|
|||||||
# dotfiles
|
|
||||||
|
|
||||||
Various dotfiles and misc configs. Some of it is customized around my system setup
|
|
||||||
(like aliases pointing to paths) but you should be able to easily remove that stuff.
|
|
||||||
|
|
||||||
## Installing
|
|
||||||
|
|
||||||
There is an `install` script that facilitates the setup, however it's been a while since I did a
|
|
||||||
full system setup and this script may not be fully complete. An alternative method is to manually
|
|
||||||
symlink files in the root directory. OS specific configs are in their respective folders.
|
|
||||||
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
if which tput >/dev/null 2>&1; then
|
|
||||||
ncolors=$(tput colors)
|
|
||||||
fi
|
|
||||||
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
|
|
||||||
RED="$(tput setaf 1)"
|
|
||||||
GREEN="$(tput setaf 2)"
|
|
||||||
YELLOW="$(tput setaf 3)"
|
|
||||||
BLUE="$(tput setaf 4)"
|
|
||||||
MAGENTA="$(tput setaf 5)"
|
|
||||||
CYAN="$(tput setaf 6)"
|
|
||||||
BOLD="$(tput bold)"
|
|
||||||
NORMAL="$(tput sgr0)"
|
|
||||||
else
|
|
||||||
RED=""
|
|
||||||
GREEN=""
|
|
||||||
YELLOW=""
|
|
||||||
BLUE=""
|
|
||||||
MAGENTA=""
|
|
||||||
CYAN=""
|
|
||||||
BOLD=""
|
|
||||||
NORMAL=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
use_gpu=$1
|
|
||||||
filename=$(basename -- "$2")
|
|
||||||
output_name="$3"
|
|
||||||
start_time="$4"
|
|
||||||
end_time="$5"
|
|
||||||
|
|
||||||
if [[ $use_gpu == "" || $2 == "" || $output_name == "" || $start_time == "" || $end_time == "" ]]; then
|
|
||||||
printf "${BOLD}${RED}Usage: $0 <use-gpu (1|0)> <filename> <output name> <start time HH:MM:SS> <end time HH:MM:SS>${NORMAL}\n"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Found the following to work best with vids containing text (e.g. programming vid): 25 for CPU encoding and 27 for GPU.
|
|
||||||
use_crf=25
|
|
||||||
if [[ $use_gpu -eq 1 ]]; then
|
|
||||||
use_crf=27
|
|
||||||
fi
|
|
||||||
|
|
||||||
compress-video-with-crf $use_gpu $use_crf "$filename" "$output_name" "$start_time" "$end_time"
|
|
||||||
|
|
||||||
16
bin/vim-pull
16
bin/vim-pull
@@ -1,16 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Copies vim data from the home directory to the dotfiles repo.
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
src="$HOME/.vim"
|
|
||||||
dest="$HOME/.dotfiles/vim/"
|
|
||||||
|
|
||||||
if [ -d $src ]; then
|
|
||||||
[ -d "$src/spell" ] && echo "Syncing user dictionary" && cp -r "$src/spell" $dest
|
|
||||||
[ -d "$src/colors" ] && echo "Syncing user colors" && cp -r "$src/colors" $dest
|
|
||||||
[ -d "$src/after" ] && echo "Syncing after directory" && cp -r "$src/after" $dest
|
|
||||||
[ -d "$src/ftdetect" ] && echo "Syncing ftdetect" && cp -r "$src/ftdetect" $dest
|
|
||||||
[ -d "$src/autoload" ] && echo "Syncing autoload" && cp -r "$src/autoload" $dest
|
|
||||||
fi
|
|
||||||
16
bin/vim-push
16
bin/vim-push
@@ -1,16 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Copies vim data from the dotfiles repo to the home directory.
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
src="$HOME/.dotfiles/vim"
|
|
||||||
dest="$HOME/.vim/"
|
|
||||||
|
|
||||||
if [ -d $src ]; then
|
|
||||||
[ -d "$src/spell" ] && echo "Syncing user dictionary" && cp -r "$src/spell" $dest
|
|
||||||
[ -d "$src/colors" ] && echo "Syncing user colors" && cp -r "$src/colors" $dest
|
|
||||||
[ -d "$src/after" ] && echo "Syncing after directory" && cp -r "$src/after" $dest
|
|
||||||
[ -d "$src/ftdetect" ] && echo "Syncing ftdetect" && cp -r "$src/ftdetect" $dest
|
|
||||||
[ -d "$src/autoload" ] && echo "Syncing autoload" && cp -r "$src/autoload" $dest
|
|
||||||
fi
|
|
||||||
21
dotfiles/.editorconfig
Normal file
21
dotfiles/.editorconfig
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# EditorConfig helps developers define and maintain consistent
|
||||||
|
# coding styles # between different editors and IDEs
|
||||||
|
# editorconfig.org
|
||||||
|
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.bat]
|
||||||
|
end_of_line = crlf
|
||||||
|
|
||||||
|
[*.tsv]
|
||||||
|
indent_style = tab
|
||||||
|
|
||||||
32
dotfiles/README.md
Normal file
32
dotfiles/README.md
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# dotfiles
|
||||||
|
|
||||||
|
Various dotfiles and misc configs. Some of it is customized around my system
|
||||||
|
setup (like aliases pointing to paths) but you should be able to easily remove
|
||||||
|
that stuff.
|
||||||
|
|
||||||
|
This unpacks files one directory back, which is assumed to be your home
|
||||||
|
directory. The gitignore ignores all files by default. If you want to add a new
|
||||||
|
file this you need to add the `-f` flag to the git add command. This setup was
|
||||||
|
inspired by Gary Bernhardt and https://gist.github.com/meleu/053275b6842646b95491bf1af4a6ca0e
|
||||||
|
|
||||||
|
## Installing
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Go to your home directory.
|
||||||
|
cd ~
|
||||||
|
|
||||||
|
# Clone the repo with the "--no-checkout" option (so we can checkout the files in our home directory)
|
||||||
|
git clone --no-checkout <repo_url>/dotfiles.git
|
||||||
|
|
||||||
|
# Go to the created directory and change the worktree to the home direcory.
|
||||||
|
cd dotfiles
|
||||||
|
git config core.worktree '../../'
|
||||||
|
|
||||||
|
# Checkout the files. This will overwrite existing dotfiles with the same name.
|
||||||
|
git reset --hard origin/master
|
||||||
|
```
|
||||||
|
|
||||||
|
If you want to install optional OS specific stuff, like various packages, run the `install` script in this folder.
|
||||||
|
|
||||||
|
OS specific configs are in their respective folders.
|
||||||
|
|
||||||
@@ -23,20 +23,25 @@ else
|
|||||||
NORMAL=""
|
NORMAL=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
use_gpu=$1
|
use_gpu=0
|
||||||
filename=$(basename -- "$2")
|
|
||||||
output_name="$3"
|
|
||||||
|
|
||||||
if [[ $use_gpu == "" || $2 == "" || $output_name == "" ]]; then
|
if [[ $# < 2 || $# > 3 ]]; then
|
||||||
printf "${BOLD}${RED}Usage: $0 <use-gpu (1|0)> <filename> <output name>${NORMAL}\n"
|
printf "${BOLD}${RED}Usage: $0 <filename> <output name> <optional: use-gpu (1|0), defaults to $use_gpu> ${NORMAL}\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
filename=$(basename -- "$1")
|
||||||
|
output_name="$2"
|
||||||
|
|
||||||
|
if [[ $# > 2 ]]; then
|
||||||
|
use_gpu=$3
|
||||||
|
fi
|
||||||
|
|
||||||
# Found the following to work best with vids containing text (e.g. programming vid): 25 for CPU encoding and 27 for GPU.
|
# Found the following to work best with vids containing text (e.g. programming vid): 25 for CPU encoding and 27 for GPU.
|
||||||
use_crf=21
|
use_crf=21
|
||||||
if [[ $use_gpu -eq 1 ]]; then
|
if [[ $use_gpu -eq 1 ]]; then
|
||||||
use_crf=25
|
use_crf=25
|
||||||
fi
|
fi
|
||||||
|
|
||||||
compress-video-with-crf $use_gpu $use_crf "$filename" "$output_name"
|
compress-video-with-crf $use_crf "$filename" "$output_name" $use_gpu
|
||||||
|
|
||||||
@@ -23,22 +23,36 @@ else
|
|||||||
NORMAL=""
|
NORMAL=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
use_gpu=$1
|
use_gpu=0
|
||||||
use_crf=$2
|
|
||||||
output_name="$4"
|
|
||||||
start_time="$5"
|
|
||||||
end_time="$6"
|
|
||||||
|
|
||||||
if [[ $use_gpu == "" || $use_crf == "" || $3 == "" || $output_name == "" || ($start_time != "" && $end_time == "") ]]; then
|
if [[ "$#" < 3 || "$#" > 6 ]]; then
|
||||||
printf "${BOLD}${RED}Usage: $0 <use-gpu (1|0)> <crf value> <filename> <output name> <optional start time HH:MM:SS> <optional end time HH:MM:SS>\n\nIf you want to encode a range of CRF values then use -1 as the crf value.${NORMAL}\n"
|
printf "${BOLD}${RED}Usage: $0 <crf value> <filename> <output name> <optional: use-gpu (1|0), defaults to $use_gpu> <optional: start time HH:MM:SS> <optional: end time HH:MM:SS>\n\nIf you want to encode a range of CRF values then use -1 as the crf value.${NORMAL}\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
use_crf=$1
|
||||||
|
|
||||||
filename=$(basename -- "$3")
|
filename=$(basename -- "$2")
|
||||||
extension="${filename##*.}"
|
extension="${filename##*.}"
|
||||||
filename="${filename%.*}"
|
filename="${filename%.*}"
|
||||||
|
|
||||||
|
output_name="$3"
|
||||||
|
|
||||||
|
if [[ "$#" > 3 ]]; then
|
||||||
|
use_gpu=$4
|
||||||
|
if [[ "$#" > 4 ]]; then
|
||||||
|
start_time="$5"
|
||||||
|
if [[ "$#" > 5 ]]; then
|
||||||
|
end_time="$6"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $use_gpu -ne 0 && $use_gpu -ne 1 ]]; then
|
||||||
|
printf "${BOLD}${RED}Invalid use_gpu value. Got $use_gpu, but expected either 0 or 1${NORMAL}\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
function encode() {
|
function encode() {
|
||||||
crf=$1
|
crf=$1
|
||||||
output="${output_name}.$extension"
|
output="${output_name}.$extension"
|
||||||
@@ -52,7 +66,12 @@ function encode() {
|
|||||||
|
|
||||||
if [[ $use_gpu -eq 1 ]]; then
|
if [[ $use_gpu -eq 1 ]]; then
|
||||||
# File will be slightly larger than CPU encoding, but it's much faster to transcode and doesn't max out the CPU cores.
|
# File will be slightly larger than CPU encoding, but it's much faster to transcode and doesn't max out the CPU cores.
|
||||||
|
|
||||||
|
# RTX 3080
|
||||||
ffmpeg -y -stats -loglevel level+error $timing_args -vsync 0 -hwaccel cuda -hwaccel_output_format cuda -i "$filename.$extension" -c:a copy -c:v h264_nvenc -profile:v high -rc:v vbr_hq -cq:v $crf -b:v 5M -maxrate 5M -max_muxing_queue_size 9999 "$output"
|
ffmpeg -y -stats -loglevel level+error $timing_args -vsync 0 -hwaccel cuda -hwaccel_output_format cuda -i "$filename.$extension" -c:a copy -c:v h264_nvenc -profile:v high -rc:v vbr_hq -cq:v $crf -b:v 5M -maxrate 5M -max_muxing_queue_size 9999 "$output"
|
||||||
|
|
||||||
|
# GTX 1070
|
||||||
|
#ffmpeg -y -stats -loglevel level+error $timing_args -vsync 0 -hwaccel cuvid -c:v h264_cuvid -i "$filename.$extension" -c:a copy -c:v h264_nvenc -profile:v high -rc:v vbr_hq -cq:v $crf -b:v 5M -maxrate 5M -max_muxing_queue_size 9999 "$output"
|
||||||
else
|
else
|
||||||
ffmpeg -y -stats -loglevel level+error $timing_args -i "$filename.$extension" -c:v libx264 -crf $crf -preset veryfast -profile:v high -level 3.0 -strict -2 "$output"
|
ffmpeg -y -stats -loglevel level+error $timing_args -i "$filename.$extension" -c:v libx264 -crf $crf -preset veryfast -profile:v high -level 3.0 -strict -2 "$output"
|
||||||
fi
|
fi
|
||||||
@@ -29,7 +29,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $1 == "" || $2 == "" ]]; then
|
if [[ $1 == "" || $2 == "" ]]; then
|
||||||
printf "${BOLD}${RED}Format: $0 <filename> <bitrate, e.g. \"4000k\"> <optional output name>${NORMAL}\n"
|
printf "${BOLD}${RED}Usage: $0 <filename> <bitrate, e.g. \"4000k\"> <optional output name>${NORMAL}\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $1 == "" || $2 == "" ]]; then
|
if [[ $1 == "" || $2 == "" ]]; then
|
||||||
printf "${BOLD}${RED}Format: $0 <compress 1|0> <filename> <optional output name>${NORMAL}\n"
|
printf "${BOLD}${RED}Usage: $0 <compress 1|0> <filename> <optional output name>${NORMAL}\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
64
dotfiles/bin/convert-video-mkv-to-mp4
Normal file
64
dotfiles/bin/convert-video-mkv-to-mp4
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# This is for reencoding an mkv video to mp4 using an mpeg4 encoder.
|
||||||
|
# Can optionally compress the video.
|
||||||
|
|
||||||
|
if which tput >/dev/null 2>&1; then
|
||||||
|
ncolors=$(tput colors)
|
||||||
|
fi
|
||||||
|
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
|
||||||
|
RED="$(tput setaf 1)"
|
||||||
|
GREEN="$(tput setaf 2)"
|
||||||
|
YELLOW="$(tput setaf 3)"
|
||||||
|
BLUE="$(tput setaf 4)"
|
||||||
|
MAGENTA="$(tput setaf 5)"
|
||||||
|
CYAN="$(tput setaf 6)"
|
||||||
|
BOLD="$(tput bold)"
|
||||||
|
NORMAL="$(tput sgr0)"
|
||||||
|
else
|
||||||
|
RED=""
|
||||||
|
GREEN=""
|
||||||
|
YELLOW=""
|
||||||
|
BLUE=""
|
||||||
|
MAGENTA=""
|
||||||
|
CYAN=""
|
||||||
|
BOLD=""
|
||||||
|
NORMAL=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $1 == "" || $2 == "" ]]; then
|
||||||
|
printf "${BOLD}${RED}Usage: $0 <compress 1|0> <filename> <optional output name>${NORMAL}\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
compress="$1"
|
||||||
|
|
||||||
|
filename=$(basename -- "$2")
|
||||||
|
extension="${filename##*.}"
|
||||||
|
filename="${filename%.*}"
|
||||||
|
|
||||||
|
output="$3"
|
||||||
|
if [[ $output == "" ]]; then
|
||||||
|
output="${filename}_CONVERTED"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "\n${YELLOW}${BOLD}Encoding '$filename.$extension' | compress: $compress | output: $output.mp4${NORMAL}\n"
|
||||||
|
|
||||||
|
if [[ $compress -eq 1 ]]; then
|
||||||
|
temp_output="temp_$output.mp4"
|
||||||
|
else
|
||||||
|
temp_output="$output.mp4"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# convert first.
|
||||||
|
# we convert then compress instead of compressing on first pass because this results in a slightly higher bitrate.
|
||||||
|
ffmpeg -y -stats -loglevel level+error -i "$filename.$extension" -vcodec copy -acodec copy "$temp_output"
|
||||||
|
|
||||||
|
if [[ $compress -eq 1 ]]; then
|
||||||
|
compress-video 1 "$temp_output" "$output"
|
||||||
|
rm "$temp_output"
|
||||||
|
else
|
||||||
|
printf "\n"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "${GREEN}${BOLD}Done encoding '$filename.$extension' to '$output.mp4'${NORMAL}\n\n"
|
||||||
50
dotfiles/bin/extract-16bit-wav-from-video
Normal file
50
dotfiles/bin/extract-16bit-wav-from-video
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if which tput >/dev/null 2>&1; then
|
||||||
|
ncolors=$(tput colors)
|
||||||
|
fi
|
||||||
|
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
|
||||||
|
RED="$(tput setaf 1)"
|
||||||
|
GREEN="$(tput setaf 2)"
|
||||||
|
YELLOW="$(tput setaf 3)"
|
||||||
|
BLUE="$(tput setaf 4)"
|
||||||
|
MAGENTA="$(tput setaf 5)"
|
||||||
|
CYAN="$(tput setaf 6)"
|
||||||
|
BOLD="$(tput bold)"
|
||||||
|
NORMAL="$(tput sgr0)"
|
||||||
|
else
|
||||||
|
RED=""
|
||||||
|
GREEN=""
|
||||||
|
YELLOW=""
|
||||||
|
BLUE=""
|
||||||
|
MAGENTA=""
|
||||||
|
CYAN=""
|
||||||
|
BOLD=""
|
||||||
|
NORMAL=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
input="$1"
|
||||||
|
output_name="$2"
|
||||||
|
|
||||||
|
if [[ $input == "" || $output_name == "" ]]; then
|
||||||
|
printf "${BOLD}${RED}Usage: $0 <input video> <wav output name>${NORMAL}\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -f "$input" ]]; then
|
||||||
|
printf "${RED}${BOLD}Error: failed to extract audio. Video file \"$input\" doesn't exist.\n${NORMAL}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Add extension if not provided.
|
||||||
|
output_basename=$(basename -- "$output_name")
|
||||||
|
output_extension="${output_basename##*.}"
|
||||||
|
if [[ $output_extension != "wav" ]]; then
|
||||||
|
output_name="${output_name}.wav"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "\n${YELLOW}${BOLD}Extracting 16-bit WAV from $input | output: $output_name${NORMAL}\n"
|
||||||
|
|
||||||
|
ffmpeg -i "$input" -ar 16000 -ac 1 -c:a pcm_s16le "$output_name"
|
||||||
|
|
||||||
|
printf "${GREEN}${BOLD}Done extracting 16-bit WAV from $input | output: $output_name${NORMAL}\n"
|
||||||
@@ -41,7 +41,7 @@ if [[ $bitrate == "" ]]; then
|
|||||||
bitrate="64"
|
bitrate="64"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "\n${YELLOW}${BOLD}Extracting audio from '$filename.$extension' | bitrate: ${bitrate}k | output: $output_name${NORMAL}\n"
|
printf "\n${YELLOW}${BOLD}Extracting audio from $filename.$extension | bitrate: ${bitrate}k | output: $output_name${NORMAL}\n"
|
||||||
|
|
||||||
if [[ $transcode == "1" ]]; then
|
if [[ $transcode == "1" ]]; then
|
||||||
# Transcode audio
|
# Transcode audio
|
||||||
@@ -51,5 +51,5 @@ else
|
|||||||
ffmpeg -i "$filename.$extension" -vn -acodec copy "$output_name"
|
ffmpeg -i "$filename.$extension" -vn -acodec copy "$output_name"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "\n${GREEN}${BOLD}Done extracting audio from '$filename.$extension' | output name '$output_name'${NORMAL}\n\n"
|
printf "\n${GREEN}${BOLD}Done extracting audio from $filename.$extension | output name '$output_name'${NORMAL}\n\n"
|
||||||
|
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
cd %DEV_TOOLS%\SysinternalsSuite
|
|
||||||
start %DEV_TOOLS%\ResourceHacker.exe "%~1"
|
start %DEV_TOOLS%\ResourceHacker.exe "%~1"
|
||||||
3
dotfiles/bin/file-x32dbg.bat
Normal file
3
dotfiles/bin/file-x32dbg.bat
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
start %DEV_TOOLS%\x64dbg\release\x32\x32dbg.exe "%~1"
|
||||||
3
dotfiles/bin/file-x64dbg.bat
Normal file
3
dotfiles/bin/file-x64dbg.bat
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
start %DEV_TOOLS%\x64dbg\release\x64\x64dbg.exe "%~1"
|
||||||
@@ -27,7 +27,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $1 == "" ]]; then
|
if [[ $1 == "" ]]; then
|
||||||
printf "\n${BOLD}Usage: $0 <filename> <optional output name>${NORMAL}\n"
|
printf "${BOLD}${RED}Usage: $0 <filename> <optional output name>${NORMAL}\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $1 == "" ]]; then
|
if [[ $1 == "" ]]; then
|
||||||
printf "\n${BOLD}Usage: $0 <filename> <optional output name>${NORMAL}\n"
|
printf "${BOLD}${RED}Usage: $0 <filename> <optional output name>${NORMAL}\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
49
dotfiles/bin/remove-audio-from-video
Normal file
49
dotfiles/bin/remove-audio-from-video
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if which tput >/dev/null 2>&1; then
|
||||||
|
ncolors=$(tput colors)
|
||||||
|
fi
|
||||||
|
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
|
||||||
|
RED="$(tput setaf 1)"
|
||||||
|
GREEN="$(tput setaf 2)"
|
||||||
|
YELLOW="$(tput setaf 3)"
|
||||||
|
BLUE="$(tput setaf 4)"
|
||||||
|
MAGENTA="$(tput setaf 5)"
|
||||||
|
CYAN="$(tput setaf 6)"
|
||||||
|
BOLD="$(tput bold)"
|
||||||
|
NORMAL="$(tput sgr0)"
|
||||||
|
else
|
||||||
|
RED=""
|
||||||
|
GREEN=""
|
||||||
|
YELLOW=""
|
||||||
|
BLUE=""
|
||||||
|
MAGENTA=""
|
||||||
|
CYAN=""
|
||||||
|
BOLD=""
|
||||||
|
NORMAL=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $1 == "" ]]; then
|
||||||
|
printf "${BOLD}${RED}Usage: $0 <filename> <optional output name>${NORMAL}\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
filename=$(basename -- "$1")
|
||||||
|
extension="${filename##*.}"
|
||||||
|
filename="${filename%.*}"
|
||||||
|
|
||||||
|
output_name="$2"
|
||||||
|
|
||||||
|
if [[ $output_name == "" ]]; then
|
||||||
|
output="${filename}_no_audio.$extension"
|
||||||
|
else
|
||||||
|
output="${output_name}.$extension"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "\n${YELLOW}${BOLD}Removing audio from '$filename.$extension' | output: '$output'${NORMAL}\n"
|
||||||
|
|
||||||
|
# -an removes the audio.
|
||||||
|
ffmpeg -i "$filename.$extension" -c:v copy -an "$output"
|
||||||
|
|
||||||
|
printf "\n${GREEN}${BOLD}Done removing audio from '$filename.$extension' | output: '$output'${NORMAL}\n\n"
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
source "$HOME/.dotfiles/script_helpers/all.sh"
|
source "$HOME/dotfiles/script_helpers/all.sh"
|
||||||
|
|
||||||
cwd=$PWD
|
cwd=$PWD
|
||||||
source_path=""
|
source_path=""
|
||||||
94
dotfiles/bin/transcribe-audio
Normal file
94
dotfiles/bin/transcribe-audio
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# The base model is pretty good overall. It has good punctuation inserting and catches most words.
|
||||||
|
# Tiny is fast and often has correct grammar, but it misses a lot of words, especially when the
|
||||||
|
# source isn't loud or is muffled.
|
||||||
|
#
|
||||||
|
# Small and medium models can do better word detection at times, but suffer from a lack of punctuation.
|
||||||
|
# Medium is particularly bad and often excludes periods and commas.
|
||||||
|
|
||||||
|
if which tput >/dev/null 2>&1; then
|
||||||
|
ncolors=$(tput colors)
|
||||||
|
fi
|
||||||
|
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
|
||||||
|
RED="$(tput setaf 1)"
|
||||||
|
GREEN="$(tput setaf 2)"
|
||||||
|
YELLOW="$(tput setaf 3)"
|
||||||
|
BLUE="$(tput setaf 4)"
|
||||||
|
MAGENTA="$(tput setaf 5)"
|
||||||
|
CYAN="$(tput setaf 6)"
|
||||||
|
BOLD="$(tput bold)"
|
||||||
|
NORMAL="$(tput sgr0)"
|
||||||
|
else
|
||||||
|
RED=""
|
||||||
|
GREEN=""
|
||||||
|
YELLOW=""
|
||||||
|
BLUE=""
|
||||||
|
MAGENTA=""
|
||||||
|
CYAN=""
|
||||||
|
BOLD=""
|
||||||
|
NORMAL=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Will return a symlink path in its expanded form. If the path's root is the
|
||||||
|
# home directory symbol "~" then it'll be replaced by the full home path.
|
||||||
|
expand_path() {
|
||||||
|
local ret="$1"
|
||||||
|
|
||||||
|
IFS="/" read -ra parts <<< "$ret"
|
||||||
|
if [[ "${parts[0]}" == "~" ]]; then
|
||||||
|
ret="$HOME"
|
||||||
|
for ((i=1; i < ${#parts[@]}; i++))
|
||||||
|
do
|
||||||
|
ret="$ret/${parts[$i]}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
ret=$(readlink -m "$ret")
|
||||||
|
echo $ret
|
||||||
|
}
|
||||||
|
|
||||||
|
input_wav="$1"
|
||||||
|
output_name_without_ext="$2"
|
||||||
|
model="$3"
|
||||||
|
threads=$4
|
||||||
|
|
||||||
|
# 4 seems to be the sweet spot for most models, except medium might be faster with 8.
|
||||||
|
default_thread_count=4
|
||||||
|
|
||||||
|
if [[ $input_wav == "" || $output_name_without_ext == "" || $model == "" ]]; then
|
||||||
|
printf "${BOLD}${RED}Usage: $0 <input.wav> <output name without extension> <model name> <optional: thread count>${NORMAL}\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -f "$input_wav" ]]; then
|
||||||
|
printf "${RED}${BOLD}Input file \"$input_wav\" doesn't exist!\n${NORMAL}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $threads == "" ]]; then
|
||||||
|
threads=$default_thread_count
|
||||||
|
fi
|
||||||
|
|
||||||
|
output_name="$output_name_without_ext.${model}"
|
||||||
|
|
||||||
|
|
||||||
|
# 1 core 31 threads has very fast pcm_to_mel conversion and then just one core doing most of the work. You get more accurate results this way.
|
||||||
|
# 2 core 16 is about half the time but it can have errors where the two pieces come together. This only gets more likely as the core count is increased.
|
||||||
|
# 8 threads, 4 cores is good too for tiny,small and 2 threads, 4 cores for medium.
|
||||||
|
|
||||||
|
threads=31 #keep a thread for me
|
||||||
|
cores=1
|
||||||
|
|
||||||
|
printf "\n${YELLOW}${BOLD}Transcribing $input_wav | model: $model | cores: $cores | threads: $threads | output: $output_name ${NORMAL}\n"
|
||||||
|
|
||||||
|
whisper_fullname="$(expand_path $(which whisper.exe))"
|
||||||
|
whisper_path="$(dirname $whisper_fullname)"
|
||||||
|
models_path="$whisper_path/models"
|
||||||
|
|
||||||
|
whisper.exe --processors ${cores} --threads ${threads} -m "$models_path/ggml-${model}.en.bin" -otxt -osrt -f "$input_wav" -of "$output_name" --print-colors --print-progress
|
||||||
|
error=$?
|
||||||
|
if [[ error -eq 0 ]]; then
|
||||||
|
printf "${GREEN}${BOLD}Done transcribing $input_wav | model: $model | cores: $cores | threads: $threads | output: $output_name${NORMAL}\n"
|
||||||
|
else
|
||||||
|
printf "${GREEN}${BOLD}Error while transcribing $input_wav | model: $model | cores: $cores | threads: $threads | output: $output_name${NORMAL}\n"
|
||||||
|
fi
|
||||||
65
dotfiles/bin/transcribe-video
Normal file
65
dotfiles/bin/transcribe-video
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if which tput >/dev/null 2>&1; then
|
||||||
|
ncolors=$(tput colors)
|
||||||
|
fi
|
||||||
|
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
|
||||||
|
RED="$(tput setaf 1)"
|
||||||
|
GREEN="$(tput setaf 2)"
|
||||||
|
YELLOW="$(tput setaf 3)"
|
||||||
|
BLUE="$(tput setaf 4)"
|
||||||
|
MAGENTA="$(tput setaf 5)"
|
||||||
|
CYAN="$(tput setaf 6)"
|
||||||
|
BOLD="$(tput bold)"
|
||||||
|
NORMAL="$(tput sgr0)"
|
||||||
|
else
|
||||||
|
RED=""
|
||||||
|
GREEN=""
|
||||||
|
YELLOW=""
|
||||||
|
BLUE=""
|
||||||
|
MAGENTA=""
|
||||||
|
CYAN=""
|
||||||
|
BOLD=""
|
||||||
|
NORMAL=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
input_video="$1"
|
||||||
|
output_name_without_ext="$2"
|
||||||
|
shift 2
|
||||||
|
models=("$@")
|
||||||
|
|
||||||
|
if [[ $input_video == "" || $output_name_without_ext == "" || ${#models[@]} -eq 0 ]]; then
|
||||||
|
printf "${BOLD}${RED}Usage: $0 <input.mp4> <output name without extension> <list of model names to use>${NORMAL}\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
model_csv=$(IFS=_ ; echo "${models[*]}")
|
||||||
|
wav_name="${output_name_without_ext}_${model_csv}_${RANDOM}"
|
||||||
|
|
||||||
|
# Add extension if not provided.
|
||||||
|
input_basename=$(basename -- "$wav_name")
|
||||||
|
input_extension="${input_basename##*.}"
|
||||||
|
if [[ input_extension != "wav" ]]; then
|
||||||
|
wav_name="${wav_name}.wav"
|
||||||
|
fi
|
||||||
|
|
||||||
|
extract-16bit-wav-from-video "$input_video" "$wav_name"
|
||||||
|
if [[ $? == 1 ]]; then exit 1; fi
|
||||||
|
|
||||||
|
for model in "$@"; do
|
||||||
|
# Tweak thread count based on model size.
|
||||||
|
thread_count=4
|
||||||
|
if [[ $model == "medium" ]]; then
|
||||||
|
thread_count=8
|
||||||
|
fi
|
||||||
|
|
||||||
|
transcribe-audio "$wav_name" "$output_name_without_ext" "${model}" $thread_count
|
||||||
|
|
||||||
|
if [[ $? == 1 ]]; then
|
||||||
|
printf "${RED}${BOLD}Saving the audio file \"$wav_name\" in case you want to reuse it for debugging.\n${NORMAL}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
rm "$wav_name"
|
||||||
|
|
||||||
2
dotfiles/bin/transcribe-video-base
Normal file
2
dotfiles/bin/transcribe-video-base
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
transcribe-video "$1" "$2" "base"
|
||||||
2
dotfiles/bin/transcribe-video-medium
Normal file
2
dotfiles/bin/transcribe-video-medium
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
transcribe-video "$1" "$2" "medium"
|
||||||
2
dotfiles/bin/transcribe-video-small
Normal file
2
dotfiles/bin/transcribe-video-small
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
transcribe-video "$1" "$2" "small"
|
||||||
2
dotfiles/bin/transcribe-video-tiny
Normal file
2
dotfiles/bin/transcribe-video-tiny
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
transcribe-video "$1" "$2" "tiny"
|
||||||
48
dotfiles/bin/trim-accurate-video
Normal file
48
dotfiles/bin/trim-accurate-video
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Reencodes the video with a more accurate length.
|
||||||
|
|
||||||
|
if which tput >/dev/null 2>&1; then
|
||||||
|
ncolors=$(tput colors)
|
||||||
|
fi
|
||||||
|
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
|
||||||
|
RED="$(tput setaf 1)"
|
||||||
|
GREEN="$(tput setaf 2)"
|
||||||
|
YELLOW="$(tput setaf 3)"
|
||||||
|
BLUE="$(tput setaf 4)"
|
||||||
|
MAGENTA="$(tput setaf 5)"
|
||||||
|
CYAN="$(tput setaf 6)"
|
||||||
|
BOLD="$(tput bold)"
|
||||||
|
NORMAL="$(tput sgr0)"
|
||||||
|
else
|
||||||
|
RED=""
|
||||||
|
GREEN=""
|
||||||
|
YELLOW=""
|
||||||
|
BLUE=""
|
||||||
|
MAGENTA=""
|
||||||
|
CYAN=""
|
||||||
|
BOLD=""
|
||||||
|
NORMAL=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
filename=$(basename -- "$1")
|
||||||
|
output_name="$2"
|
||||||
|
start_time="$3"
|
||||||
|
end_time="$4"
|
||||||
|
|
||||||
|
if [[ $filename == "" || $output_name == "" || $start_time == "" || $end_time == "" ]]; then
|
||||||
|
printf "${BOLD}${RED}Usage: $0 <filename> <output name> <start time HH:MM:SS> <end time HH:MM:SS>${NORMAL}\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
extension="${filename##*.}"
|
||||||
|
filename="${filename%.*}"
|
||||||
|
output="${output_name}.$extension"
|
||||||
|
timing_args="-ss $start_time -to $end_time"
|
||||||
|
|
||||||
|
printf "\n${YELLOW}${BOLD}Trimming '$filename.$extension' | output: $output | start: $start_time | end: $end_time${NORMAL}\n"
|
||||||
|
|
||||||
|
ffmpeg -y -stats -loglevel level+error $timing_args -accurate_seek -i "$filename.$extension" -c:v libx264 -c:a copy "$output"
|
||||||
|
|
||||||
|
printf "\n${GREEN}${BOLD}Finished trimming${NORMAL}\n\n"
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ timing_args="-ss $start_time -to $end_time"
|
|||||||
|
|
||||||
printf "\n${YELLOW}${BOLD}Trimming '$filename.$extension' | output: $output | start: $start_time | end: $end_time${NORMAL}\n"
|
printf "\n${YELLOW}${BOLD}Trimming '$filename.$extension' | output: $output | start: $start_time | end: $end_time${NORMAL}\n"
|
||||||
|
|
||||||
ffmpeg -y -stats -loglevel level+error $timing_args -i "$filename.$extension" -c:a copy -c:v copy "$output"
|
ffmpeg -y -stats -loglevel level+error $timing_args -i "$filename.$extension" -c copy "$output"
|
||||||
|
|
||||||
printf "\n${GREEN}${BOLD}Finished trimming${NORMAL}\n\n"
|
printf "\n${GREEN}${BOLD}Finished trimming${NORMAL}\n\n"
|
||||||
|
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
# If you're getting signature errors, check out https://www.msys2.org/news/#2020-06-29-new-packagers and/or other news posts.
|
# If you're getting signature errors, check out https://www.msys2.org/news/#2020-06-29-new-packagers and/or other news posts.
|
||||||
|
|
||||||
source "$HOME/.dotfiles/script_helpers/printing.sh"
|
source "$HOME/dotfiles/script_helpers/printing.sh"
|
||||||
source "$HOME/.dotfiles/script_helpers/platform.sh"
|
source "$HOME/dotfiles/script_helpers/platform.sh"
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
89
install → dotfiles/install
Executable file → Normal file
89
install → dotfiles/install
Executable file → Normal file
@@ -4,7 +4,7 @@ if [[ $(uname) == 'Darwin' ]]; then
|
|||||||
if ! command -v brew &>/dev/null
|
if ! command -v brew &>/dev/null
|
||||||
then
|
then
|
||||||
# We need to update bash, so we'll start with setting up homebrew.
|
# We need to update bash, so we'll start with setting up homebrew.
|
||||||
./osx/pre_install
|
./macos/pre_install
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -52,31 +52,6 @@ setup_zsh() {
|
|||||||
if [[ $is_linux -eq 1 ]]; then
|
if [[ $is_linux -eq 1 ]]; then
|
||||||
sudo apt install zsh
|
sudo apt install zsh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
make_link .dotfiles/zsh/core .zsh
|
|
||||||
|
|
||||||
FILES=()
|
|
||||||
FILES+=('zshrc')
|
|
||||||
FILES+=('zlogin')
|
|
||||||
|
|
||||||
for file in "${FILES[@]}"
|
|
||||||
do
|
|
||||||
make_link .dotfiles/zsh/$file .$file
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
setup_bash() {
|
|
||||||
printf "${MAGENTA}==> ${NORMAL}Setting up bash...\n"
|
|
||||||
|
|
||||||
FILES=()
|
|
||||||
FILES+=('bashrc')
|
|
||||||
FILES+=('bash_profile')
|
|
||||||
FILES+=('inputrc')
|
|
||||||
|
|
||||||
for file in "${FILES[@]}"
|
|
||||||
do
|
|
||||||
make_link .dotfiles/bash/$file .$file
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
####################################################################################################
|
####################################################################################################
|
||||||
@@ -85,40 +60,6 @@ setup_bash() {
|
|||||||
|
|
||||||
pushd "$HOME" &>/dev/null
|
pushd "$HOME" &>/dev/null
|
||||||
|
|
||||||
make_link $dotfiles_dir .dotfiles 1 # expand source path in case we're reinstalling and the cwd is a symlink.
|
|
||||||
|
|
||||||
if [[ $is_windows -eq 1 ]]; then
|
|
||||||
do_vim_copy=1
|
|
||||||
if [[ -d "$PWD/.vim" ]]; then
|
|
||||||
printf "\n${BOLD}Vim folder already found at destination. Overwrite? [1,0]\n> ${NORMAL}"
|
|
||||||
read -e copy_vim
|
|
||||||
if [[ $copy_vim != "0" && $copy_vim != "1" ]]; then
|
|
||||||
fatal "Invalid value '$copy_vim'"
|
|
||||||
elif [[ $copy_vim == "0" ]]; then
|
|
||||||
do_vim_copy=0
|
|
||||||
printf "\n"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [[ $do_vim_copy -eq 1 ]]; then
|
|
||||||
printf "${MAGENTA}==> ${NORMAL}Copying ${YELLOW}.dotfiles/vim${NORMAL} to ${YELLOW}$PWD/.vim${NORMAL}\n"
|
|
||||||
cp -r .dotfiles/vim .vim
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
make_link .dotfiles/vim .vim
|
|
||||||
fi
|
|
||||||
|
|
||||||
FILES=()
|
|
||||||
FILES+=('env.loader')
|
|
||||||
FILES+=('aliases')
|
|
||||||
FILES+=('gitconfig')
|
|
||||||
FILES+=('vimrc')
|
|
||||||
FILES+=('curlrc')
|
|
||||||
|
|
||||||
for file in "${FILES[@]}"
|
|
||||||
do
|
|
||||||
make_link .dotfiles/$file .$file
|
|
||||||
done
|
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
git_comp_filename=".git-completion.bash"
|
git_comp_filename=".git-completion.bash"
|
||||||
printf "${MAGENTA}==> ${NORMAL}Downloading Git completion list to ${YELLOW}$PWD/$git_comp_filename${NORMAL}\n"
|
printf "${MAGENTA}==> ${NORMAL}Downloading Git completion list to ${YELLOW}$PWD/$git_comp_filename${NORMAL}\n"
|
||||||
@@ -129,37 +70,19 @@ set -e
|
|||||||
# Setup platform files
|
# Setup platform files
|
||||||
#########################
|
#########################
|
||||||
|
|
||||||
if [[ $is_windows -eq 1 ]]; then
|
if [[ $is_macos -eq 1 ]]; then
|
||||||
printf "\n${BOLD}Setting up Windows${NORMAL}\n\n"
|
|
||||||
os_name="windows"
|
|
||||||
# Already using bash if running msys2.
|
|
||||||
setup_bash
|
|
||||||
elif [[ $is_macos -eq 1 ]]; then
|
|
||||||
printf "\n${BOLD}Setting up MacOS${NORMAL}\n\n"
|
printf "\n${BOLD}Setting up MacOS${NORMAL}\n\n"
|
||||||
os_name="osx"
|
$dotfiles_dir/macos/install
|
||||||
|
# might just switch back to bash since the zsh stuff is ancient.
|
||||||
setup_zsh
|
setup_zsh
|
||||||
setup_bash
|
|
||||||
use_shell zsh
|
use_shell zsh
|
||||||
|
|
||||||
elif [[ $is_linux -eq 1 ]]; then
|
elif [[ $is_linux -eq 1 ]]; then
|
||||||
printf "\n${BOLD}Setting up Linux${NORMAL}\n\n"
|
printf "\n${BOLD}Setting up Linux${NORMAL}\n\n"
|
||||||
os_name="linux"
|
$dotfiles_dir/linux/install
|
||||||
setup_zsh
|
|
||||||
setup_bash
|
|
||||||
use_shell bash
|
use_shell bash
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $os_name != "" ]]; then
|
|
||||||
if [ -f .dotfiles/$os_name/env.platform ]; then
|
|
||||||
make_link .dotfiles/$os_name/env.platform .env.platform
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f .dotfiles/$os_name/gitconfig.platform ]; then
|
|
||||||
make_link .dotfiles/$os_name/gitconfig.platform .gitconfig.platform
|
|
||||||
fi
|
|
||||||
|
|
||||||
$dotfiles_dir/$os_name/install
|
|
||||||
fi
|
|
||||||
|
|
||||||
popd "$HOME" &>/dev/null
|
popd "$HOME" &>/dev/null
|
||||||
|
|
||||||
printf "${BOLD}${GREEN}Done!${NORMAL}\n"
|
printf "${BOLD}${GREEN}Done!${NORMAL}\n"
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user