
    3h                     .    S r SSKrSSKJr  S\SS4S jrg)z:Functions to play audio on Windows using native win32 APIs    N   )pr_err	mp3_fnamereturnc                   ^^^ [         R                  S:w  a  [        S5      eSSKJmJnJn  UR                  R                  mUR                  UR                  UR                  /Tl        UR                  Tl        S[        S[        4UU4S jjnUR                  R                   mS[        SS	4U4S
 jjnU" U 5      nU" S5        U" SU S35        U" S5        U" S5        g	)z-Play mp3 file with given path using win32 APIwin32z"Function only available on Windowsr   )create_unicode_bufferwindllwintypes	long_namer   c                 V   > Sn T" U5      nT" XU5      nX:  a  UR                   $ UnM&  )zd
Gets the DOS-safe short path name of a given long path.
http://stackoverflow.com/a/23598461/200291
r   )value)r   output_buf_size
output_bufneeded_get_short_path_name_wr	   s       T/var/www/auris/envauris/lib/python3.13/site-packages/edge_playback/win32_playback.pyget_short_path_name+play_mp3_win32.<locals>.get_short_path_name   s?    
 .?J+I?SF(!'''$O     msgNc                 z   > T" U SSS5      nUS:w  a)  [        SU SU  S35        [        R                  " S5        gg)zSend MCI command stringr   zError z in mciSendString z
. Exiting.r   N)r   sysexit)r   resultmci_send_string_ws     r   mci_send play_mp3_win32.<locals>.mci_send(   sB    "31a0Q;VF8#5cU*EFHHQK r   z	Close AllzOpen "z" Type MPEGVideo Alias theMP3zPlay theMP3 WaitzClose theMP3)r   platformNotImplementedErrorctypesr	   r
   r   kernel32GetShortPathNameWLPCWSTRLPWSTRDWORDargtypesrestypestrwinmmmciSendStringW)	r   r
   r   r   r   mp3_shortnamer   r	   r   s	         @@@r   play_mp3_win32r-      s     ||w!"FGG ?>#__>>'#
 &.^^"%s %s % % 33c d  (	2M[vm_$ABC ^r   )__doc__r   utilr   r)   r-    r   r   <module>r1      s!    @ 
 ,c ,d ,r   