U
    Mf                     @   sL   d dl mZ ddlmZmZmZmZmZmZm	Z	m
Z
mZ G dd deZdS )   )InfoExtractor   )	float_or_noneint_or_none
orderedSetparse_iso8601parse_qsparse_resolutionstr_or_nonetraverse_objurl_or_nonec                   @   s   e Zd ZdZddddddddd	d
dddgdgddddddddddddddgdgdddd d!d"d#dgZeed$d%d&Zed'd( Zd)d* Z	d+S ),EpidemicSoundIEz@https?://(?:www\.)?epidemicsound\.com/track/(?P<id>[0-9a-zA-Z]+)z/https://www.epidemicsound.com/track/yFfQVRpSPz/Z d98ff2ddb49e8acab9716541cbc9dfacZ45014Z
yFfQVRpSPzZmp3zDoor Knock Door 1ZfoleyZdoorZknockZglassZwindowzglass door knockz
Misc. Doorr   zghttps://cdn.epidemicsound.com/curation-assets/commercial-release-cover-images/default-sfx/3000x3000.jpgi!\TZ20141107)id
display_idexttitle	alt_titletags
categoriesduration	thumbnail	timestampupload_date)urlmd5Z	info_dictz/https://www.epidemicsound.com/track/mj8GTTwsZd/Z c82b745890f9baf18dc2f8d568ee3830Z148700Z
mj8GTTwsZdZNoplacezliquid drum n bassZ	energeticzdrum and bass   irdzahttps://cdn.epidemicsound.com/curation-assets/commercial-release-cover-images/11138/3000x3000.jpgZ20230911i6\eZ20231121)r   r   r   r   r   r   r   r   r   r   release_timestampZrelease_dater   c                 C   sB   t | sd S d| it| thddthfddthfdfp>t| S )Nr   width    height)r   r    )r   r   r   r   r	   r    r!   B/tmp/pip-unpacked-wheel-zk9bgjdq/yt_dlp/extractor/epidemicsound.py_epidemic_parse_thumbnail4   s     


z)EpidemicSoundIE._epidemic_parse_thumbnailc                 C   sx   |  ds|  d| d< n|  ds0| d | d< | d r@| d sDd S |  dr`d| d  | d< | d dkrtd| d< | S )	Nformat	format_idr   format_notez	track ID fullZ
preference)get)fr!   r!   r"   _epidemic_fmt_or_noneA   s    


z%EpidemicSoundIE._epidemic_fmt_or_nonec                    s  |  |}| d| |}t|dg t|ddthf}|rZ t|ddd|jhf t|dthfdthfd	thfd
thfdthfdt	hfdt	hfdddthfddthfddd hf fddht
hd| jhfdtjhddthfddthfddthfddthfd| jhfdS )Nz)https://www.epidemicsound.com/json/track/)ZimageUrlZcoverZcoverArtZbaseUrlZsizes.r   Z
publicSlugr   ZoldTitlelengthaddedZreleaseDateZgenrestagZmetadataTagsZ
isExplicitc                 S   s   | rdS d S )N   r!   )br!   r!   r"   <lambda>c       z/EpidemicSoundIE._real_extract.<locals>.<lambda>c                    s    S )Nr!   )_
thumbnailsr!   r"   r1   d   r2   Zstemsr   r   Z	s3TrackIdZstemTypeZlqMp3Url)r$   r&   r%   r   )r   r   r   r   r   r   r   r   r   Z	age_limitr5   formats)Z	_match_idZ_download_jsonr   r   extend__add__r
   strr   r   r   r#   dictitemsr+   )selfr   Zvideo_idZ	json_dataZthumb_base_urlr!   r4   r"   _real_extractO   s@    
   




zEpidemicSoundIE._real_extractN)
__name__
__module____qualname__Z
_VALID_URLZ_TESTSstaticmethodr9   r#   r+   r=   r!   r!   r!   r"   r      sL   #
r   N)commonr   utilsr   r   r   r   r   r	   r
   r   r   r   r!   r!   r!   r"   <module>   s   ,