Update some download aliases, vimrc search for cursor term, and some volume scripts
This commit is contained in:
parent
37029d5202
commit
9ee6411545
47
.aliases
47
.aliases
|
@ -110,8 +110,12 @@ remove_windows_file() {
|
|||
fi
|
||||
}
|
||||
|
||||
open_explorer_here() {
|
||||
local path_expanded=$(expand_path "$1")
|
||||
open_explorer() {
|
||||
local target="$1"
|
||||
if [[ $target == "" ]]; then
|
||||
target="$PWD"
|
||||
fi
|
||||
local path_expanded=$(expand_path "$target")
|
||||
if [[ -d $path_expanded ]]; then
|
||||
local path=$(unix_to_windows_path "$path_expanded")
|
||||
explorer.exe "$path"
|
||||
|
@ -259,7 +263,7 @@ dos2unix_all() {
|
|||
}
|
||||
alias d2u='dos2unix_all'
|
||||
|
||||
alias e='open_explorer_here "$PWD"'
|
||||
alias e='open_explorer'
|
||||
alias exp='echo "Use e instead."'
|
||||
alias f='fg'
|
||||
alias hist='history'
|
||||
|
@ -352,7 +356,7 @@ make_vid_dir_and_cd_into() {
|
|||
|
||||
dir_name=$(remove_extra_spaces "$dir_name")
|
||||
|
||||
printf "${BOLD}Creating directory ${YELLOW}'$dir_name'${NORMAL}\n"
|
||||
printf "${BOLD}Creating directory ${YELLOW}\"$dir_name\"${NORMAL}\n"
|
||||
mkdir "$dir_name" 2>/dev/null
|
||||
cd "$dir_name"
|
||||
|
||||
|
@ -999,9 +1003,12 @@ download_mp4() {
|
|||
mv $temp_name "$filename.mp4"
|
||||
}
|
||||
|
||||
# Download from m3u8 stream to mp4.
|
||||
# You can supply a local file or a URL to the m3u8 file. If the request requires cookies then the easiest way to do it is to
|
||||
# run the ffmpeg command yourself using this as the example format:
|
||||
# Download a stream to mp4. Can be from an m3u8 file, an mpd, etc. Whatever the
|
||||
# supported extensions are from ffmpeg.
|
||||
#
|
||||
# You can supply a local file or a URL to the stream file. If the request
|
||||
# requires cookies then the easiest way to do it is to run the ffmpeg command
|
||||
# yourself using this as the example format:
|
||||
#
|
||||
# ffmpeg -protocol_whitelist file,https,crypto,tls,tcp -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qOj8XCY4pAhguJQlERcANIK2WXm56dA__; CloudFront-Key-Pair-Id=APK3IWIJLRLBNXI2PR4Q\r\n' -i https://video.stellartickets.com/organizations/2ad4a0ac-bec7-4863-a0f1-36247cc83d23/transcoded/91afb281-07-20-23_Krazam_Presents_index_1080p_20230721T024151_1.m3u8 -acodec copy -vcodec copy krazam.mp4
|
||||
#
|
||||
|
@ -1012,17 +1019,17 @@ download_mp4() {
|
|||
#
|
||||
# If you need to debug the http request then add "-v trace" to the command above.
|
||||
#
|
||||
download_mp4_from_m3u8() {
|
||||
local m3u8_path="$1"
|
||||
download_mp4_from_stream() {
|
||||
local stream_path="$1"
|
||||
local filename="$2"
|
||||
|
||||
if [[ $m3u8_path == "" || $filename == "" ]]; then
|
||||
error "Usage: <m3u8 path> <filename>"
|
||||
if [[ $stream_path == "" || $filename == "" ]]; then
|
||||
error "Usage: <stream path> <filename>"
|
||||
return
|
||||
fi
|
||||
|
||||
printf "${BOLD}Downloading: ${YELLOW}$filename${NORMAL}\n"
|
||||
ffmpeg.exe -protocol_whitelist file,data,https,crypto,tls,tcp -allowed_extensions ALL -i $m3u8_path -acodec copy -vcodec copy "${filename}.mp4"
|
||||
ffmpeg.exe -protocol_whitelist file,data,https,crypto,tls,tcp -allowed_extensions ALL -i $stream_path -acodec copy -vcodec copy "${filename}.mp4"
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
error "Error: failed to download."
|
||||
|
@ -1033,17 +1040,17 @@ download_mp4_from_m3u8() {
|
|||
}
|
||||
|
||||
# Same notes from above regarding cookies/headers.
|
||||
download_aac_from_m3u8() {
|
||||
local m3u8_path="$1"
|
||||
download_aac_from_stream() {
|
||||
local stream_path="$1"
|
||||
local filename="$2"
|
||||
|
||||
if [[ $m3u8_path == "" || $filename == "" ]]; then
|
||||
error "Usage: <m3u8 path> <filename>"
|
||||
if [[ $stream_path == "" || $filename == "" ]]; then
|
||||
error "Usage: <stream path> <filename>"
|
||||
return
|
||||
fi
|
||||
|
||||
printf "${BOLD}Downloading: ${YELLOW}$filename${NORMAL}\n"
|
||||
ffmpeg.exe -protocol_whitelist file,https,crypto,tls,tcp -i $m3u8_path -acodec copy "${filename}.aac"
|
||||
ffmpeg.exe -protocol_whitelist file,https,crypto,tls,tcp -i $stream_path -acodec copy "${filename}.aac"
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
error "Error: failed to download."
|
||||
|
@ -1185,8 +1192,10 @@ alias twitter='download_twitter_vid "" '
|
|||
# Misc
|
||||
#-------------------------------------------------
|
||||
alias download-mp4='download_mp4'
|
||||
alias download-from-m3u8='download_mp4_from_m3u8'
|
||||
alias download-audio-from-m3u8='download_aac_from_m3u8'
|
||||
alias download-from-stream='download_mp4_from_stream'
|
||||
alias download-from-m3u8='echo Use download-from-stream instead.'
|
||||
alias download-audio-from-stream='download_aac_from_stream'
|
||||
alias download-audio-from-m3u8='echo Use download-audio-from-stream instead.'
|
||||
|
||||
####################################################################################################
|
||||
# Video Compression
|
||||
|
|
114
.vimrc
114
.vimrc
|
@ -303,7 +303,7 @@ set switchbuf=useopen,split
|
|||
set numberwidth=5
|
||||
set showtabline=2
|
||||
set winwidth=79
|
||||
set linebreak " Break wrapped text at word boundaries
|
||||
"set linebreak " Break wrapped text at word boundaries
|
||||
|
||||
" Use abbreviations.
|
||||
set shortmess=a
|
||||
|
@ -893,7 +893,6 @@ let g:rg_window_height = g:quickfix_pane_height
|
|||
" ctrl-y = create file and open it.
|
||||
" ctrl-z = mark multiple file search results to open (I think you can only use ctrl-v or ctrl-x and not enter).
|
||||
" ctrl-o = ask how to open a file search result.
|
||||
" ctrl-o = ask how to open a file search result.
|
||||
" ctrl-p | ctrl-n = traverse search history.
|
||||
|
||||
" CtrlP finds the tags file by using vim's 'tags' option value. I initially
|
||||
|
@ -947,6 +946,7 @@ let g:ctrlp_switch_buffer = 'et' " If a file is already open, open it again in a
|
|||
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
|
||||
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard'] " If a git repo, use checked in files (ignore things in .gitignore); fallback to globpath()
|
||||
let g:ctrlp_match_func = { 'match': 'pymatcher#PyMatch' }
|
||||
let g:ctrlp_split_window = 0 " Replace current buffer.
|
||||
|
||||
"##################################################################################
|
||||
" GIT
|
||||
|
@ -1535,11 +1535,14 @@ nnoremap <C-p> :cp<CR>
|
|||
"##################################################################################
|
||||
|
||||
" Search using ripgrep (first install with Rust: cargo install ripgrep).
|
||||
fu! Search(path, search_args, case_insensitive=0)
|
||||
fu! Search(path, search_args, case_insensitive=0, token="")
|
||||
let l:helper = "Search '" . a:path . "' (" . (len(a:search_args) > 0 ? a:search_args . " | " : '') . (a:case_insensitive ? "INSENSITIVE" : "SENSITIVE") . "): "
|
||||
let l:term = input(l:helper)
|
||||
let l:term = a:token
|
||||
if empty(l:term)
|
||||
return
|
||||
let l:term = input(l:helper)
|
||||
if empty(l:term)
|
||||
return
|
||||
endif
|
||||
endif
|
||||
|
||||
" @note --pretty (i.e. colors) is not enabled in vim-ripgrep because the
|
||||
|
@ -1578,37 +1581,48 @@ fu! SearchExt(path, search_args, case_insensitive=0)
|
|||
call Search(a:path, l:args, a:case_insensitive)
|
||||
endfu
|
||||
|
||||
fu! SearchCursor(path, search_args, case_insensitive=0)
|
||||
let l:term = expand('<cword>')
|
||||
call Search(a:path, a:search_args, a:case_insensitive, l:term)
|
||||
endfu
|
||||
|
||||
|
||||
"/////////////////////////////////////////////////
|
||||
" SEARCH IN CURRENT WORKING DIRECTORY
|
||||
"/////////////////////////////////////////////////
|
||||
|
||||
" Case insensitive:
|
||||
nnoremap <leader>s :call Search( '.', g:campo_custom_search_args, 1)<cr>
|
||||
nnoremap <leader>sd :call SearchExt('.', g:campo_custom_search_args, 1)<cr>
|
||||
nnoremap <leader>s :call Search(getcwd(), g:campo_custom_search_args, 1)<cr>
|
||||
nnoremap <leader>sd :call SearchExt(getcwd(), g:campo_custom_search_args, 1)<cr>
|
||||
nnoremap <leader>se :call SearchCursor(getcwd(), g:campo_custom_search_args, 1)<cr>
|
||||
" Case sensitive:
|
||||
nnoremap <leader>ss :call Search( '.', g:campo_custom_search_args, 0)<cr>
|
||||
nnoremap <leader>ssd :call SearchExt('.', g:campo_custom_search_args, 0)<cr>
|
||||
nnoremap <leader>ss :call Search(getcwd(), g:campo_custom_search_args, 0)<cr>
|
||||
nnoremap <leader>ssd :call SearchExt(getcwd(), g:campo_custom_search_args, 0)<cr>
|
||||
nnoremap <leader>sse :call SearchCursor(getcwd(), g:campo_custom_search_args, 0)<cr>
|
||||
|
||||
|
||||
"/////////////////////////////////////////////////
|
||||
" SEARCH IN DIRECTORY CONTAINING THE ACTIVE FILE
|
||||
"/////////////////////////////////////////////////
|
||||
|
||||
" Case insensitive:
|
||||
nnoremap <leader>sf :call Search( expand('%:p:h'), g:campo_custom_search_args, 1)<cr>
|
||||
nnoremap <leader>sdf :call SearchExt(expand('%:p:h'), g:campo_custom_search_args, 1)<cr>
|
||||
" Case insensitive
|
||||
nnoremap <leader>sf :call Search(expand('%:p:h'), g:campo_custom_search_args, 1)<cr>
|
||||
nnoremap <leader>sdf :call SearchExt(expand('%:p:h'), g:campo_custom_search_args, 1)<cr>
|
||||
nnoremap <leader>sef :call SearchCursor(expand('%:p:h'), g:campo_custom_search_args, 1)<cr>
|
||||
" Case sensitive:
|
||||
nnoremap <leader>ssf :call Search( expand('%:p:h'), g:campo_custom_search_args, 0)<cr>
|
||||
nnoremap <leader>ssf :call Search(expand('%:p:h'), g:campo_custom_search_args, 0)<cr>
|
||||
nnoremap <leader>ssdf :call SearchExt(expand('%:p:h'), g:campo_custom_search_args, 0)<cr>
|
||||
nnoremap <leader>ssef :call SearchCursor(expand('%:p:h'), g:campo_custom_search_args, 0)<cr>
|
||||
|
||||
"/////////////////////////////////////////////////
|
||||
" SEARCH IN ALL PROJECTS
|
||||
"/////////////////////////////////////////////////
|
||||
|
||||
" Case insensitive:
|
||||
nnoremap <leader>sp :call Search( g:campo_projects_path, g:campo_custom_search_args, 1)<cr>
|
||||
nnoremap <leader>sdp :call SearchExt(g:campo_projects_path, g:campo_custom_search_args, 1)<cr>
|
||||
nnoremap <leader>sp :call Search(g:campo_projects_path, g:campo_custom_search_args, 1)<cr>
|
||||
nnoremap <leader>sdp :call SearchExt(g:campo_projects_path, g:campo_custom_search_args, 1)<cr>
|
||||
" Case sensitive:
|
||||
nnoremap <leader>ssp :call Search( g:campo_projects_path, g:campo_custom_search_args, 0)<cr>
|
||||
nnoremap <leader>ssp :call Search(g:campo_projects_path, g:campo_custom_search_args, 0)<cr>
|
||||
nnoremap <leader>ssdp :call SearchExt(g:campo_projects_path, g:campo_custom_search_args, 0)<cr>
|
||||
|
||||
"/////////////////////////////////////////////////
|
||||
|
@ -1618,32 +1632,40 @@ nnoremap <leader>ssdp :call SearchExt(g:campo_projects_path, g:campo_custom_sear
|
|||
" Case insensitive:
|
||||
"
|
||||
" ROOT
|
||||
nnoremap <leader>sg :call Search( g:campo_jai_path, g:campo_custom_search_args, 1)<cr>
|
||||
nnoremap <leader>sdg :call SearchExt(g:campo_jai_path, g:campo_custom_search_args, 1)<cr>
|
||||
nnoremap <leader>sg :call Search(g:campo_jai_path, g:campo_custom_search_args, 1)<cr>
|
||||
nnoremap <leader>sdg :call SearchExt(g:campo_jai_path, g:campo_custom_search_args, 1)<cr>
|
||||
nnoremap <leader>seg :call SearchCursor(g:campo_jai_path, g:campo_custom_search_args, 1)<cr>
|
||||
" MODULES
|
||||
nnoremap <leader>sm :call Search( g:campo_jai_path.'/modules', g:campo_custom_search_args, 1)<cr>
|
||||
nnoremap <leader>sdm :call SearchExt(g:campo_jai_path.'/modules', g:campo_custom_search_args, 1)<cr>
|
||||
nnoremap <leader>sm :call Search(g:campo_jai_path.'/modules', g:campo_custom_search_args, 1)<cr>
|
||||
nnoremap <leader>sdm :call SearchExt(g:campo_jai_path.'/modules', g:campo_custom_search_args, 1)<cr>
|
||||
nnoremap <leader>sem :call SearchCursor(g:campo_jai_path.'/modules', g:campo_custom_search_args, 1)<cr>
|
||||
" HOW TO
|
||||
nnoremap <leader>sh :call Search( g:campo_jai_path.'/how_to', g:campo_custom_search_args, 1)<cr>
|
||||
nnoremap <leader>sdh :call SearchExt(g:campo_jai_path.'/how_to', g:campo_custom_search_args, 1)<cr>
|
||||
nnoremap <leader>sh :call Search(g:campo_jai_path.'/how_to', g:campo_custom_search_args, 1)<cr>
|
||||
nnoremap <leader>sdh :call SearchExt(g:campo_jai_path.'/how_to', g:campo_custom_search_args, 1)<cr>
|
||||
" EXAMPLES
|
||||
nnoremap <leader>se :call Search( g:campo_jai_path.'/examples', g:campo_custom_search_args, 1)<cr>
|
||||
nnoremap <leader>sde :call SearchExt(g:campo_jai_path.'/examples', g:campo_custom_search_args, 1)<cr>
|
||||
" Using the 'e' for cursor search.
|
||||
"nnoremap <leader>se :call Search(g:campo_jai_path.'/examples', g:campo_custom_search_args, 1)<cr>
|
||||
"nnoremap <leader>sde :call SearchExt(g:campo_jai_path.'/examples', g:campo_custom_search_args, 1)<cr>
|
||||
"nnoremap <leader>sae :call SearchCursor(g:campo_jai_path.'/examples', g:campo_custom_search_args, 1)<cr>
|
||||
|
||||
" Case sensitive:
|
||||
"
|
||||
" ROOT
|
||||
nnoremap <leader>ssg :call Search( g:campo_jai_path, g:campo_custom_search_args, 0)<cr>
|
||||
nnoremap <leader>ssdg :call SearchExt(g:campo_jai_path, g:campo_custom_search_args, 0)<cr>
|
||||
nnoremap <leader>ssg :call Search(g:campo_jai_path, g:campo_custom_search_args, 0)<cr>
|
||||
nnoremap <leader>ssdg :call SearchExt(g:campo_jai_path, g:campo_custom_search_args, 0)<cr>
|
||||
nnoremap <leader>sseg :call SearchCursor(g:campo_jai_path, g:campo_custom_search_args, 0)<cr>
|
||||
" MODULES
|
||||
nnoremap <leader>ssm :call Search( g:campo_jai_path.'/modules', g:campo_custom_search_args, 0)<cr>
|
||||
nnoremap <leader>ssdm :call SearchExt(g:campo_jai_path.'/modules', g:campo_custom_search_args, 0)<cr>
|
||||
nnoremap <leader>ssm :call Search(g:campo_jai_path.'/modules', g:campo_custom_search_args, 0)<cr>
|
||||
nnoremap <leader>ssdm :call SearchExt(g:campo_jai_path.'/modules', g:campo_custom_search_args, 0)<cr>
|
||||
nnoremap <leader>ssem :call SearchCursor(g:campo_jai_path.'/modules', g:campo_custom_search_args, 0)<cr>
|
||||
" HOW TO
|
||||
nnoremap <leader>ssh :call Search( g:campo_jai_path.'/how_to', g:campo_custom_search_args, 0)<cr>
|
||||
nnoremap <leader>ssdh :call SearchExt(g:campo_jai_path.'/how_to', g:campo_custom_search_args, 0)<cr>
|
||||
nnoremap <leader>ssh :call Search(g:campo_jai_path.'/how_to', g:campo_custom_search_args, 0)<cr>
|
||||
nnoremap <leader>ssdh :call SearchExt(g:campo_jai_path.'/how_to', g:campo_custom_search_args, 0)<cr>
|
||||
" EXAMPLES
|
||||
nnoremap <leader>sse :call Search( g:campo_jai_path.'/examples', g:campo_custom_search_args, 0)<cr>
|
||||
nnoremap <leader>ssde :call SearchExt(g:campo_jai_path.'/examples', g:campo_custom_search_args, 0)<cr>
|
||||
" Using the 'e' for cursor search.
|
||||
"nnoremap <leader>sse :call Search(g:campo_jai_path.'/examples', g:campo_custom_search_args, 0)<cr>
|
||||
"nnoremap <leader>ssde :call SearchExt(g:campo_jai_path.'/examples', g:campo_custom_search_args, 0)<cr>
|
||||
"nnoremap <leader>ssae :call SearchCursor(g:campo_jai_path.'/examples', g:campo_custom_search_args, 0)<cr>
|
||||
|
||||
" Navigation for the vim-ripgrep search results.
|
||||
" Hit o on a result line to open the file at that line.
|
||||
|
@ -1763,6 +1785,34 @@ nnoremap <leader>cc :call CenterPane()<cr>
|
|||
nnoremap <leader>cd :call RemoveCenterPane()<cr>
|
||||
|
||||
|
||||
"##################################################################################
|
||||
" EDIT TODO PLAN & SMALL WINDOW
|
||||
"##################################################################################
|
||||
|
||||
fu! EditTodoPlan()
|
||||
execute 'vsplit todo.plan'
|
||||
exec 'vertical resize' string(&columns * 0.25)
|
||||
endfu
|
||||
fu! EditTodoPlanH()
|
||||
execute 'split todo.plan'
|
||||
exec 'horizontal resize' string(&lines * 0.25)
|
||||
endfu
|
||||
|
||||
fu! MakeSmall()
|
||||
exec 'vertical resize' string(&columns * 0.25)
|
||||
endfu
|
||||
|
||||
fu! SmallWindow()
|
||||
execute 'vsplit'
|
||||
exec 'vertical resize' string(&columns * 0.25)
|
||||
endfu
|
||||
|
||||
nnoremap <leader>t :call EditTodoPlan()<cr>
|
||||
nnoremap <leader>th :call EditTodoPlanH()<cr>
|
||||
nnoremap <leader>tt :call MakeSmall()<cr>
|
||||
nnoremap <leader>ts :call SmallWindow()<cr>
|
||||
|
||||
|
||||
"##################################################################################
|
||||
" SIMPLE VIEW
|
||||
"##################################################################################
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# change-volume script, supplying it the volume delta you want. Typically you
|
||||
# use the delta from the analysis report this script provides, e.g. if the
|
||||
# max_volume is -5 db then you would call change-volume with a value of 5. I
|
||||
# find that the two pass normalize-audio script works better than this
|
||||
# find that the two pass normalize-volume script works better than this
|
||||
# approach...but it will take longer to run!
|
||||
#
|
||||
# Inspired by https://superuser.com/a/323127 and https://superuser.com/a/1312885
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Use this to normalize the volume of a video or audio file using the average loudness, or RMS-based normalization. It does a pretty good job!
|
||||
# If you want to modify the volume manually then checkout the analyze-volume and change-volume scripts.
|
||||
# Use this to normalize the volume of a video or audio file using the average
|
||||
# loudness, or RMS-based normalization. It does a pretty good job!
|
||||
#
|
||||
# If you want to modify the volume manually then checkout the analyze-volume
|
||||
# and change-volume scripts.
|
||||
#
|
||||
# This does not re-encode video when given a video file.
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue
Block a user