
    V|h(                         S SK Jr  SSKJrJrJr  SSKJr   " S S\5      r " S S\5      r	 " S	 S
\	5      r
 " S S\	5      r " S S\	5      r " S S\	5      rg)   )InfoExtractor   )int_or_noneunified_timestampurl_or_none)traverse_objc                   r    \ rS rSrSrSSSSSSS	/S
S/SS/SSSS.
S.SSSSSSS// SS/SSSS.
S./rS rSrg)IdagioTrackIE   zRhttps?://(?:www\.)?app\.idagio\.com/recordings/\d+\?(?:[^#]+&)?trackId=(?P<id>\d+)z;https://app.idagio.com/recordings/30576934?trackId=30576943 15148bd71804b2450a2508931a116b5630576943mp3zTheme. AndanteR   Edward ElgarVasily Petrenko&Royal Liverpool Philharmonic Orchestra
OrchestralOther Orchestral Musice\20190405)
idexttitleduration	composersartistsgenrestrack	timestampupload_date)urlmd5	info_dictzJhttps://app.idagio.com/recordings/20514467?trackId=20514478&utm_source=pcl 3acef2ea0feadf889123b70e5a1e7fa720514478zI. Adagio sostenutoi<  zLudwig van BeethovenKeyboardzSonata (Keyboard)i|Z20180208c                    U R                  U5      nU R                  SU 3USSS9n[        US5      S:X  a  U R                  5         U R                  SU 3USS	S
S.S9nSSU[        US[        145      S.[        USSS[
        14SS[        SS914SS[
        14S[        14SS[
        14SSS[
        1[        4SSSSS[
        1[        [        [        4	SSSSS[
        1[        4S .45      E$ )!Nz,https://api.idagio.com/v2.0/metadata/tracks/Fi  )fatalexpected_status
error_codezidagio.error.blocked.locationz*https://api.idagio.com/v1.8/content/track/02zweb-4)qualityformatclient_type)queryr   noner!   )r   vcodecr   r!   resultpiecer   	recording
created_at  scalelocationr   	conductor)	ensembles.)soloists.nameworkpartworkcomposergenresubgenre)r   r   r;   r   r   r   r   r   )		_match_id_download_jsonr   raise_geo_restrictedr   strr   filterall)selfr!   track_id
track_infocontent_infos        Q/home/james-whalen/.local/lib/python3.13/site-packages/yt_dlp/extractor/idagio.py_real_extractIdagioTrackIE._real_extract(   sO   >>#&((:8*EE3 ) 8
 
L15TT%%'**8
CX& +  u{m.DE	

 :!7SE2)<+D:Q9RS(*se<'+7!7SE2')]_ehkglntu%z6:vPSuV\^acij"J8MwY\X]_ef	3 	( 	
 	
     N)__name__
__module____qualname____firstlineno__
_VALID_URL_TESTSrR   __static_attributes__rU   rT   rQ   r
   r
      s    fJL1%())+ST#%=>%#%
  \1*01!#67*#%
F@
rT   r
   c                   (    \ rS rSrSrSrS rS rSrg)IdagioPlaylistBaseIEJ   zESubclasses must set _API_URL_TMPL and define _parse_playlist_metadatar   c              #      #    [        USS 45       H-  nUS   nUS   S   nU R                  SU SU 3[        US9v   M/     g 7f)Ntracksc                 *    US   =(       a    US   S   $ )Nr   r6   rU   )_vs     rQ   <lambda>/IdagioPlaylistBaseIE._entries.<locals>.<lambda>O   s    aPTgNnZ[\gZhimZnNnrT   r   r6   z"https://app.idagio.com/recordings/z	?trackId=)ievideo_id)r   
url_resultr
   )rM   playlist_info
track_datarN   recording_ids        rQ   _entriesIdagioPlaylistBaseIE._entriesN   sa     &}xAn6opJ!$'H%k248L//4\N)H:V 8 " 5 5 qs   AAc                     U R                  U5      nU R                  U R                  R                  U5      U5      S   nSSU R                  USU R                  U5      0U R                  U5      E$ )Nr4   _typeplaylistentries)rG   rH   _API_URL_TMPLr/   _PLAYLIST_ID_KEYrm   _parse_playlist_metadata)rM   r!   playlist_idrj   s       rQ   rR   "IdagioPlaylistBaseIE._real_extractV   s    nnS)++%%k2KAAIK Z!!;t}}]3
 ++M:	
 	
rT   rU   N)	rV   rW   rX   rY   __doc__rt   rm   rR   r\   rU   rT   rQ   r^   r^   J   s    O5

rT   r^   c                   N    \ rS rSrSrSSSS/SS/S	S
/SSSSS.	SS./rSrS rSrg)IdagioRecordingIEc   zRhttps?://(?:www\.)?app\.idagio\.com/recordings/(?P<id>\d+)(?![^#]*[&?]trackId=\d+)z*https://app.idagio.com/recordings/3057693430576934z&Variations on an Original Theme op. 36r   r   r   r   r   r   r   )	r   r   r   r   r   r   modified_timestampmodified_dater       r!   r#   playlist_countz2https://api.idagio.com/v2.0/metadata/recordings/{}c                     [        USS[        14S[        SS914S[        SS914S[        14SS[        14SS	S[        1[        4SS
S[        14SS[        14S.5      $ )NrB   r   r7   r8   r9   r;   r<   r@   rC   rD   tags.)r   r   r}   r;   r   r   r   r   )r   rJ   r   rL   rM   rj   s     rQ   ru   *IdagioRecordingIE._parse_playlist_metadatav   s    Mgu-&4)@(AB#/+D2I1J"K#cU+LfWZV[\ *fseSA4guES3%(	,
 	 		rT   rU   N	rV   rW   rX   rY   rZ   r[   rs   ru   r\   rU   rT   rQ   rz   rz   c   sW    fJ;=())+ST#%=>#",'%

  F IM
rT   rz   c                   v    \ rS rSrSrSSSSSS/ S	QS
SSSS.
SS.SSSSSSS// SQSSSSS.SS./rSrSrS rS r	g!)"IdagioAlbumIE   z9https?://(?:www\.)?app\.idagio\.com/albums/(?P<id>[\w-]+)zWhttps://app.idagio.com/albums/elgar-enigma-variations-in-the-south-serenade-for-stringsz$a9f139b8-f70d-4b8a-a9a4-5fe8d35eaf9cz9elgar-enigma-variations-in-the-south-serenade-for-stringsz<Elgar: Enigma Variations, In the South, Serenade for Strings zHhttps://idagio-images.global.ssl.fastly.net/albums/880040420521/main.jpg)r   r   r   i `\20190329g  HA20190708)
r   
display_idr   description	thumbnailr   r   r    r}   r~      r   z_https://app.idagio.com/albums/brahms-ein-deutsches-requiem-3B403DF6-62D7-4A42-807B-47173F3E0192z$2862ad4e-4a61-45ad-9ce4-7fcf0c2626fezAbrahms-ein-deutsches-requiem-3B403DF6-62D7-4A42-807B-47173F3E0192zBrahms: Ein deutsches RequiemzIhttps://idagio-images.global.ssl.fastly.net/albums/3149020954522/main.jpgzrecent-release)zSabine Devieilheu   Stéphane Degoutu   Raphaël Pichon	PygmalionzJohannes BrahmsiLh20251010ih)r   r   r   r   r   r   r   r   r    r}   r~      z.https://api.idagio.com/v2.0/metadata/albums/{}r   c                     [        US[        14S[        14S[        14S[        14S[        14S[        14SSS	[        14S
S[        14S.5      $ )Nr   r   publishDatelastModifiedimageUrlr   participants.r@   r   )r   r   r   r}   r   r   r   r   )r   rJ   r   r   r   s     rQ   ru   &IdagioAlbumIE._parse_playlist_metadata   so    M#-u%'*;)<=#14E3F"G${m4)C51&VcU;S3%(	,
 	 		rT   rU   N
