-
Notifications
You must be signed in to change notification settings - Fork 0
/
master-plugin-d
112 lines (108 loc) · 3.87 KB
/
master-plugin-d
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
#!/bin/dash
echo "
PLUGINS of NNN FILE MANAGER
0) EXIT
Converters
1) Media converter such as mp4 to mp3, mpv to mp4, etc...
2) PDF to Image Converter
3) Document converter such as odt to docx, etc...
4) Inkscape to PDF converter
Reducing size, Resizing, Scaling, Cutting, etc...
5) Reducing PDF file size
6) Extracting PDF page[s]
7) Rotating PDF page[s]
8) Extracting/Cutting Video
9) Scaling or resizing Width and Height of Video
Others
10) Changing Default Application to open file[s]
11) Inserting page numbers to PDF file
12) Rsync the file to mshx230i.local
"
read -p "Type the number of your choice: " num
case $num in
0)
exit
;;
1)
echo " input file is ---> $1"
read -p " output file name with extension: " ofn
ffmpeg -i "$1" "$ofn"
;;
2)
echo " input file ---> $1"
read -p " output format [jpeg or png]: " opf
read -p " output file name: " opn
pdftoppm "-$opf" "$1" "$opn"
;;
3)
echo " input file is ---> $1"
read -p " output format extension [docx, xlsx, pptx, etc.]: " ofn
libreoffice --headless --convert-to "$ofn" "$1"
;;
4)
echo " input file is ---> $1"
read -p " output pdf file name WITHOUT extension: " ofn
inkscape --export-type=pdf "$1" --export-filename="$ofn"
;;
5)
echo " input file is ---> $1"
read -p " output file name with extension: " ofn
ps2pdf "$1" "$ofn"
;;
6)
echo " input file is ---> $1"
read -p " page range to be extracted [Eg. 3-7 or 2,5,6-9]: " range
read -p " output file name with extension: " ofn
pdftk "$1" cat "$range" output "$ofn"
;;
7)
echo " input file is ---> $1"
read -p " page range or page[s] to rotate [Eg. 3-7 or 2,5,6-9]: " range
read -p " rotation degree in clockwise [Eg. ease, south, west, left, right, down]: " dd
read -p " output file name with extension: " ofn
pdftk "$1" cat "$range""$dd" output "$ofn"
;;
8)
echo " input file is ---> $1"
read -p " selection range of START [Eg. 00:03:00]: " ss
read -p " selection range of END [Eg. 00:33:00]: " to
read -p " output file name with the same extension: " ofn
ffmpeg -i "$1" -ss "$ss" -to "$to" -c copy "$ofn"
;;
9)
echo " input file is ---> $1"
read -p " output sizes of Width and Height [Eg. -1:720 or -2:720 or 1200:-1 or 1200:-2]: " ops
read -p " output file name with the same extension: " ofn
ffmpeg -i "$1" -vf scale="$ops" "$ofn"
;;
10)
ftype=$(xdg-mime query filetype "$1")
curdef=$(xdg-mime query default $ftype)
notify-send -t 9000 "xdg-mime" "Filetype is $ftype.\nCurrent Default $curdef."
if [ -z $(echo $WAYLAND_DISPLAY) ]; then
# setdef=$(ls /usr/share/applications | rofi -i -mesg "Current: $curdef" -dmenu -p "Select Default")
setdef=$(cat /home/msh/.config/nnn/plugins/desktopfiles | rofi -i -mesg "Current: $curdef" -dmenu -p "Select Default")
else
# setdef=$(ls /usr/share/applications | wofi -S dmenu)
setdef=$(cat /home/msh/.config/nnn/plugins/desktopfiles | wofi -S dmenu)
fi
[ ! -z "$setdef" ] && xdg-mime default "$setdef" "$ftype"
;;
11)
echo " input file is ---> $1"
read -p " type something before page [%Page of %EndPage]: " textbp
read -p " output file name with extension: " ofn
cpdf -add-text "$textbp - Page %Page of %EndPage" -font "Courier" -font-size 12 -bottom 15 "$1" -o "$ofn"
;;
12)
dir=/home/msh/.config/nnn/plugins
ip=$(cat $dir/ip-history | wofi -i -d)
(echo "$ip" && cat $dir/ip-history) | awk '!_[$0]++' | head -n 7 > $dir/ip-history-tmp &&
mv $dir/ip-history-tmp $dir/ip-history
[ -d "$1" ] && rsync -r -P "$1" msh@"$ip":/home/msh/rsyncin/
[ -f "$1" ] && rsync -P "$1" msh@"$ip":/home/msh/rsyncin/
;;
*)
echo "Choose the number of function"
;;
esac