-
Notifications
You must be signed in to change notification settings - Fork 3
/
give_the_start.sh
60 lines (42 loc) · 1.09 KB
/
give_the_start.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
#!/bin/bash
#with this script you give the starting letters of mp4 file to convert in an mp3
DIR=`cat directory.txt` #read directory name from file
function program {
ENTRY=`zenity --entry --text="Give the starting letters of mp4" --title="Convert2mp3"`
if [ $? = 1 ]; then
exit;
fi
cd $DIR;
if [ $(ls "$ENTRY"*.mp4 | wc -l) = 1 ]; then
ls "$ENTRY"* > temp;
RETURN=$(<temp);
zenity --question --text="Right mp4 is $RETURN ?" --title "Convert2mp3"
if [ $? = 0 ]; then
(
echo "10" ; sleep 1;
ffmpeg -i "$RETURN" "$RETURN.mp3";
echo "60" ; sleep 0.5;
echo "90" ; sleep 0.9;
) | zenity --progress \
--title="Convert2mp3" \
--text="Converting..." \
--percentage=0 \
--auto-kill
else
zenity --question --text="Do you want to try again?" --title "Convert2mp3"
if [ $? = 0 ]; then
program;
else
exit;
fi
fi
else
zenity --question --text="File not found! Maybe there are multiple files starting with $ENTRY. Do you want to try again?" --title="Convert2mp3"
if [ $? = 0 ]; then
program;
else
exit;
fi
fi
}
program;