diff --git a/.config/fish/config.fish b/.config/fish/config.fish index c579e6d..a673f6d 100644 --- a/.config/fish/config.fish +++ b/.config/fish/config.fish @@ -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' diff --git a/.profile b/.profile index 90edefe..916772b 100644 --- a/.profile +++ b/.profile @@ -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" diff --git a/scripts/watch-last-videos-from-subs.sh b/scripts/watch-last-videos-from-subs.sh index 500cbed..d9eea70 100644 --- a/scripts/watch-last-videos-from-subs.sh +++ b/scripts/watch-last-videos-from-subs.sh @@ -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 diff --git a/scripts/watch-twitch.sh b/scripts/watch-twitch.sh index acd95bd..65c5d97 100644 --- a/scripts/watch-twitch.sh +++ b/scripts/watch-twitch.sh @@ -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" } diff --git a/termscripts/watch-video-select-format.sh b/termscripts/watch-video-select-format.sh index d87ac72..113ba25 100644 --- a/termscripts/watch-video-select-format.sh +++ b/termscripts/watch-video-select-format.sh @@ -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" diff --git a/xhelperscripts/watch-video-select-format.sh b/xhelperscripts/watch-video-select-format.sh deleted file mode 100644 index a81f8e1..0000000 --- a/xhelperscripts/watch-video-select-format.sh +++ /dev/null @@ -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