-
Notifications
You must be signed in to change notification settings - Fork 13
/
easy_concat_list_maker.sh
123 lines (96 loc) · 3.9 KB
/
easy_concat_list_maker.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
#--------------------------------------------------------------------------------------------------
# _ _ _ _____ __ __ ____ __ _ _________ __
# | | | | | / ____| / / \ \ / / \/ | | |__ __\ \ / /
# | |__| | | | (___ / / \ V /| \ / | | | | \ \ / /
# | __ | | \___ \ / / > < | |\/| | | | | \ \/ /
# | | | | |____ ____) | / / / . \| | | | |____| | \ /
# |_| |_|______|_____/ /_/ /_/ \_\_| |_|______|_| \/
#
#
# _ _ ____ __ __ ______ ____ _____ ____ _____ _____ _____ _______ _____ _ _ _____
# | | | |/ __ \| \/ | ____| | _ \| __ \ / __ \ /\ | __ \ / ____| /\ / ____|__ __|_ _| \ | |/ ____|
# | |__| | | | | \ / | |__ | |_) | |__) | | | | / \ | | | | | / \ | (___ | | | | | \| | | __
# | __ | | | | |\/| | __| | _ <| _ /| | | |/ /\ \ | | | | | / /\ \ \___ \ | | | | | . ` | | |_ |
# | | | | |__| | | | | |____ | |_) | | \ \| |__| / ____ \| |__| | |____ / ____ \ ____) | | | _| |_| |\ | |__| |
# |_| |_|\____/|_| |_|______| |____/|_| \_\\____/_/ \_\_____/ \_____/_/ \_\_____/ |_| |_____|_| \_|\_____|
#
# Easy Concat List Maker Scipt.
#
#
# HLS / XMLTV Home broadcasting : https://github.com/deanochips/HLS-XMLTV---Home-Broadcasting
#
# AUTHOR DATE DETAILS
# --------------------- --------------- --------------------------------
# Dean Butler 2020-01-05 Initial version
# --------------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------
# define folder locations
# --------------------------------------------------------------------------------------------------
cd $(dirname ${BASH_SOURCE[0]})
source ./config.cfg
shopt -s extglob
menu_items() {
M=0 # start loop counter
for args in $CHANNELS_DIR/*; do
echo " "$M") ""$(basename "${args}" )"
M=$((M + 1)) # loop counter
done
}
countdown () {
sleep 1 && ${ECHO} -ne "5..."
sleep 1 && ${ECHO} -ne "4..."
sleep 1 && ${ECHO} -ne "3..."
sleep 1 && ${ECHO} -ne "2..."
sleep 1 && ${ECHO} -ne "1"
}
action() {
M=0 # start loop counter
for args in $CHANNELS_DIR/*; do
if [ "$1" == "$M" ];
then
SHOWNAME=$(basename "${args}" | sed -r "s| |_|g")
find "$args" -name '*.mkv' -o -name '*.mp4' -o -name '*.avi' -o -name '*.m4v' -o -name '*.mov'|while read fname; do
FULLPATH=$(realpath "$fname")
FFMPEG_COMPAT_FILE=$(echo $FULLPATH | sed -e "s/'/'\\\''/g" | sed "s|-|'\\\-'|g" )
echo -ne "file '" >> "$TMP_TVLISTS_DIR""/""$SHOWNAME"".txt";
echo -ne "$FFMPEG_COMPAT_FILE" >> "$TMP_TVLISTS_DIR""/""$SHOWNAME"".txt";
echo "'" >> "$TMP_TVLISTS_DIR""/""$SHOWNAME"".txt";
done
sort "$TMP_TVLISTS_DIR""/""$SHOWNAME"".txt" > "$CONCAT_LIST_DIR""/""$SHOWNAME"".txt"
echo "$CONCAT_LIST_DIR""/""$SHOWNAME"".txt Created"
sleep 2
rm "$TMP_TVLISTS_DIR""/""$SHOWNAME"".txt"
fi
M=$((M + 1)) # loop counter
done
countdown
clear
unset $SPLASH_RUN_YET
load_splash_screen
}
show_menus() {
sleep 0.01 && ${ECHO} "$green "
printf -v _hr "%*s" $(tput cols) && echo ${_hr// /-}
sleep 0.01 && ${ECHO} -ne "$BGreen "
echo -ne "\033[1mEASY CONCAT LIST MAKER\033"
sleep 0.01 && ${ECHO} "$green "
printf -v _hr "%*s" $(tput cols) && echo ${_hr// /-}
echo ""
menu_items
echo ""
echo "CTRL-C to Exit"
echo ""
}
read_options(){
printf -v _hr "%*s" $(tput cols) && echo ${_hr// /-}
local choice
read -p "Enter choice: " choice
action $choice
}
while true
do
show_menus
read_options
done
shopt -u extglob