Basic config support
This commit is contained in:
parent
63de22e9c4
commit
2fa5a7d3b5
4
Makefile
4
Makefile
|
@ -1,3 +1,3 @@
|
||||||
|
PREFIX=/usr/local
|
||||||
install:
|
install:
|
||||||
mkdir -p $(PREFIX)/bin
|
install -m 0755 shelltube lib/* $(PREFIX)/bin/
|
||||||
cp shelltube lib/* $(PREFIX)/bin/
|
|
||||||
|
|
|
@ -10,14 +10,15 @@
|
||||||
# Cxu ne?
|
# Cxu ne?
|
||||||
#####################
|
#####################
|
||||||
|
|
||||||
|
if test -z $download_cmd
|
||||||
|
then
|
||||||
if type "wget" &> /dev/null
|
if type "wget" &> /dev/null
|
||||||
then
|
then
|
||||||
wget -q "$1" -O "$2"
|
wget -q "$1" -O "$2"
|
||||||
elif type "curl" &> /dev/null
|
elif type "curl" &> /dev/null
|
||||||
then
|
then
|
||||||
curl -s "$1" -o "$2"
|
curl -s "$1" -o "$2"
|
||||||
else
|
fi
|
||||||
echo "Please install wget or curl."
|
else
|
||||||
sleep 2
|
$download_cmd
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
20
lib/st-video
20
lib/st-video
|
@ -9,20 +9,20 @@
|
||||||
# dsfgbvesrht fd
|
# dsfgbvesrht fd
|
||||||
#####################
|
#####################
|
||||||
|
|
||||||
|
if [ -e $HOME/.config/shelltube ]
|
||||||
|
then
|
||||||
|
. $HOME/.config/shelltube
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -z $player_cmd
|
||||||
|
then
|
||||||
if type "vlc" &> /dev/null
|
if type "vlc" &> /dev/null
|
||||||
then
|
then
|
||||||
vlc "${1}"
|
vlc "${1}"
|
||||||
elif type "mplayer" &> /dev/null
|
elif type "mplayer" &> /dev/null
|
||||||
then
|
then
|
||||||
mplayer "${1}"
|
mplayer "${1}"
|
||||||
elif type "kaffeine" &> /dev/null
|
|
||||||
then
|
|
||||||
kaffeine "${2}"
|
|
||||||
else
|
|
||||||
sleep 2
|
|
||||||
echo "Please install either vlc, mplayer, or kaffeine."
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
# Mi sxatas iom da komputoro
|
$player_cmd "${1}"
|
||||||
# ... sed, gxi estas tre bona kaj mojosas
|
fi
|
||||||
|
|
|
@ -10,6 +10,12 @@
|
||||||
|
|
||||||
# Usage: yt-channel.sh [-uci] userid||channel
|
# Usage: yt-channel.sh [-uci] userid||channel
|
||||||
|
|
||||||
|
if [ -e $HOME/.config/shelltube ]
|
||||||
|
then
|
||||||
|
. $HOME/.config/shelltube
|
||||||
|
else
|
||||||
|
results=21
|
||||||
|
fi
|
||||||
|
|
||||||
interactive_mode=0
|
interactive_mode=0
|
||||||
channel_file="/tmp/$(mktemp -u yt-channel_XXXXXX)"
|
channel_file="/tmp/$(mktemp -u yt-channel_XXXXXX)"
|
||||||
|
@ -113,22 +119,33 @@ do
|
||||||
type="Playlist"
|
type="Playlist"
|
||||||
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/).*//')
|
||||||
printf '%s. %s\n' "$item_num" "$title"
|
if [ $item_num -ge $((results+1)) ]
|
||||||
printf '%s | %s | %s\n' "$type" "$items" "$itemid"
|
then
|
||||||
|
break
|
||||||
|
elif [ $item_num -lt 10 ]
|
||||||
|
then
|
||||||
|
printf '%s. ' "$item_num"
|
||||||
|
else
|
||||||
|
printf '%s. ' "$item_num"
|
||||||
|
fi
|
||||||
|
printf '%s' "$title"
|
||||||
|
printf ' '
|
||||||
|
printf '%s | %s' "$type" "$items"
|
||||||
|
printf ' '
|
||||||
else
|
else
|
||||||
type="Video"
|
type="Video"
|
||||||
duration=$(echo "$LINE" | sed 's/.*Duration: //' | sed 's/\..*//')
|
duration=$(echo "$LINE" | sed 's/.*Duration: //' | sed 's/\..*//')
|
||||||
itemid=$(echo "$LINE" | sed 's/.*href="\/watch?v=//' | sed 's/".*//')
|
itemid=$(echo "$LINE" | sed 's/.*href="\/watch?v=//' | sed 's/".*//')
|
||||||
title=$(echo "$LINE" | sed 's/.* title="//' | sed 's/".*//')
|
title=$(echo "$LINE" | sed 's/.* title="//' | sed 's/".*//')
|
||||||
|
|
||||||
if [ $item_num -lt 10 ]
|
if [ $item_num -ge $((results+1)) ]
|
||||||
then
|
then
|
||||||
printf '%s. ' "$item_num"
|
break
|
||||||
elif [ $item_num -lt 20 ]
|
elif [ $item_num -lt 10 ]
|
||||||
then
|
then
|
||||||
printf '%s. ' "$item_num"
|
printf '%s. ' "$item_num"
|
||||||
else
|
else
|
||||||
break
|
printf '%s. ' "$item_num"
|
||||||
fi
|
fi
|
||||||
echo "$title"
|
echo "$title"
|
||||||
printf ' '
|
printf ' '
|
||||||
|
@ -153,5 +170,6 @@ then
|
||||||
get_input
|
get_input
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
printf '\033[0m'
|
||||||
|
|
||||||
rm $temp_file
|
rm $temp_file
|
||||||
|
|
14
lib/yt-down
14
lib/yt-down
|
@ -100,19 +100,7 @@ cat /tmp/tmp6.txt | sed -e 's/%25/%/g' -e 's/%25/%/g' -e 's/%3A/:/g' -e 's/%2F/\
|
||||||
|
|
||||||
if [ $stream_mode -eq 1 ]
|
if [ $stream_mode -eq 1 ]
|
||||||
then
|
then
|
||||||
if type "vlc" &> /dev/null
|
st-video $(cat /tmp/tmp7.txt)
|
||||||
then
|
|
||||||
vlc $(cat /tmp/tmp7.txt)
|
|
||||||
elif type "mplayer" &> /dev/null
|
|
||||||
then
|
|
||||||
mplayer $(cat /tmp/tmp7.txt)
|
|
||||||
elif type "kaffeine" &> /dev/null
|
|
||||||
then
|
|
||||||
kaffeine $(cat /tmp/tmp7.txt)
|
|
||||||
else
|
|
||||||
echo "Please install either vlc, mplayer, or kaffeine."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
if type "wget" &> /dev/null
|
if type "wget" &> /dev/null
|
||||||
then
|
then
|
||||||
|
|
|
@ -10,7 +10,13 @@
|
||||||
|
|
||||||
# Usage: yt-search.sh "$search_string"
|
# Usage: yt-search.sh "$search_string"
|
||||||
|
|
||||||
# Bloody input...
|
if [ -e $HOME/.config/shelltube ]
|
||||||
|
then
|
||||||
|
. $HOME/.config/shelltube
|
||||||
|
else
|
||||||
|
results=21
|
||||||
|
fi
|
||||||
|
|
||||||
row=0
|
row=0
|
||||||
|
|
||||||
if [ "$1" == "-i" ]
|
if [ "$1" == "-i" ]
|
||||||
|
@ -88,14 +94,21 @@ do
|
||||||
if echo "$LINE" | grep "View full playlist" > /dev/null
|
if echo "$LINE" | grep "View full playlist" > /dev/null
|
||||||
then
|
then
|
||||||
type="Playlist"
|
type="Playlist"
|
||||||
if [ $interactive_mode -eq 1 ]
|
|
||||||
then
|
|
||||||
printf '%s. ' "$item_num"
|
|
||||||
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/).*//')
|
||||||
|
if [ $item_num -ge $((results+1)) ]
|
||||||
|
then
|
||||||
|
break
|
||||||
|
elif [ $item_num -lt 10 ]
|
||||||
|
then
|
||||||
|
printf '%s. ' "$item_num"
|
||||||
|
else
|
||||||
|
printf '%s. ' "$item_num"
|
||||||
|
fi
|
||||||
printf '%s\n' "$title"
|
printf '%s\n' "$title"
|
||||||
printf '%s | %s | %s\n' "$type" "$items" "$itemid"
|
printf ' '
|
||||||
|
printf '%s | %s\n' "$type" "$items"
|
||||||
|
printf ' '
|
||||||
else
|
else
|
||||||
type="Video"
|
type="Video"
|
||||||
duration=$(echo "$LINE" | sed 's/.*Duration: //' | sed 's/\..*//')
|
duration=$(echo "$LINE" | sed 's/.*Duration: //' | sed 's/\..*//')
|
||||||
|
@ -110,7 +123,10 @@ do
|
||||||
author=$(echo "$LINE" | sed 's/.*\/user\///' | sed 's/".*//')
|
author=$(echo "$LINE" | sed 's/.*\/user\///' | sed 's/".*//')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $item_num -lt 10 ]
|
if [ $item_num -ge $((results+1)) ]
|
||||||
|
then
|
||||||
|
break
|
||||||
|
elif [ $item_num -lt 10 ]
|
||||||
then
|
then
|
||||||
printf '%s. ' "$item_num"
|
printf '%s. ' "$item_num"
|
||||||
else
|
else
|
||||||
|
|
10
shelltube
10
shelltube
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# Name: shelltube.sh
|
# Name: shelltube.sh
|
||||||
# Date: 2016-12-11
|
|
||||||
# Lisc: ISC
|
# Lisc: ISC
|
||||||
# Main: jadedctrl
|
# Main: jadedctrl
|
||||||
# Desc: Full-shell YT client that avoids the YT API.
|
# Desc: Full-shell YT client that avoids the YT API.
|
||||||
|
@ -17,10 +16,15 @@
|
||||||
# [ ] Channel & Playlist search
|
# [ ] Channel & Playlist search
|
||||||
# [ ] Search filters
|
# [ ] Search filters
|
||||||
# [ ] Search & Channel sort-by
|
# [ ] Search & Channel sort-by
|
||||||
# [ ] Config video player, etc
|
# [X] Config video player, etc
|
||||||
# [ ] Overall better interface
|
# [ ] Overall better interface
|
||||||
# [ ] Cli args as commands
|
# [ ] Cli args as commands
|
||||||
|
|
||||||
|
if [ -e $HOME/.config/shelltube ]
|
||||||
|
then
|
||||||
|
. $HOME/.config/shelltube
|
||||||
|
fi
|
||||||
|
|
||||||
search() {
|
search() {
|
||||||
output="$(mktemp -u /tmp/yt_XXXXXX)"
|
output="$(mktemp -u /tmp/yt_XXXXXX)"
|
||||||
yt-search -i "$1" "$output"
|
yt-search -i "$1" "$output"
|
||||||
|
@ -79,7 +83,7 @@ parse() {
|
||||||
search "$argument"
|
search "$argument"
|
||||||
;;
|
;;
|
||||||
/* )
|
/* )
|
||||||
search "${command#/}"
|
search "${command#/} $argument"
|
||||||
;;
|
;;
|
||||||
channel )
|
channel )
|
||||||
channel "$argument"
|
channel "$argument"
|
||||||
|
|
Reference in New Issue