@@ -89,31 +89,32 @@ gstreamer_libs=(
89
89
# ##############################
90
90
91
91
log () {
92
- echo " [ $( date ' +%Y-%m-%d %H:%M:%S' ) ] [ $1 ] $2 "
92
+ printf " \e[0;37m[%s] \e[0m[%s] %b " " $( date ' +%Y-%m-%d %H:%M:%S' ) " " $1 " " $2$3 "
93
93
}
94
94
info () {
95
- log " INFO" " $1 "
95
+ log " INFO" " \e[0m " " $1 \n "
96
96
}
97
97
error () {
98
- log " ERROR" " $1 "
98
+ log " ERROR" " \e[0;31m " " $1 \n "
99
99
}
100
-
101
- root_check () {
102
- if [[ " $EUID " -ne 0 ]]; then
103
- error " This tool needs root access (please run 'sudo -i' before proceeding)."
104
- exit 1
105
- fi
100
+ success () {
101
+ log " SUCCESS" " \e[0;32m" " $1 \n"
106
102
}
107
103
108
104
welcome_motd () {
109
105
info " ffmpeg-patcher v$version "
110
106
111
- download " $repo_base_url /$branch /motd.txt" /tmp/tmp.wget
107
+ download " motd" " $repo_base_url /$branch /motd.txt" /tmp/tmp.wget
108
+ log " Message of the day" " \033[1;33m" " \n\n$( cat /tmp/tmp.wget) \n\n"
109
+
110
+ sleep 3
111
+ }
112
112
113
- log " Message of the day"
114
- echo " "
115
- cat /tmp/tmp.wget
116
- echo " "
113
+ root_check () {
114
+ if [[ " $EUID " -ne 0 ]]; then
115
+ error " This tool needs root access (please run 'sudo -i' before proceeding)."
116
+ exit 1
117
+ fi
117
118
}
118
119
119
120
check_dependencies () {
@@ -164,16 +165,20 @@ clean() {
164
165
}
165
166
166
167
download () {
167
- wget -q -O - " $1 " > /tmp/temp.wget
168
+ log " INFO" " \e[0m" " Downloading $1 ... "
169
+
170
+ wget -q -O - " $2 " > /tmp/temp.wget
168
171
downloadStatus=$?
169
172
170
173
if [[ $downloadStatus == 0 ]]; then
171
- mv -f /tmp/temp.wget " $2 "
174
+ mv -f /tmp/temp.wget " $3 "
175
+ printf " \e[0;32mDone\n"
172
176
else
173
- error " An error occurred while downloading $1 . Rolling back changes..."
177
+ printf " \e[0;31mError\n"
178
+ error " An error occurred while downloading $2 . Rolling back changes..."
174
179
unpatch
175
180
176
- error " An error occurred while downloading $1 , every changes were rolled back."
181
+ error " An error occurred while downloading $2 , every changes were rolled back."
177
182
error " Please check your internet connection / GithubStatus. If you think this is an error, please file an issue to the repository."
178
183
exit 1
179
184
fi
@@ -198,8 +203,7 @@ patch() {
198
203
info " Saving current $filename script as $filename .orig"
199
204
mv -n " $vs_base_path /scripts/$filename " " $vs_base_path /scripts/$filename .orig"
200
205
201
- info " Downloading $filename script..."
202
- download " $repo_base_url /$branch /scripts/$filename .sh" " $vs_base_path /scripts/$filename "
206
+ download " $filename .sh" " $repo_base_url /$branch /scripts/$filename .sh" " $vs_base_path /scripts/$filename "
203
207
204
208
info " Injecting script variables..."
205
209
repo_full_url=" $repo_base_url /$branch "
@@ -214,8 +218,7 @@ patch() {
214
218
info " Saving current $filename as $filename .orig"
215
219
mv -n " $vs_path /bin/$filename " " $vs_path /bin/$filename .orig"
216
220
217
- info " Downloading and installing $filename 's wrapper..."
218
- download " $repo_base_url /$branch /wrappers/$filename .sh" " $vs_path /bin/$filename "
221
+ download " $filename .sh" " $repo_base_url /$branch /wrappers/$filename .sh" " $vs_path /bin/$filename "
219
222
chown root:VideoStation " $vs_path /bin/$filename "
220
223
chmod 750 " $vs_path /bin/$filename "
221
224
chmod u+s " $vs_path /bin/$filename "
@@ -240,17 +243,15 @@ patch() {
240
243
info " Downloading gstreamer plugins..."
241
244
242
245
for plugin in " ${gstreamer_plugins[@]} " ; do
243
- info " Downloading $plugin to gstreamer directory..."
244
- download " $repo_base_url /$branch /plugins/$plugin .so" " $vs_path /lib/gstreamer/gstreamer-1.0/$plugin .so"
246
+ download " Gstreamer plugin: $plugin " " $repo_base_url /$branch /plugins/$plugin .so" " $vs_path /lib/gstreamer/gstreamer-1.0/$plugin .so"
245
247
done
246
248
247
249
mkdir -p " $vs_path /lib/gstreamer/dri"
248
250
mkdir -p " $vs_path /lib/gstreamer/x264-10bit"
249
251
mkdir -p " $vs_path /lib/gstreamer/x265-10bit"
250
252
251
253
for lib in " ${gstreamer_libs[@]} " ; do
252
- info " Downloading $lib to gstreamer directory..."
253
- download " $repo_base_url /$branch /libs/$lib " " $vs_path /lib/gstreamer/$lib "
254
+ download " Gstreamer library: $lib " " $repo_base_url /$branch /libs/$lib " " $vs_path /lib/gstreamer/$lib "
254
255
done
255
256
256
257
info " Saving current GSTOmx configuration..."
@@ -260,8 +261,10 @@ patch() {
260
261
cp -n " $cp_path /etc/gstomx.conf" " $vs_path /etc/gstomx.conf"
261
262
fi
262
263
264
+ download " patch_config.sh" " $repo_base_url /$branch /patch_config.sh" " $vs_base_path /patch_config.sh"
265
+
263
266
info " Setting ffmpeg version to: ffmpeg$ffmpegversion "
264
- sed -i -e " s/@ffmpeg_version@/ffmpeg$ffmpegversion /" " $vs_path /bin/ffmpeg "
267
+ sed -i -e " s/@ffmpeg_version@/ffmpeg$ffmpegversion /" " $vs_base_path /patch_config.sh "
265
268
266
269
info " Saving current libsynovte.so as libsynovte.so.orig"
267
270
cp -n " $libsynovte_path " " $libsynovte_path .orig"
@@ -273,8 +276,7 @@ patch() {
273
276
restart_packages
274
277
clean
275
278
276
- echo " "
277
- info " Done patching, you can now enjoy your movies ;) (please add a star to the repo if it worked for you)"
279
+ success " Done patching, you can now enjoy your movies ;) (please add a star to the repo if it worked for you)"
278
280
}
279
281
280
282
unpatch () {
@@ -327,11 +329,13 @@ unpatch() {
327
329
fi
328
330
fi
329
331
332
+ info " Remove patch config."
333
+ rm -f " $vs_base_path /patch_config.sh"
334
+
330
335
restart_packages
331
336
clean
332
337
333
- echo " "
334
- info " unpatch complete"
338
+ success " Unpatch complete"
335
339
}
336
340
337
341
# ###############################
0 commit comments