Correcting name in Makefile
This commit is contained in:
commit
3326f08335
2
Makefile
2
Makefile
|
@ -1,3 +1,3 @@
|
||||||
install:
|
install:
|
||||||
mkdir -p $(PREFIX)/bin
|
mkdir -p $(PREFIX)/bin
|
||||||
cp shellcheck lib/* $(PREFIX)/bin/
|
cp shelltube lib/* $(PREFIX)/bin/
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
|
|
||||||
interactive_mode=0
|
interactive_mode=0
|
||||||
channel_file="/tmp/yt-channel_$RANDOM"
|
channel_file="/tmp/$(mktemp -u yt-channel_XXXXX)"
|
||||||
|
|
||||||
# I really need to work out a better way to take flags.
|
# I really need to work out a better way to take flags.
|
||||||
# This is just awful.
|
# This is just awful.
|
||||||
|
@ -51,7 +51,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function get_input() {
|
function get_input() {
|
||||||
printf "\033[0;32m>>>\033[0m "
|
printf '\033[0;32m>>>\033[0m '
|
||||||
read -r n
|
read -r n
|
||||||
|
|
||||||
if [ "$n" == "exit" ]
|
if [ "$n" == "exit" ]
|
||||||
|
@ -82,7 +82,7 @@ function get_input() {
|
||||||
row=0
|
row=0
|
||||||
|
|
||||||
# Now for displaying the search results
|
# Now for displaying the search results
|
||||||
temp_file="/tmp/yt-channel_$RANDOM"
|
temp_file="/tmp/$(mktemp -u yt-channel_XXXXX)"
|
||||||
|
|
||||||
grep "href=\"\/watch?v=" $channel_file | grep "title=" | grep -v \
|
grep "href=\"\/watch?v=" $channel_file | grep "title=" | grep -v \
|
||||||
"<span class=\"yt-thumb-simple\"" > $temp_file
|
"<span class=\"yt-thumb-simple\"" > $temp_file
|
||||||
|
@ -96,24 +96,25 @@ do
|
||||||
|
|
||||||
if [ $row -eq 1 ]
|
if [ $row -eq 1 ]
|
||||||
then
|
then
|
||||||
color='\033[1;34m'
|
#color='\033[1;34m'
|
||||||
color2='\033[1;34m'
|
#color2='\033[1;34m'
|
||||||
|
printf '\033[1;34m'
|
||||||
row=0
|
row=0
|
||||||
elif [ $row -eq 0 ]
|
elif [ $row -eq 0 ]
|
||||||
then
|
then
|
||||||
color='\033[1;31m'
|
#color='\033[1;31m'
|
||||||
color2='\033[1;31m'
|
#color2='\033[1;31m'
|
||||||
|
printf '\033[1;31m'
|
||||||
row=1
|
row=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if echo "$LINE" | grep "View full playlist" > /dev/null
|
if echo "$LINE" | grep "View full playlist" > /dev/null
|
||||||
then
|
then
|
||||||
type="Playlist"
|
type="Playlist"
|
||||||
printf "${color}$item_num. "
|
|
||||||
title=$(echo "$LINE" | sed 's/.*title="//' | sed 's/".*//')
|
title=$(echo "$LINE" | sed 's/.*title="//' | sed 's/".*//')
|
||||||
items=$(echo "$LINE" | sed 's/.*View full playlist (//' | sed 's/).*//')
|
items=$(echo "$LINE" | sed 's/.*View full playlist (//' | sed 's/).*//')
|
||||||
echo -e "${color}$title"
|
printf '%s. %s\n' "$item_num" "$title"
|
||||||
echo -e "${color2}$type | $items | $itemid"
|
printf '%s | %s | %s\n' "$type" "$items" "$itemid"
|
||||||
else
|
else
|
||||||
type="Video"
|
type="Video"
|
||||||
duration=$(echo "$LINE" | sed 's/.*Duration: //' | sed 's/\..*//')
|
duration=$(echo "$LINE" | sed 's/.*Duration: //' | sed 's/\..*//')
|
||||||
|
@ -122,15 +123,15 @@ do
|
||||||
|
|
||||||
if [ $item_num -lt 10 ]
|
if [ $item_num -lt 10 ]
|
||||||
then
|
then
|
||||||
printf "${color}$item_num. "
|
printf '%s. ' "$item_num"
|
||||||
elif [ $item_num -lt 20 ]
|
elif [ $item_num -lt 20 ]
|
||||||
then
|
then
|
||||||
printf "${color}$item_num. "
|
printf '%s. ' "$item_num"
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
echo -e "${color}$title${color2}"
|
echo "$title"
|
||||||
printf " "
|
printf ' '
|
||||||
i=0
|
i=0
|
||||||
while [ $i -lt 9 ]
|
while [ $i -lt 9 ]
|
||||||
do
|
do
|
||||||
|
@ -138,12 +139,12 @@ do
|
||||||
char=$(echo $duration | cut -c$i)
|
char=$(echo $duration | cut -c$i)
|
||||||
if [ -z $char ]
|
if [ -z $char ]
|
||||||
then
|
then
|
||||||
printf " "
|
printf ' '
|
||||||
else
|
else
|
||||||
printf "$char"
|
printf '%s' "$char"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
printf " | $itemid\n"
|
printf ' | %s\n' "$itemid"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ function select_option ()
|
||||||
line=$((line+1))
|
line=$((line+1))
|
||||||
echo "${line}. $i"
|
echo "${line}. $i"
|
||||||
done
|
done
|
||||||
printf "\033[0;32m>>>\033[0m "
|
printf '\033[0;32m>>>\033[0m '
|
||||||
read -r n
|
read -r n
|
||||||
|
|
||||||
if [ "$n" -le "$line" ];
|
if [ "$n" -le "$line" ];
|
||||||
|
|
|
@ -14,14 +14,14 @@ then
|
||||||
id="$(echo $1 | sed 's/.*video_id=//')"
|
id="$(echo $1 | sed 's/.*video_id=//')"
|
||||||
elif [ -z $1 ]
|
elif [ -z $1 ]
|
||||||
then
|
then
|
||||||
"No video specified."
|
echo "No video specified."
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
id="$1"
|
id="$1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
video_file="/tmp/yt-video_$RANDOM"
|
video_file="/tmp/$(mktemp -u yt-video_XXXXX)"
|
||||||
if type "wget" &> /dev/null
|
if type "wget" &> /dev/null
|
||||||
then
|
then
|
||||||
wget -q https://youtube.com/watch?v=$id -O $video_file
|
wget -q https://youtube.com/watch?v=$id -O $video_file
|
||||||
|
|
|
@ -24,7 +24,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function get_input() {
|
function get_input() {
|
||||||
printf "\033[0;32m>>>\033[0m "
|
printf '\033[0;32m>>>\033[0m '
|
||||||
read -r n
|
read -r n
|
||||||
|
|
||||||
if [ "$n" == "exit" ]
|
if [ "$n" == "exit" ]
|
||||||
|
@ -55,12 +55,12 @@ function get_input() {
|
||||||
# layout, this script'll break immediately, haha.
|
# layout, this script'll break immediately, haha.
|
||||||
# ... But at least we aren't using their API, right?
|
# ... But at least we aren't using their API, right?
|
||||||
|
|
||||||
search_file="/tmp/yt-search_$RANDOM"
|
search_file="/tmp/$(mktemp -u yt-search_XXXXX)"
|
||||||
|
|
||||||
st-download https://youtube.com/results?search_query=$query $search_file
|
st-download https://youtube.com/results?search_query=$query $search_file
|
||||||
|
|
||||||
# Now for displaying the search results
|
# Now for displaying the search results
|
||||||
temp_file="/tmp/yt-result_$RANDOM"
|
temp_file="/tmp/$(mktemp -u yt-result_XXXXX)"
|
||||||
grep "<a href=\"\/watch?v=" $search_file | grep -v "<span class=\"yt-thumb-simple\"" > $temp_file
|
grep "<a href=\"\/watch?v=" $search_file | grep -v "<span class=\"yt-thumb-simple\"" > $temp_file
|
||||||
item_num=0
|
item_num=0
|
||||||
cat $temp_file | while IFS='' read -r CUR_LINE
|
cat $temp_file | while IFS='' read -r CUR_LINE
|
||||||
|
@ -73,13 +73,15 @@ do
|
||||||
|
|
||||||
if [ $row -eq 1 ]
|
if [ $row -eq 1 ]
|
||||||
then
|
then
|
||||||
color='\033[1;34m'
|
#color='\033[1;34m'
|
||||||
color2='\033[1;34m'
|
#color2='\033[1;34m'
|
||||||
|
printf '\033[1;34m'
|
||||||
row=0
|
row=0
|
||||||
elif [ $row -eq 0 ]
|
elif [ $row -eq 0 ]
|
||||||
then
|
then
|
||||||
color='\033[1;31m'
|
#color='\033[1;31m'
|
||||||
color2='\033[1;31m'
|
#color2='\033[1;31m'
|
||||||
|
printf '\033[1;31m'
|
||||||
row=1
|
row=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -88,12 +90,12 @@ do
|
||||||
type="Playlist"
|
type="Playlist"
|
||||||
if [ $interactive_mode -eq 1 ]
|
if [ $interactive_mode -eq 1 ]
|
||||||
then
|
then
|
||||||
printf "${color}$item_num. "
|
printf '%s. ' "$item_num"
|
||||||
fi
|
fi
|
||||||
title=$(echo "$LINE" | sed 's/.*title="//' | sed 's/".*//')
|
title=$(echo "$LINE" | sed 's/.*title="//' | sed 's/".*//')
|
||||||
items=$(echo "$LINE" | sed 's/.*View full playlist (//' | sed 's/).*//')
|
items=$(echo "$LINE" | sed 's/.*View full playlist (//' | sed 's/).*//')
|
||||||
echo -e "${color}$title"
|
printf '%s\n' "$title"
|
||||||
echo -e "${color2}$type | $items | $itemid"
|
printf '%s | %s | %s\n' "$type" "$items" "$itemid"
|
||||||
else
|
else
|
||||||
type="Video"
|
type="Video"
|
||||||
duration=$(echo "$LINE" | sed 's/.*Duration: //' | sed 's/\..*//')
|
duration=$(echo "$LINE" | sed 's/.*Duration: //' | sed 's/\..*//')
|
||||||
|
@ -110,12 +112,12 @@ do
|
||||||
|
|
||||||
if [ $item_num -lt 10 ]
|
if [ $item_num -lt 10 ]
|
||||||
then
|
then
|
||||||
printf "${color}$item_num. "
|
printf '%s. ' "$item_num"
|
||||||
else
|
else
|
||||||
printf "${color}$item_num. "
|
printf '%s. ' "$item_num"
|
||||||
fi
|
fi
|
||||||
echo -e "${color}$title${color2}"
|
printf '%s\n' "$title"
|
||||||
printf " "
|
printf ' '
|
||||||
fi
|
fi
|
||||||
i=0
|
i=0
|
||||||
while [ $i -lt 16 ]
|
while [ $i -lt 16 ]
|
||||||
|
@ -124,12 +126,12 @@ do
|
||||||
char=$(echo $author | cut -c$i)
|
char=$(echo $author | cut -c$i)
|
||||||
if [ -z $char ]
|
if [ -z $char ]
|
||||||
then
|
then
|
||||||
printf " "
|
printf ' '
|
||||||
else
|
else
|
||||||
printf "$char"
|
printf '%s' "$char"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
printf " | "
|
printf ' | '
|
||||||
i=0
|
i=0
|
||||||
while [ $i -lt 5 ]
|
while [ $i -lt 5 ]
|
||||||
do
|
do
|
||||||
|
@ -137,14 +139,16 @@ do
|
||||||
char=$(echo $duration | cut -c$i)
|
char=$(echo $duration | cut -c$i)
|
||||||
if [ -z $char ]
|
if [ -z $char ]
|
||||||
then
|
then
|
||||||
printf " "
|
printf ' '
|
||||||
else
|
else
|
||||||
printf "$char"
|
printf '%s' "$char"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
printf " | $itemid\n"
|
printf ' | %s\n' "$itemid"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
printf '\033[0m'
|
||||||
|
|
||||||
if [ $interactive_mode -eq 1 ]
|
if [ $interactive_mode -eq 1 ]
|
||||||
then
|
then
|
||||||
get_input
|
get_input
|
||||||
|
|
10
shelltube
10
shelltube
|
@ -5,8 +5,8 @@
|
||||||
# Date: 2016-12-11
|
# Date: 2016-12-11
|
||||||
# Lisc: ISC
|
# Lisc: ISC
|
||||||
# Main: jadedctrl
|
# Main: jadedctrl
|
||||||
# Desc: Full-shell YT client that
|
# Desc: Full-shell YT client that avoids the YT API.
|
||||||
# avoids the YT API.
|
Vers=0.4
|
||||||
#####################
|
#####################
|
||||||
|
|
||||||
# Roadmap:
|
# Roadmap:
|
||||||
|
@ -43,7 +43,7 @@ channel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
about() {
|
about() {
|
||||||
printf '\033[35mShelltube v0.4\033[m\n'
|
printf '\033[35mShelltube v%s\033[m\n' "$Vers"
|
||||||
printf '\033[32mDesc: \033[0;34mYT client written in shell.\033[m\n'
|
printf '\033[32mDesc: \033[0;34mYT client written in shell.\033[m\n'
|
||||||
printf '\033[32mMain: \033[0;34mjadedml@openmailbox.org\033[m\n'
|
printf '\033[32mMain: \033[0;34mjadedml@openmailbox.org\033[m\n'
|
||||||
printf '\033[32mLisc: \033[0;34mISC; yt-down GPLv2\033[m\n'
|
printf '\033[32mLisc: \033[0;34mISC; yt-down GPLv2\033[m\n'
|
||||||
|
@ -121,8 +121,6 @@ parse() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
printf '\n \033[1mshell\033[41m Tube \033[0;1;30m v%s\033[m\n\n' 0.3
|
|
||||||
|
|
||||||
if [ "$#" -gt 0 ]
|
if [ "$#" -gt 0 ]
|
||||||
then
|
then
|
||||||
for arg in "$@"
|
for arg in "$@"
|
||||||
|
@ -130,6 +128,8 @@ then
|
||||||
parse "${arg%% *}" "${arg#* }"
|
parse "${arg%% *}" "${arg#* }"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
|
printf '\n \033[1mshell\033[41m Tube \033[0;1;30m v%s\033[m\n\n' "$Vers"
|
||||||
|
|
||||||
while printf '\033[0;34m%s \033[0;32m>>\033[m ' "$selected_video"
|
while printf '\033[0;34m%s \033[0;32m>>\033[m ' "$selected_video"
|
||||||
do
|
do
|
||||||
read -r command argument
|
read -r command argument
|
||||||
|
|
Reference in New Issue