-
Notifications
You must be signed in to change notification settings - Fork 0
/
qpiano-timidity
executable file
·271 lines (247 loc) · 8.78 KB
/
qpiano-timidity
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
#!/bin/sh
# This script runs pinobooster with timidity
# It supports ALSA only
# TiMidity in Debian compilled without Libao mode -OO, using ALSA pcm device instead -Os
# License: same with QPiano
# Author: Alexey Loginov <[email protected]>
MES1="Error: timidity was not found or broken!"
MES2="Error: timidity does not have -OO or -Os options!"
MES3="Error: timidity does not have -iA option!"
MES4="Error: qpiano was not found!"
MES5="Error: timidity does not have -OO option!"
MES6="Error: timidity does not have -Os option!"
MES7="Libao mode is disabled!"
MES8="ALSA PCM device mode is disabled!"
MES9="Libao mode and ALSA PCM device mode are disabled!"
MES10="Error: timidity was not run!"
MES11="Sorry, but JACK is not supported yet!"
use_jack="0"
if [ -f ~/.config/QPiano/"QPiano.ini" ]
then
cp -f ~/.config/QPiano/"QPiano.ini" ~/.config/QPiano/QPiano.ini
sed -i '/\[/d' ~/.config/QPiano/QPiano.ini
sed -i '/^$/d' ~/.config/QPiano/QPiano.ini
sed -i "s|=|=\'|g" ~/.config/QPiano/QPiano.ini
sed -i "s|$|\'|g" ~/.config/QPiano/QPiano.ini
sed -i "s|''|'|g" ~/.config/QPiano/QPiano.ini
sed -i "s|'\"='\"'|'='|g" ~/.config/QPiano/QPiano.ini
. ~/.config/QPiano/QPiano.ini 2>/dev/null
rm -f ~/.config/QPiano/QPiano.ini
fi
lang=`echo $LANGUAGE|cut -d ":" -f 2`
if [ -z "$lang" ]
then
lang=`echo $LANG|cut -d "." -f 1`
if [ ! "$lang" = "pt_BR" ] && [ ! "$lang" = "bs_BA" ] && [ ! "$lang" = "zh_HK" ]
then
lang=`echo $LANG|cut -d "_" -f 1`
fi
fi
case $lang in
ru|be)
MES1="Ошибка: timidity не был найден, или он неработоспособен!"
MES2="Ошибка: timidity не имеет опций -OO или -Os!"
MES3="Ошибка: timidity не имеет опции -iA!"
MES4="Ошибка: qpiano не был найден!"
MES5="Ошибка: timidity не имеет опции -OO!"
MES6="Ошибка: timidity не имеет опции -Os!"
MES7="Режим Libao отключен!"
MES8="Режим устройства ALSA PCM отключен!"
MES9="Режим Libao и режим устройства ALSA PCM отключены!"
MES10="Ошибка: timidity не был запущен!"
MES11="Извините, но JACK ещё не поддерживается!"
;;
fr)
MES1="Erreur : timidity n’a pas été trouvé ou est cassé !"
MES2="Erreur : timidity n’a pas les options -OO ou -Os !"
MES3="Erreur : timidity n’a pas l’option -iA !"
MES4="Erreur : qpiano n’a pas été trouvé !"
MES5="Erreur : timidity n’a pas l’option -OO !"
MES6="Erreur : timidity n’a pas l’option -Os !"
MES7="Le mode Libao est désactivé !"
MES8="Le mode Périphérique ALSA PCM est désactivé !"
MES9="Les modes Libao et périphérique ALSA PCM sont désactivés !"
MES10="Erreur : timidity n’a pas été démarré !"
MES11="Désolé, JACK n’est pas encore supporté !"
;;
fi)
MES4="Virhe: qpiano ei löytynyt!"
MES10="Virhe: timidity ei toimi!"
;;
de)
MES1="Fehler: timidity wurde nicht gefunden oder ist beschädigt!"
MES2="Fehler: timidity unterstützt keine -OO oder -Os Option!"
MES3="Fehler: timidity unterstützt keine -iA Option!"
MES4="Fehler: qpiano wurde nicht gefunden!"
MES5= "Fehler: timidity unterstützt keine -OO Option!"
MES6= "Fehler: timidity unterstützt keine -Os Option!"
MES7="Libao Modus ist deaktiviert!"
MES8="ALSA PCM Gerätemodus ist deaktiviert!"
MES9="Libao Mouds und ALSA PCM Gerätemodus sind deaktiviert!"
MES10="Fehler: Timidity wurde nicht ausgeführt!"
MES11="Entschuldigung, aber JACK wird noch nicht unterstützt!"
;;
gl)
MES1="Erro: Non se atopou Timidity ou está quebrado"
MES2="Erro: Timidity non ten as opcións -OO ou -Os"
MES3="Erro: Timidity non ten a opción -iA"
MES10="Erro: o timidity non foi executado!"
;;
pl)
MES1="Błąd: timidity nie został znaleziony lub jest uszkodzony!"
MES2="Błąd: timidity nie posiada opcji -OO lub -Os "
MES3="Błąd: timidity nie posiada opcji -iA "
MES4="Błąd: qpiano nie został znaleziony!"
MES5="Błąd: timidity nie posiada opcji -OO "
MES6="Błąd: timidity nie posiada opcji -Os "
MES7="Tryb Libao jest wyłączony!"
MES8="Tryb urządzenia ALSA PCM jest wyłączony!"
MES9="Tryb Libao i tryb urządzenia ALSA PCM jest wyłączony!"
MES10="Błąd: timidity nie został uruchomiony!"
MES11="Wybacz, ale JACK nie jest jeszcze obsługiwany!"
;;
uk)
MES1="Помилка: timidity не знайдено або дані програми пошкоджено!"
MES2="Помилка: у timidity немає параметрів -OO або -Os!"
MES3="Помилка: у timidity немає параметра -iA!"
MES4="Помилка: qpiano не знайдено!"
MES10="Помилка: timidity не запущено!"
;;
cs)
MES1="Chyba: timidity nebylo nalezeno anebo je poškozeno!"
MES2="Chyba: timidity nemá volby -OO nebo -Os"
MES3="Chyba: timidity nemá volbu -iA!"
MES4="Chyba: qpiano nebyl nalezen!"
MES5="Chyba: timidity nemá volbu -OO!"
MES6="Chyba: timidity nemá volbu -Os!"
MES7="Režim Libao je zakázán!"
MES8="Režim zařízení ALSA PCM je zakázán!"
MES9="Režim Libao a režim zařízení ALSA PCM jsou zakázány!"
MES10="Chyba: timidity nebyl spuštěn!"
MES11="Promiňte, ale JACK ještě není podporován!"
;;
bg)
MES10="Грешка: Не намирам timidity!"
sv)
MES1="Fel: timidity hittades inte eller är skadad!"
MES2="Fel: timidity har inte -OO eller -Os alternativ!"
MES3="Fel: timidity har inte -iA alternativ!"
MES4="Fel: qpiano hittades inte!"
;;
esac
notify_send=`notify-send -v 2>/dev/null`
timidity=`timidity -v 2>/dev/null`
qpiano=`qpiano -v 2>/dev/null`
if [ -z "$qpiano" ]
then
echo "$MES4"
if [ ! -z "$notify_send" ]
then
notify-send -a qpiano -i qpiano "QPiano" "$MES4"
fi
exit 1
fi
if [ -z "$timidity" ]
then
timidity=`timidity -h 2>/dev/null`
fi
if [ -z "$timidity" ]
then
echo "$MES1"
if [ ! -z "$notify_send" ]
then
notify-send -a qpiano -i qpiano "QPiano" "$MES1"
fi
exit 1
fi
alsa=`timidity -help|grep '\-iA'`
LibaoMode=`timidity -help|grep '\-OO'`
PcmDevice=`timidity -help|grep '\-Os'`
if [ "$timidityAlsa" = "false" ]
then
use_jack="1"
fi
if [ "$use_jack" = "0" ] && [ -z "$LibaoMode" ] && [ "$timidityLibaoMode" = "true" ]
then
echo "$MES5" "$MES7"
if [ ! -z "$notify_send" ]
then
notify-send -a qpiano -i qpiano "QPiano" "$MES5 $MES7"
fi
sed -i "s|timidityLibaoMode=.*|timidityLibaoMode=false|g" ~/.config/QPiano/"QPiano.ini" 2>/dev/null
timidityLibaoMode="false"
fi
if [ "$use_jack" = "0" ] && [ -z "$PcmDevice" ] && [ "$timidityPcmDevice" = "true" ]
then
echo "$MES6" "$MES8"
if [ ! -z "$notify_send" ]
then
notify-send -a qpiano -i qpiano "QPiano" "$MES6 $MES8"
fi
sed -i "s|timidityPcmDevice=.*|timidityPcmDevice=false|g" ~/.config/QPiano/"QPiano.ini" 2>/dev/null
timidityPcmDevice="false"
fi
if [ "$use_jack" = "0" ] && [ "$timidityLibaoMode" = "false" ] && [ "$timidityPcmDevice" = "true" ]
then
LibaoMode=""
PcmDevice="1"
fi
if [ "$use_jack" = "0" ] && [ "$timidityLibaoMode" = "true" ] && [ "$timidityPcmDevice" = "false" ]
then
LibaoMode="1"
PcmDevice=""
fi
if [ "$use_jack" = "0" ] && [ "$timidityLibaoMode" = "false" ] && [ "$timidityPcmDevice" = "false" ]
then
LibaoMode=""
PcmDevice=""
echo "$MES9" "$MES10"
if [ ! -z "$notify_send" ]
then
notify-send -a qpiano -i qpiano "QPiano" "$MES9 $MES10"
fi
qpiano
exit 0
fi
if [ "$use_jack" = "0" ]
then
if [ ! -z "$alsa" ]
then
if [ ! -z "$LibaoMode" ]
then
timidity -iA -OO &
else
if [ ! -z "$PcmDevice" ]
then
timidity -iA -Os &
else
echo "$MES2" "$MES10"
if [ ! -z "$notify_send" ]
then
notify-send -a qpiano -i qpiano "QPiano" "$MES2 $MES10"
fi
qpiano
exit 0
fi
fi
else
echo "$MES3" "$MES10"
if [ ! -z "$notify_send" ]
then
notify-send -a qpiano -i qpiano "QPiano" "$MES3 $MES10"
fi
qpiano
exit 0
fi
else
echo "$MES11" "$MES10"
if [ ! -z "$notify_send" ]
then
notify-send -a qpiano -i qpiano "QPiano" "$MES11 $MES10"
fi
qpiano
exit 0
fi
PID=$!
qpiano
kill $PID