Compare commits
50 Commits
78fd8f6d45
...
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 |
@@ -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 twt='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
|
|
||||||
@@ -34,7 +34,6 @@ let s:select = "546e8f"
|
|||||||
let s:window = "37474f"
|
let s:window = "37474f"
|
||||||
let s:comment = "5dea82"
|
let s:comment = "5dea82"
|
||||||
let s:tab = "03404a"
|
let s:tab = "03404a"
|
||||||
let s:cursor = "023940"
|
|
||||||
let s:error = "e40e0e"
|
let s:error = "e40e0e"
|
||||||
let s:proc = "0eefcb"
|
let s:proc = "0eefcb"
|
||||||
let s:warn = "dcd53e"
|
let s:warn = "dcd53e"
|
||||||
@@ -69,11 +68,11 @@ if version >= 700
|
|||||||
call X("PMenu", s:text, s:select, "none") " Autocompletion menu
|
call X("PMenu", s:text, s:select, "none") " Autocompletion menu
|
||||||
call X("PMenuSel", s:text, "027990", "bold") " Selected autocompletion item
|
call X("PMenuSel", s:text, "027990", "bold") " Selected autocompletion item
|
||||||
call X("SignColumn", "", s:bg, "none")
|
call X("SignColumn", "", s:bg, "none")
|
||||||
call X("CursorLine", "", s:cursor, "none") " Horizontal line at the cursor.
|
call X("CursorLine", "", "022f36", "none") " Horizontal line at the cursor.
|
||||||
call X("CursorColumn", "", s:cursor, "none") " Vertical line at the cursor.
|
call X("CursorColumn", "", "022c33", "none") " Vertical line at the cursor.
|
||||||
end
|
end
|
||||||
if version >= 703
|
if version >= 703
|
||||||
call X("ColorColumn", "", "034a4a", "none") " Vertical line set by colorcolumn option.
|
call X("ColorColumn", "", "022c33", "none") " Vertical line set by colorcolumn option.
|
||||||
end
|
end
|
||||||
|
|
||||||
" Standard Highlighting
|
" Standard Highlighting
|
||||||
@@ -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
|
||||||
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
@@ -271,3 +271,7 @@ memcpy
|
|||||||
strlen
|
strlen
|
||||||
u8
|
u8
|
||||||
s64
|
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.
1293
vimrc → .vimrc
1293
vimrc → .vimrc
File diff suppressed because it is too large
Load Diff
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.
|
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
@@ -66,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
|
||||||
|
|
||||||
@@ -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
|
||||||
|
|
||||||
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