forked from grakshith/fterm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvplay.sh
executable file
·57 lines (47 loc) · 1.41 KB
/
vplay.sh
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
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
source config.cfg
figlet -f script "Your Videos"
curl -s -X GET \
"https://graph.facebook.com/v2.2/me/videos/uploaded/?fields=source,length,title,created_time,permalink_url&access_token=$access_token">vjson.data
length=$(jq -r ".data | length" vjson.data)
if [ $length -eq 0 ]; then
echo "Sorry no videos to display!"
exit 0
fi
if [ -d "fbvideos"]; then
.
else
mkdir fbvideos
fi
for((i=0;i<$length;i++))
do
#jq -r ".data[$i]" vjson.data
title="$(jq -r ".data[$i].title" vjson.data)"
vlength="$(jq -r ".data[$i].length" vjson.data)"
link="$(jq -r ".data[$i].permalink_url" vjson.data)"
cr_time="$(jq -r ".data[$i].created_time" vjson.data)"
source="$(jq -r ".data[$i].source" vjson.data)"
if [ "$title" != "null" ]
then
echo "Video Title : " $(jq -r ".data[$i].title" vjson.data)
#if the json data does not bear a file name then print the Videolink
else
echo "Video Link : " $(jq -r ".data[$i].permalink_url" vjson.data)
fi
if [ "$vlength" != "null" ]
then
echo "Video Length : " $(jq -r ".data[$i].length" vjson.data)"seconds"
fi
if [ "$cr_time" != "null" ]
then
echo "Video created on : " $(jq -r ".data[$i].created_time" vjson.data)"seconds"
fi
if [ "$source" != "null" ]
then
wget -q -O fbvideos/"$i.mp4" "$(jq -r ".data[$i].source" vjson.data)"
timeout $(echo "$vlength+$delay_time"|bc)s xdg-open fbvideos/"$i.mp4" #$delay_time input from config.cfg
fi
#clear
printf "\n\n"
done
#rm vjson.data