-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrar2zip.sh
45 lines (29 loc) · 800 Bytes
/
rar2zip.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
#!/bin/bash
FILERAR=$1
BASEDIR=`pwd`
FILEPATH=`dirname "$FILERAR"`
FILENAMEFULL=`basename "$FILERAR"`
FILENAME="${FILENAMEFULL%.*}"
FILEEXT="${FILENAMEFULL##*.}"
TMPDIR=$FILENAME
if [ $FILEEXT == 'cbr' ]
then
FILEZIPEXT='cbz'
else
FILEZIPEXT='zip'
fi
FILEZIP="${BASEDIR}/${FILENAME}.$FILEZIPEXT"
dbusRef=`kdialog --title rar2zip --progressbar "Converting \"$FILERAR\" to ZIP\n\nplease wait" 10`
qdbus $dbusRef showCancelButton false
mkdir "$TMPDIR"
qdbus $dbusRef Set "" value 1
rar e "$FILERAR" "$TMPDIR"
qdbus $dbusRef Set "" value 4
cd "$TMPDIR"
zip -9 "$FILEZIP" *
qdbus $dbusRef Set "" value 9
cd "$BASEDIR"
rm -rf "$TMPDIR"
qdbus $dbusRef Set "" value 10
qdbus $dbusRef close
kdialog --title rar2zip --msgbox "Converting \"$FILERAR\" to ZIP\n\nDone\n\nCreated $FILEZIP"