-
Notifications
You must be signed in to change notification settings - Fork 0
/
linkopenwithoutx
executable file
·45 lines (44 loc) · 933 Bytes
/
linkopenwithoutx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
# a script to handle different links, when open from terminal without X
if echo "$1" | grep -e \.mp3$ -e \.mp4$ -e \.m4v$
then
mpv --vo=drm --no-osc -no-audio-display "$1"
elif echo "$1" | grep -e youtube
then
mpv --vo=drm --no-osc "$1"
elif echo "$1" | grep -e youtu.be
then
LINK="$(curl -Is "$1" | sed -n 's#Location: ##p' )"
echo "$LINK"
mpv --vo=drm --no-osc "$LINK"
elif echo "$1" | grep -e \.jpg$ -e \.JPG$ -e \.jpeg$ -e \.png$
then
DIR="/tmp/newspics"
if [ ! -e $DIR ]
then
mkdir $DIR
chmod 0755 $DIR
else
rm -f $DIR/*
fi
DOWN="$1 -P $DIR"
wget "$DOWN"
BILD="${1##*/}"
fbv "$DIR"/"$BILD"
elif echo "$1"| grep -e \.gif$
then
DIR="/tmp/newgifs"
if [ ! -e $DIR ]
then
mkdir $DIR
chmod 0755 $DIR
else
rm -f $DIR/*
fi
DOWN="$1 -P $DIR"
wget "$DOWN"
BILD="${1##*/}"
mpv --vo=drm --loop -a "$DIR"/"$BILD"
else
w3m "$1"
fi