Flash windows icon when various scripts finish running
This commit is contained in:
58
.aliases
58
.aliases
@@ -41,7 +41,7 @@ reload() {
|
||||
}
|
||||
|
||||
update-shell() {
|
||||
if [[ '${platform,,}' == *'ming'* ]]; then
|
||||
if [[ ${platform,,} == *'ming'* ]]; then
|
||||
pacman -Syu
|
||||
printf "\n${BOLD}${YELLOW}Close this shell, open a new one, and then run 'pacman -Su'${NORMAL}\n"
|
||||
fi
|
||||
@@ -148,6 +148,30 @@ remove_extra_spaces() {
|
||||
echo "$ret"
|
||||
}
|
||||
|
||||
flash_taskbar() {
|
||||
if [[ ${platform,,} == *'ming'* ]]; then
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "
|
||||
\$h = (Get-Process mintty -EA SilentlyContinue | ? MainWindowHandle | select -First 1).MainWindowHandle
|
||||
if (-not \$h) { exit }
|
||||
|
||||
Add-Type -TypeDefinition 'using System; using System.Runtime.InteropServices;
|
||||
public static class F {
|
||||
[StructLayout(LayoutKind.Sequential)] public struct I { public uint cb; public IntPtr h; public uint f; public uint c; public uint t; }
|
||||
[DllImport(\"user32.dll\")] public static extern bool FlashWindowEx(ref I i);
|
||||
}'
|
||||
\$i = New-Object F+I
|
||||
\$i.cb = [Runtime.InteropServices.Marshal]::SizeOf(\$i)
|
||||
\$i.h = [IntPtr]\$h
|
||||
\$i.f = 2 -bor 12
|
||||
\$i.c = 0
|
||||
\$i.t = 0
|
||||
[F]::FlashWindowEx([ref]\$i) | Out-Null
|
||||
"
|
||||
else
|
||||
echo "flash_taskbar not implemented for this platform"
|
||||
fi
|
||||
}
|
||||
|
||||
##################
|
||||
# Building code
|
||||
##################
|
||||
@@ -198,7 +222,7 @@ if [[ $platform == 'Darwin' ]]; then
|
||||
alias trash='rmtrash'
|
||||
alias tt='rmtrash'
|
||||
|
||||
elif [[ "${platform,,}" == *'ming'* ]]; then # convert to lowercase then compare with wildcard
|
||||
elif [[ ${platform,,} == *'ming'* ]]; then # convert to lowercase then compare with wildcard
|
||||
#alias rm='echo "use trash command instead!"'
|
||||
#alias rmr='echo "use trash command instead!"'
|
||||
alias trash='remove_windows_file'
|
||||
@@ -226,7 +250,7 @@ mkcd() {
|
||||
alias aliases='vim ~/.aliases'
|
||||
alias al='aliases'
|
||||
|
||||
if [[ "${platform,,}" == *'ming'* ]]; then
|
||||
if [[ ${platform,,} == *'ming'* ]]; then
|
||||
_checksum() {
|
||||
local algo="$1"
|
||||
local file="$2"
|
||||
@@ -412,6 +436,7 @@ function my_transcribe_video() {
|
||||
else
|
||||
transcribe-video "$file" "$output" $start_time $end_time tiny base
|
||||
fi
|
||||
flash_taskbar
|
||||
}
|
||||
|
||||
function my_transcribe_video_all_models() {
|
||||
@@ -433,6 +458,7 @@ function my_transcribe_video_all_models() {
|
||||
if [[ $end_time == "" ]]; then end_time="0"; fi
|
||||
|
||||
transcribe-video "$file" "$output" $start_time $end_time tiny base small medium
|
||||
flash_taskbar
|
||||
}
|
||||
|
||||
|
||||
@@ -509,6 +535,7 @@ download_youtube_vid() {
|
||||
if [[ $make_folder == "1" ]]; then cd ..; fi
|
||||
|
||||
printf "${BOLD}Finished downloading ${YELLOW}$filename${NORMAL}\n"
|
||||
flash_taskbar
|
||||
}
|
||||
|
||||
|
||||
@@ -555,6 +582,7 @@ download_youtube_playlist() {
|
||||
cd ..
|
||||
|
||||
printf "${BOLD}Finished downloading the playlist\n${NORMAL}"
|
||||
flash_taskbar
|
||||
}
|
||||
|
||||
download_youtube_playlist_list() {
|
||||
@@ -574,6 +602,7 @@ download_youtube_playlist_list() {
|
||||
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}"
|
||||
flash_taskbar
|
||||
}
|
||||
|
||||
download_youtube_uploads_list() {
|
||||
@@ -602,6 +631,7 @@ download_youtube_uploads_list() {
|
||||
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}"
|
||||
flash_taskbar
|
||||
}
|
||||
|
||||
function download_youtube_audio() {
|
||||
@@ -646,6 +676,7 @@ function download_youtube_audio() {
|
||||
if [[ $make_folder == "1" ]]; then cd ..; fi
|
||||
|
||||
printf "${BOLD}Finished downloading ${YELLOW}$filename${NORMAL}\n"
|
||||
flash_taskbar
|
||||
}
|
||||
|
||||
# Download Twitch chat transcript
|
||||
@@ -699,9 +730,13 @@ download_twitch_chat() {
|
||||
# To extract a portion of a video, you have to first download the entire file and then use the
|
||||
# `trim-video` or `compress-video' with a time range.
|
||||
#
|
||||
# To download a portion of a stream:
|
||||
# To download a partial stream use one of these commands. We need to reencode to remove extra frames from the start/end with a negative timeline.
|
||||
#
|
||||
# yt-dlp -f "b" --external-downloader ffmpeg --external-downloader-args "ffmpeg_i:-ss 5:25:38.00 -to 5:56:50.00" URL
|
||||
# This reencodes during the download, slightly faster than the next option:
|
||||
# yt-dlp -f "b" --external-downloader ffmpeg --external-downloader-args "ffmpeg_i:-ss 0:7:10.00 -to 0:8:06.00" --external-downloader-args "ffmpeg_o:-c:v libx264 -c:a aac" URL
|
||||
#
|
||||
# Download then re-encode:
|
||||
# yt-dlp -f "b" --external-downloader ffmpeg --external-downloader-args "ffmpeg_i:-ss 5:25:38.00 -to 5:56:50.00" URL -o temp.mp4 ; trim-video-cpu temp.mp4 "FINAL_NAME" 0
|
||||
#
|
||||
download_twitch_vid() {
|
||||
local format="$1"
|
||||
@@ -812,6 +847,7 @@ download_twitch_vid() {
|
||||
if [[ $make_folder == "1" ]]; then cd ..; fi
|
||||
|
||||
printf "${BOLD}Finished downloading ${YELLOW}$filename${NORMAL}\n"
|
||||
flash_taskbar
|
||||
}
|
||||
|
||||
# Download Vimeo videos.
|
||||
@@ -898,6 +934,7 @@ download_vimeo_vid() {
|
||||
if [[ $make_folder == "1" ]]; then cd ..; fi
|
||||
|
||||
printf "${BOLD}Finished downloading ${YELLOW}$filename${NORMAL}\n"
|
||||
flash_taskbar
|
||||
}
|
||||
|
||||
# Download Twitter videos.
|
||||
@@ -966,9 +1003,12 @@ download_twitter_vid() {
|
||||
if [[ $make_folder == "1" ]]; then cd ..; fi
|
||||
|
||||
printf "${BOLD}Finished downloading ${YELLOW}$filename${NORMAL}\n"
|
||||
flash_taskbar
|
||||
}
|
||||
|
||||
# Download Instagram videos.
|
||||
# If the download fails because you need to be authenticated then don't use the cookies arg because IG will flag your
|
||||
# account as a bot and might ban you. Instead, use the instagram download code from private dotfiles.
|
||||
download_instagram_vid() {
|
||||
local transcribe="$1"
|
||||
local make_folder="$2"
|
||||
@@ -1037,6 +1077,7 @@ download_instagram_vid() {
|
||||
if [[ $make_folder == "1" ]]; then cd ..; fi
|
||||
|
||||
printf "${BOLD}Finished downloading ${YELLOW}$filename${NORMAL}\n"
|
||||
flash_taskbar
|
||||
}
|
||||
|
||||
# Download MP4 video.
|
||||
@@ -1060,6 +1101,7 @@ download_mp4() {
|
||||
fi
|
||||
|
||||
mv $temp_name "$filename.mp4"
|
||||
flash_taskbar
|
||||
}
|
||||
|
||||
# Download a stream to mp4. Can be from an m3u8 file, an mpd, etc. Whatever the
|
||||
@@ -1096,6 +1138,7 @@ download_mp4_from_stream() {
|
||||
fi
|
||||
|
||||
printf "${BOLD}Finished downloading ${YELLOW}$filename${NORMAL}\n"
|
||||
flash_taskbar
|
||||
}
|
||||
|
||||
# Same notes from above regarding cookies/headers.
|
||||
@@ -1117,6 +1160,7 @@ download_aac_from_stream() {
|
||||
fi
|
||||
|
||||
printf "${BOLD}Finished downloading ${YELLOW}$filename${NORMAL}\n"
|
||||
flash_taskbar
|
||||
}
|
||||
|
||||
|
||||
@@ -1293,7 +1337,7 @@ function compress_and_normalize_volume() {
|
||||
error "Provide a final file name and optional args for compress-video"
|
||||
return
|
||||
fi
|
||||
compress-video f.mp4 ff $opts ; normalize-volume ff.mp4 "$final_name"
|
||||
compress-video f.mp4 ff $opts ; normalize-volume ff.mp4 "$final_name" ; flash_taskbar
|
||||
}
|
||||
|
||||
alias cvn='compress_and_normalize_volume'
|
||||
@@ -1302,7 +1346,7 @@ alias cvn='compress_and_normalize_volume'
|
||||
# Git
|
||||
####################################################################################################
|
||||
|
||||
if [[ '${platform,,}' == *'ming'* ]]; then
|
||||
if [[ ${platform,,} == *'ming'* ]]; then
|
||||
# Fix a weird mingw 'not a valid identifierline' error.
|
||||
# Got the fix from https://github.com/Alexpux/MSYS2-packages/issues/735#issuecomment-328938800
|
||||
alias git="PATH=/usr/bin git"
|
||||
|
||||
Reference in New Issue
Block a user