Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/twisted/protocols/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/twisted/protocols/__pycache__/shoutcast.cpython-310.pyc
o

�b�
�@s2dZddlmZddlmZGdd�dej�ZdS)z@
Chop up shoutcast stream into MP3s and metadata, if available.
�)�	copyright)�httpc@s|eZdZdZdejZddd�Zdd�Zdd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�ZdS)�ShoutcastClientz�
    Shoutcast HTTP stream.

    Modes can be 'length', 'meta' and 'mp3'.

    See U{http://www.smackfu.com/stuff/programming/shoutcast.html}
    for details on the protocol.
    zTwisted Shoutcast client �/cCs"||_d|_d|_d|_d|_dS)NF�mp3�)�path�got_metadata�metaint�metamode�
databuffer)�selfr�r�=/usr/lib/python3/dist-packages/twisted/protocols/shoutcast.py�__init__s

zShoutcastClient.__init__cCs4|�d|j�|�d|j�|�dd�|��dS)N�GETz
User-AgentzIcy-MetaData�1)�sendCommandr�
sendHeader�	userAgent�
endHeaders�r
rrr�connectionMadeszShoutcastClient.connectionMadecCs>|js|rt|�dd��dkr|�ddd�}tj�||�dS)Nz: ��:)�	firstLine�len�split�replacer�
HTTPClient�lineReceived)r
�linerrrr %s
zShoutcastClient.lineReceivedcCs$|��dkrt|�|_d|_dSdS)Nzicy-metaintT)�lower�intr
r	)r
�key�valuerrr�handleHeader,s

�zShoutcastClient.handleHeadercCs|jr	|j|_dS|j|_dS)N)r	� handleResponsePart_with_metadata�handleResponsePart�
gotMP3Datarrrr�handleEndHeaders1sz ShoutcastClient.handleEndHeaderscCs<|j|7_|jrt|d|j��}|rdS|js
dSdS)Nz	handle_%s)r�getattrr)r
�data�stoprrrr';s�z0ShoutcastClient.handleResponsePart_with_metadatacCs.t|jd�d|_|jdd�|_d|_dS)Nr�r�meta)�ordr�	remainingrrrrr�
handle_lengthBs
zShoutcastClient.handle_lengthcCsFt|j�|jkr!|�|jd|j��|j|jd�|_d|_dSdS)N�lengthr)rrr
r)rrrrr�
handle_mp3Gs

zShoutcastClient.handle_mp3cCsVt|j�|jkr)|jr|jd|j�}|�|�|��|j|jd�|_d|_dSdS)Nrr)rrr1�gotMetaData�
parseMetadatar�r
r,rrr�handle_metaOs
zShoutcastClient.handle_metacCslg}|�d�D],}|���dd�}|sq|�dd�\}}|�d�r,|�d�r,|dd�}|�||f�q|S)N�;�r�=r�'���)r�stripr�
startswith�endswith�append)r
r,r/�chunkr$r%rrrr6YszShoutcastClient.parseMetadatacC�td��)z�Called with a list of (key, value) pairs of metadata,
        if metadata is available on the server.

        Will only be called on non-empty metadata.
        �implement in subclass��NotImplementedError)r
�metadatarrrr5eszShoutcastClient.gotMetaDatacCrC)zCalled with chunk of MP3 data.rDrEr7rrrr)mszShoutcastClient.gotMP3DataN)r)�__name__�
__module__�__qualname__�__doc__r�versionrrrr r&r*r'r2r4r8r6r5r)rrrrrs
	


rN)rK�twistedr�twisted.webrrrrrrr�<module>s

Spamworldpro Mini