Added ytube and mu-search

master
Steven Saus 4 years ago
parent ec5d1136e2
commit bec5fba385
  1. 5
      README.md
  2. 9
      mu-search.sh
  3. 0
      topcpu.sh
  4. 0
      topmem.sh
  5. 104
      ytube

@ -1,6 +1,11 @@
# multiple_scripts
Multiple scripts that are useful but don't deserve their own repository.
## ytube.sh
A wrapper for youtube-dl to make easier (and automate) some things.
## briefing.sh
Used along with Podfox to create a daily briefing without involving

@ -0,0 +1,9 @@
#!/bin/bash
echo "Search for? (subject: to: from: body: cc: bcc:)"
read search
# In case I forget and put commas, or put a space after the colon
search=$(echo "$search" | sed 's/: /:/' | sed 's/,/ /')
# There are no quotes around the variable here ON PURPOSE
mu find --clearlinks --skip-dups --include-related --threads --format=links --linksdir=~/.mu/results $search
echo "Searching..... press F9 to move to that mailbox"

104
ytube

@ -0,0 +1,104 @@
#!/bin/bash
ACTION=""
GUI=""
##############################################################################
# Show help on cli
##############################################################################
display_help() {
echo "usage: thuit.sh [-h][-n][-e][-b][-x][-c]"
echo " "
echo "optional arguments:"
echo " -h show this help message and exit"
echo " -u Video URL"
echo " -c Get URL from clipboard"
echo " -v Download video"
echo " -a Download audio"
echo " -p Play video natively"
echo " -g GUI feedback"
exit
}
#TODO - make listen option as well
#TODO - if error, try updating youtube-dl first, lol
while [ $# -gt 0 ]; do
option="$1"
case $option
in
http*)
URL="$1"
shift
;;
-h) display_help
shift
;;
-c)
URL=$(xclip -o)
shift
;;
-u) shift
URL="$1"
shift
;;
-g) GUI=TRUE
shift
;;
-v) #download video=1
ACTION="VIDEO"
shift
;;
-a) #download audio
ACTION="AUDIO"
shift
;;
-p) #play video
ACTION="PLAY"
shift
;;
esac
done
#TODO - ADD IN DOWNLOAD PLAYLIST OPTION
#TODO - re-implement batch file list input
#TODO - MAKE SO TUI is default
if [[ "$URL" = "" ]];then
URL=$(zenity --timeout 30 --entry --text "What is the YouTube URL?" --entry-text "")
if [[ "$URL" = "" ]];then
display_help
fi
fi
#TODO - MAKE SO TUI is default
if [[ "$ACTION" = "" ]];then
ACTION=$(zenity --timeout 30 --list --column "Pick" --column "Opinion" --text "Which action?" --radiolist TRUE "VIDEO" FALSE "AUDIO" FALSE "BOTH" FALSE "PLAY");
if [[ "$ACTION" = "" ]];then
display_help
fi
fi
case "$ACTION" in
VIDEO)
if [ ! -z "$GUI" ];then
ionice -c 3 youtube-dl "$URL" --netrc --ignore-errors --cookies /home/steven/vault/cookies.txt --write-thumbnail --mark-watched --continue --write-description --no-playlist --no-overwrites --restrict-filenames --no-check-certificate -o '/home/steven/downloads/videos/%(title)s-%(autonumber)s.%(ext)s' | tee >(zenity --progress --pulsate --auto-close --auto-kill)
else
ionice -c 3 youtube-dl "$URL" --netrc --ignore-errors --cookies /home/steven/vault/cookies.txt --write-thumbnail --mark-watched --continue --write-description --no-playlist --no-overwrites --restrict-filenames --no-check-certificate -o '/home/steven/downloads/videos/%(title)s-%(autonumber)s.%(ext)s'
fi
;;
AUDIO)
if [ ! -z "$GUI" ];then
ionice -c 3 youtube-dl "$URL" -x --netrc --ignore-errors --write-description --cookies /home/steven/vault/cookies.txt --no-check-certificate --embed-thumbnail --prefer-ffmpeg --no-playlist --mark-watched --continue --audio-format mp3 -o '/home/steven/downloads/mp3/%(title)s:%(uploader)s:%(upload_date)s.%(ext)s' --rate-limit 1M --restrict-filenames | tee >(zenity --progress --pulsate --auto-close --auto-kill)
else
ionice -c 3 youtube-dl "$URL" -x --netrc --ignore-errors --write-description --cookies /home/steven/vault/cookies.txt --no-check-certificate --embed-thumbnail --prefer-ffmpeg --no-playlist --mark-watched --continue --audio-format mp3 -o '/home/steven/downloads/mp3/%(title)s:%(uploader)s:%(upload_date)s.%(ext)s' --rate-limit 1M --restrict-filenames
fi
;;
PLAY)
mpv "$szAnswer"
;;
esac
Loading…
Cancel
Save