
    Mg"                     h    S SK r S SKrS SKJrJr  \" SS9\" S5       " S S5      5       5       r S rg)    N)pluginrequireT)networklyricsc                   4    \ rS rSrSrS rS r\S 5       rSr	g)r   	   z
finds lyrics
the format is song,artist
song and artist are separated by a -
-- Example:
    lyrics wonderful tonight-eric clapton
c                 D    UR                  U R                  U5      5        g N)sayfind)selfjarvisss      </Users/admin/workspace/ai/Jarvis/jarviscli/plugins/lyrics.py__call__lyrics.__call__   s    

499Q<     c                 &   U R                  U5      nS nS nS nU(       a  US   nUR                  S5        U(       a  US   nUR                  S5        U(       a  US   nUR                  S5        U(       a  U(       d  g[        X45      nU(       a  U$ g)Nr   z1you forgot to add either song name or artist namez=Song or Singer does not exist or the API does not have lyrics)parsepop	get_lyric)r   r   infoartistsongalbumresponses          r   r   lyrics.find   s    zz!}
 7DHHQK!WFHHQKGEHHQK6FV*ORr   c                 (    UR                  S5      nU$ )N-)split)r   r   informations      r   r   lyrics.parse7   s     ggclr    N)
__name__
__module____qualname____firstlineno____doc__r   r   classmethodr   __static_attributes__r#   r   r   r   r   	   s&    !S8  r   c                    U R                  SS5      n UR                  SS5      nSR                  X5      n[        R                  " U5      n[        R
                  " UR                  S5      nUR                  SSS05      nUc  g U" S5       Vs/ s H  ofR                  5       PM       nUR                  S	 S
9nS H+  nUR                  U5       H  n	U	R                  5         M     M-     [        U5      R                  SS5      R                  SS5      SS n
 U
$ s  snf ! [         a    U
R                  S5      s $ f = f)N _zhttp://lyrics.wikia.com/{0}:{1}lxmldivclasslyricboxscriptc                 6    [        U [        R                  5      $ r
   )
isinstancebs4Commenttexts    r   <lambda>get_lyric.<locals>.<lambda>U   s    
40Mr   r7   )r/   iba
 z<br/>   izutf-8)replaceformatrequestsgetr5   BeautifulSoupr8   r   extractfindAllreplaceWithChildrenstrBaseExceptionencode)singerr   urlreqr   r   kcommentstagmatchoutputs              r   r   r   G   s'   ^^C%F<<S!D
+
2
26
@C
,,s
C#((F+AVVEGZ01F~ *+*QYY[*+~~#M~NH &^^C(E%%' ) & [  r*227DA"RIF&% ,&  &}}W%%&s   DD! !D?>D?)rC   r5   r   r   r   r   r#   r   r   <module>rT      sD     
 "
 	0 0  0f &r   