o
    úG§b  ã                   @   sB   d dl Z d dlZddlmZ G dd„ deƒZe d¡Zdd„ ZdS )	é    Né   )Úutilc                       s<   e Zd ZddiZ‡ fdd„Zdd„ Zdd„ Zd	d
„ Z‡  ZS )Ú	Namespacez"http://podlove.org/simple-chaptersZpscc                    s   d| _ tt| ƒ ¡  d S ©NF)Úpsc_chapters_flagÚsuperr   Ú__init__©Úself©Ú	__class__© úD/usr/local/lib/python3.10/dist-packages/feedparser/namespaces/psc.pyr   (   s   zNamespace.__init__c                 C   s4   |   ¡ }d|vrd| _g |d< t |¡|d< d S d S )NÚpsc_chaptersTÚchapters)Ú_get_contextr   r   ÚFeedParserDict)r
   Úattrs_dÚcontextr   r   r   Ú_start_psc_chapters-   s   ýzNamespace._start_psc_chaptersc                 C   s
   d| _ d S r   )r   r	   r   r   r   Ú_end_psc_chapters4   s   
zNamespace._end_psc_chaptersc                 C   sF   | j r!|  |d¡}t|ƒ|d< |  ¡ d }|d  t |¡¡ d S d S )NÚstartZstart_parsedr   r   )r   Z_get_attributeÚ_parse_psc_chapter_startr   Úappendr   r   )r
   r   r   r   r   r   r   Ú_start_psc_chapter7   s   ûzNamespace._start_psc_chapter)	Ú__name__Ú
__module__Ú__qualname__Zsupported_namespacesr   r   r   r   Ú__classcell__r   r   r   r   r   #   s    ÿr   z(^((\d{2}):)?(\d{2}):(\d{2})(\.(\d{3}))?$c                 C   s|   t  | ¡}|d u rd S | ¡ \}}}}}}t|pdƒt|ƒt|ƒt|p$dƒf\}}}}t d|d d |d  | |d ¡S )Nr   é<   iè  )Úformat_ÚmatchÚgroupsÚintÚdatetimeÚ	timedelta)r   ÚmÚ_ÚhÚsÚmsr   r   r   r   C   s   
,&r   )	r$   ÚreÚ r   Úobjectr   Úcompiler    r   r   r   r   r   Ú<module>   s   
