This commit is contained in:
inigoortega 2020-04-03 21:44:41 +02:00
parent 656a9b0cbf
commit d19562fa6d
6 changed files with 24 additions and 60 deletions

View File

@ -8,7 +8,7 @@ set fish_color_command 9ce8f8
set fish_color_error 2fc81e
. /usr/share/rosbash/rosfish
. $HOME/.profile
. "$HOME/.alias"
# ALIASES
# alias ll='lsd --group-dirs first --date relative -alh'

View File

@ -37,11 +37,4 @@ export ROS_MASTER_URI='http://localhost:11311'
export ROS_PACKAGE_PATH=/usr/share/ros_packages
export ROS_ROOT=/usr/share/ros
# ALIASES
alias ll='lsd --group-dirs first --date relative -alh'
alias lll='lsd --date relative --group-dirs first -lh'
alias ls='lsd'
alias l='/bin/ls'
alias sc="dash $SCRIPTS/script-run-fzf.sh"
alias se="dash $SCRIPTS/script-edit-fzf.sh"
alias config='/usr/bin/git --git-dir=$HOME/dotfiles/ --work-tree=$HOME'
. "$HOME/.alias"

View File

@ -21,25 +21,21 @@ usage() {
video_upload_date() {
secs="$(date +%s%N)"
fifo="/tmp/wlvfs-fifo$secs"
mkfifo "$fifo"
file_prefix="/tmp/wlvfs$secs-"
youtube-dl -o "$file_prefix%(upload_date)s" -- "$1" 2>/dev/null > "$fifo" &
filename_search_pid="$!"
file=""
while read -r line; do
file=$(echo "$line" | grep 'Destination:')
[ -n "$file" ] && kill -TERM "$filename_search_pid"
done < "$fifo"
youtube-dl -o "$file_prefix%(upload_date)s" -- "$1" 2>/dev/null |
while read -r line; do
file=$(echo "$line" | grep 'Destination:')
[ -n "$file" ] && {
file=$(echo "$file" | cut -d " " -f 3)
[ -n "$file" ] && echo "$file" | grep -q "^$file_prefix" && {
echo "$file" | sed -E "s|$file_prefix|| ; s|([0-9]+)(\.)(.+)|\1|"
rm "$file"*
}
break
}
done
rm "$fifo"
file=$(echo "$file" | cut -d " " -f 3)
[ -n "$file" ] && echo "$file" | grep -q "^$file_prefix" && {
echo "$file" | sed -E "s|$file_prefix|| ; s|([0-9]+)(\.)(.+)|\1|"
rm "$file"*
}
}
while getopts ":uef:" option; do

View File

@ -3,22 +3,21 @@
if [ -z "$1" ]; then
for i in `seq 1 $(cat $FAV_STREAMERS | wc -l)`
do
streamer="$(sed "$i q;d" $FAV_STREAMERS)"
while read -r streamer; do
if [ "$(youtube-dl -e "https://www.twitch.tv/$streamer" 2>/dev/null)" ]
then
online_streamers="$online_streamers\n$streamer"
fi
done
done < "$FAV_STREAMERS"
first_line="$(printf "%b\n" "$online_streamers" | sed "1q;d")"
if [ -z $first_line ]; then
online_streamers="$(printf "%b\n" $online_streamers | sed "1d")"
if [ -z "${online_streamers}" ]; then
notify-send "No Streamers Found" "watch-twitch.sh"
else
online_streamers=$(printf "%b\n" "$online_streamers" | sed "1d")
watch="$(printf "%b\n" "${online_streamers}" | rofi -dmenu -p "Streamer name")"
printf "%b\n" "${online_streamers}" > "$HOME/.local/share/watch-twitch.streams"
fi
watch="$(printf "%b\n" "${online_streamers}" | rofi -dmenu -p "Streamer name")"
else
@ -27,10 +26,5 @@ else
fi
[ -n "$watch" ] && {
if youtube-dl --get-id "https://www.twitch.tv/$watch"; then
dash $TSCRIPTS/watch-video-select-format.sh \
"https://www.twitch.tv/$watch"
else
notify-send "Not Found Streamer:" "$watch"
fi
dash $TSCRIPTS/watch-video-select-format.sh "https://www.twitch.tv/$watch"
}

View File

@ -11,7 +11,7 @@ if [ -z $(printf "No\nYes" | dmenu -i -p "Select Format?") ]; then
$VIDEOPLAYER "$watch"
else
format=$(select_format "$watch")
if [ -n "$format" ]; then
if [ -n "$format" ] && [ "$format" = "Yes" ]; then
$VIDEOPLAYER_SELECT_YTDLFORMAT$format "$watch"
else
$VIDEOPLAYER "$watch"

View File

@ -1,19 +0,0 @@
#!/usr/bin/env sh
select_format() {
youtube-dl -F "$1" | awk '/format code/{p=1;next}{if(p){print}}' |
cut -d ' ' -f 1 | tac | dmenu -i
}
watch="$1"
if [ -z $(printf "No\nYes" | dmenu -i) ]; then
$VIDEOPLAYER "$watch"
else
format=$(select_format "$watch")
if [ -n "$format" ]; then
$VIDEOPLAYER_SELECT_YTDLFORMAT$format "$watch"
else
$VIDEOPLAYER "$watch"
fi
fi