rV   rW   rX   rY   rZ   r[   rs   rt   ru   r\   rU   rT   rQ   r   r      s    MJh8UScd#%".'
   q8]4d%&r#%",'
 F@ EM#
rT   r   c                   D    \ rS rSrSrSSSSSSS	/S
.SS./rSrSrS rSr	g)IdagioPlaylistIE   zIhttps?://(?:www\.)?app\.idagio\.com/playlists/(?!personal/)(?P<id>[\w-]+)zIhttps://app.idagio.com/playlists/beethoven-the-most-beautiful-piano-musicz$31652bec-8c5b-460e-a3f0-cf1f69817f53z(beethoven-the-most-beautiful-piano-musicz)Beethoven: the most beautiful piano musicz$md5:d41bb04b8896bb69377f5c2cd9345ad1zFre:https://.+/playlists/31652bec-8c5b-460e-a3f0-cf1f69817f53/main\.jpgIDAGIO)r   r   r   r   r   creators   )r!   r#   playlist_mincountz(https://api.idagio.com/v2.0/playlists/{}r   c                 x    [        US[        14S[        14S[        14S[        14SS[        1[        4S.5      $ )Nr   r   r   r   curatorr@   )r   r   r   r   r   )r   rJ   r   rL   r   s     rQ   ru   )IdagioPlaylistIE._parse_playlist_metadata   sK    M#-u%${m4)C51"FSE37,
  	rT   rU   Nr   rU   rT   rQ   r   r      sF    ]JZ8D@Ab!

   F ?M#rT   r   c            
       D    \ rS rSrSrSSSS/SSS	S
SS.SS./rSrS rSrg)IdagioPersonalPlaylistIE   zHhttps?://(?:www\.)?app\.idagio\.com/playlists/personal/(?P<id>[\da-f-]+)zNhttps://app.idagio.com/playlists/personal/99dad72e-7b3a-45a4-b216-867c08046ed8z$99dad72e-7b3a-45a4-b216-867c08046ed8Testz$1a6f16a6-4514-4d0c-b481-3a9877835626z%re:https://.+/artists/86371/main\.jpgi_ih2020101620250819)r   r   r   r   r   r}   r    r~   d   r   z1https://api.idagio.com/v1.0/personal-playlists/{}c                     [        US[        14S[        14S[        1[        4S[	        SS914S[	        SS914S.5      $ )	Nr   	image_urluser_idr7   r8   r9   
updated_at)r   r   r   r   r}   )r   rJ   r   rL   r   r   s     rQ   ru   1IdagioPersonalPlaylistIE._parse_playlist_metadata   sV    Mu%%}5"SE3/&4)@(AB#/+D2I1J"K,
  	rT   rU   Nr   rU   rT   rQ   r   r      sH    \J_8?@A#",%'	
  F HMrT   r   N)commonr   utilsr   r   r   utils.traversalr   r
   r^   rz   r   r   r   rU   rT   rQ   <module>r      sb    ! ? ? *A
M A
H
= 
2, @/( /d+ 63 rT   