
    _Og5                     n    S r SSKJrJrJrJr  SSKJr  SSKJ	r	  SSK
JrJrJrJrJrJr   " S S\5      rg)	zV
This module provides the Movie class, used to store information about
a given movie.
    )absolute_importdivisionprint_functionunicode_literals)deepcopy)linguistics)
_Containeranalyze_titlebuild_titlecanonicalTitle	cmpMoviesflattenc                      \ rS rSrSrSr0 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_SS_SS_S S!S"S#SS$S$S$S%S&S'S&S(.ErS)rS!r\	r
S* rS+ rS, rS- rS. rS<S0 jrS1 rS2 rS3 rS4 rS5 r\rS6 rS7 rS8 rS9 rS: rS;rg/)=Movie   a(  A Movie.

Every information about a movie can be accessed as::

    movieObject['information']

to get a list of the kind of information stored in a
Movie object, use the keys() method; some useful aliases
are defined (as "casting" for the "casting director" key); see
the keys_alias dictionary.
)mainplotztv scheduleairingzuser ratingratingplot summaryr   zplot summarieszdirected bydirector	directorswriterswriteractorscast	actressesakaakaszalso known ascountry	countrieszproduction countryzproduction countriesgenregenresruntimeruntimeslang	languagesz
color info	cover urlfull-size cover urlznumber of seasonscertificatesznumber of episodesfaqstech)colorcoverzfull-size coverseasonslanguagecertificatecertificationscertificationzepisodes numberfaq	technicalzfrequently asked questions)r   triviazalternate versionsgoofsquotesdvd	laserdiscnews
soundtrackzcrazy creditsbusinesssupplementszvideo reviewr+   c                     UR                  S5      nU(       a!  SU R                  ;  a  U R                  U5        UR                  SS5      U l        UR                  SS5      U l        g)a  Initialize a Movie object.

*movieID* -- the unique identifier for the movie.
*title* -- the title of the Movie, if not in the data dictionary.
*myTitle* -- your personal title for the movie.
*myID* -- your personal identifier for the movie.
*data* -- a dictionary used to initialize the object.
*currentRole* -- a Character instance representing the current role
                 or duty of a person in this movie, or a Person
                 object representing the actor/actress who played
                 a given character in a Movie.  If a string is
                 passed, an object is automatically build.
*roleID* -- if available, the characterID/personID of the currentRole
            object.
*roleIsPerson* -- when False (default) the currentRole is assumed
                  to be a Character object, otherwise a Person.
*notes* -- notes for the person referred in the currentRole
            attribute; e.g.: '(voice)'.
*accessSystem* -- a string representing the data access system used.
*titlesRefs* -- a dictionary with references to movies.
*namesRefs* -- a dictionary with references to persons.
*charactersRefs* -- a dictionary with references to characters.
*modFunct* -- function called returning text fields.
titlemovieIDNmyTitle )getdata	set_titlerA   rB   )selfkwdsr@   s      O/Users/admin/workspace/ai/Jarvis/env/lib/python3.13/site-packages/imdb/Movie.py_initMovie._initY   sP    2 !WDII-NN5!xx	40xx	2.    c                      SU l         SU l        g)zReset the Movie object.NrC   rA   rB   rG   s    rI   _resetMovie._resetx   s    rL   c                 P    [        U5      nU R                  R                  U5        g)zSet the title of the movie.N)r
   rE   update)rG   r@   d_titles      rI   rF   Movie.set_title}   s    &		!rL   c                     / nSU R                   ;   a  U/ SQ-  nSU R                   ;   a  U/ SQ-  nSU R                   ;   a  US/-  nU$ )z-Valid keys to append to the data.keys() list.r@   )canonical titlelong imdb titlelong imdb canonical titlesmart canonical titlesmart long imdb canonical title
episode of)long imdb episode titleseries titlecanonical series titleepisode titlecanonical episode titlesmart canonical series titlesmart canonical episode titler(   r)   rE   )rG   addkeyss     rI   _additional_keysMovie._additional_keys   s`    dii ; ;G 499$ 9 9G
 $))#-..GrL   c                     U R                  S5      nU(       a  US   nU$ U R                  S5      nU(       a"  [        R                  R                  US   5      nU$ )zRGuess the language of the title of this movie; returns None
if there are no hints.r'   r   r!   )rD   r   COUNTRY_LANG)rG   r&   r    s      rI   guessLanguageMovie.guessLanguage   sW     xx$7D
  hh{+G"//33GAJ?rL   Nc                 x    Uc  U R                   R                  SS5      nUc  U R                  5       n[        XS9$ )zReturn the canonical title, guessing its language.
The title can be forces with the 'title' argument (internally
used) and the language can be forced with the 'lang' argument,
otherwise it's auto-detected.r@   rC   )r&   )rE   rD   rj   r   )rG   r@   r&   s      rI   smartCanonicalTitleMovie.smartCanonicalTitle   s;    
 =IIMM'2.E<%%'De//rL   c                 T    [        U[        5      (       a  UR                  SS5      $ U$ )z>Get the title from a Movie object or return the string itself.r@   rC   )
isinstancer   rD   )rG   objs     rI   _getSeriesTitleMovie._getSeriesTitle   s%    c5!!777B''
rL   c                    SU R                   ;   Ga!  US:X  a  [        U R                   5      $ US:X  a  U R                  U R                   S   5      $ US:X  a)  U R                  U R                   S   5      n[        U5      $ US:X  a/  U R                  U R                   S   5      nU R	                  U5      $ US:X  a  U R                   R                  SS5      $ US	:X  a%  [        U R                   R                  SS5      5      $ US
:X  a+  U R	                  U R                   R                  SS5      5      $ SU R                   ;   a  US:X  a  U R                   S   $ US:X  a  [        U R                   5      $ US:X  a  [        U R                   S   5      $ US:X  a  U R	                  U R                   S   5      $ US:X  a  [        U R                   SS9$ US:X  a#  [        U R                   SU R                  5       S9$ US:X  a  U R                  5       $ g)zHandle special keys.r\   r]   r^   r_   rb   r`   r@   rC   ra   rc   rX   rW   rZ   rY   T	canonicalr[   )rv   r&   r)   N)rE   r   rr   r   rm   rD   rj   get_fullsizeURL)rG   key	ser_titles      rI   _getitemMovie._getitem   s   499$//"499--&++DIIl,CDD00 00<1HI	%i0066 00<1HI	//	::'yy}}Wb1111%diimmGR&@AA77//		gr0JKKdiig~yy))))"499--))%dii&899////		'0BCC33"499==99"4994CUCUCWXX''''))rL   c                     U R                   $ )zReturn the movieID.)rA   rO   s    rI   getIDMovie.getID   s    ||rL   c                      SU R                   ;   $ )z?The Movie is "false" if the self.data does not contain a title.r@   rd   rO   s    rI   __bool__Movie.__bool__   s     $))##rL   c                 T   [        XR                  5      (       d  gSU R                  ;   a;  SUR                  ;   a+  [        U R                  SS9[        UR                  SS9:X  a  gU R                  UR                  :X  a(  U R
                  b  U R
                  UR
                  :X  a  gg)zZReturn true if this and the compared object have the same
long imdb title and/or movieID.
Fr@   ru   T)rp   	__class__rE   r   accessSystemrA   )rG   others     rI   isSameTitleMovie.isSameTitle   s    
 %00diiGuzz$9DII7;uzz]b;cc 2 22(T\\U]]-JrL   c           	         SSK J n  SSKJn  SSKJn  [        X5      (       aJ  [	        U R
                  SU[        [        [        [        4S9 H  nUR                  U5      (       d  M    g   g[        X5      (       aT  [	        U R
                  SU[        [        [        [        4S9 H%  nUR                  UR                  5      (       d  M%    g   g[        X5      (       aJ  [	        U R
                  SU[        [        [        [        4S9 H  nUR                  U5      (       d  M    g   g[        U[        5      (       a  XR
                  ;   $ g)z{Return true if the given Person object is listed in this Movie,
or if the the given Character is represented in this Movie.   )	Character)Company)PersonT)yieldDictKeysscalar	toDescendF)r   r   r   rp   r   rE   listdicttupler   isSamecurrentRolestr)rG   itemr   r   r   pcs          rI   __contains__Movie.__contains__   s    	)$"d##TYYd6(,dE5'AC;;q>>C   ((TYYd6(,dE5'AC;;q}}--C  &&TYYd7(,dE5'AC;;q>>C  c""99$$rL   c                    [        SU R                  U R                  U R                  [	        U R
                  U5      [	        U R                  U5      U R                  U R                  U R                  [	        U R                  U5      [	        U R                  U5      [	        U R                  U5      S9n[        U R                  5      Ul        UR                  U R                   5        U$ )z'Return a deep copy of a Movie instance.rC   )r@   rA   rB   myIDrE   r   roleIsPersonnotesr   
titlesRefs	namesRefscharactersRefs)r   rA   rB   r   r   rE   r   _roleIsPersonr   r   r   r   r   r   current_infoset_mod_functmodFunct)rG   memoms      rI   __deepcopy__Movie.__deepcopy__  s    DLL$,,yyx		4'@&t'7'7>#11

1B1B%doot<$T^^T:!)$*=*=t!DF d//0	&rL   c                     SU ;   a  U R                  S5      nOU R                  S5      nSU R                  < SU R                  < SU< S3$ )z(String representation of a Movie object.r]   rX   z
<Movie id:[z	] title:_z_>)rD   rA   r   )rG   r@   s     rI   __repr__Movie.__repr__  sC     %,HH67EHH./E15t?P?PRWXXrL   c                 &    U R                  SS5      $ )zSimply print the short title.r@   rC   )rD   rO   s    rI   __str__Movie.__str__  s    xx$$rL   c                     U (       d  gS!S jnSU R                  SS5      -  nU R                  S5      nU(       a  USSR                  U5      -  -  nU R                  S5      nU(       a  US	U" U5      -  -  nU R                  S
5      nU(       a  USU" U5      -  -  nU R                  S5      nU(       a  USS nUSU" U5      -  -  nU R                  S5      nU(       a  USSR                  U5      -  -  nU R                  S5      nU(       a  USSR                  U5      -  -  nU R                  S5      n	U	(       a  USSR                  U	5      -  -  nU R                  S5      n
U
(       a-  USU
-  -  nU R                  S5      nU(       a  USU-  -  nUS-  nU R                  S5      nU(       d  U R                  S5      nU(       a  U/nU(       a)  US   nUR                  S5      nUS:w  a  USU nUS U-  -  nU$ )"z<Return a string with a pretty-printed summary for the movie.rC   , c                     / nU  HI  nUR                  SS5      nUR                  (       a  USUR                  -  -  nUR                  U5        MK     UR                  U5      $ )z)Build a pretty string with name and role.namerC   z (%s))rD   r   appendjoin)
personListjoinernlpersonns        rI   _nameAndRole#Movie.summary.<locals>._nameAndRole'  sZ    B$JJvr*%%6#5#555A		!	 %
 ;;r?"rL   zMovie
=====
Title: %s
rY   r#   zGenres: %s.
r   zDirector: %s.
r   zWriter: %s.
r   N   z
Cast: %s.
r%   zRuntime: %s.
r!   zCountry: %s.
r'   zLanguage: %s.
r   z
Rating: %svotesz (%s votes)z.
r   r   r   z::zPlot: %s)r   )rD   r   find)rG   r   sr#   r   r   r   r$   r!   r&   r   nr_votesr   is                 rI   summaryMovie.summary"  s   	# ($((3NPR*SS(#499V#444A88J'"\(%;;;A(#<#777Axx8Dd!333A((:&!DIIg$666AHH[)	!DIIi$888Axx$"TYYt_44A(#&&Axx(H]X--JAxx88N+Dv7D		$ABwBQxd""ArL   rN   )NN)__name__
__module____qualname____firstlineno____doc__default_info
keys_aliaskeys_tomodify_list
_image_keyr   cmpFunctrJ   rP   rF   rf   rj   rm   rr   rz   r}   r   r   isSameMovier   r   r   r   r   __static_attributes__ rL   rI   r   r      sv   
 $Lxx 	 	&	
 	z 	Z 	8 	& 	V 	v 	 	; 	k 	 	  	:!" 	#$ 0&%('/&,;J@ JH/>
"
$
	0"H$
 K2Y%7rL   r   N)r   
__future__r   r   r   r   copyr   imdbr   
imdb.utilsr	   r
   r   r   r   r   r   r   rL   rI   <module>r      s-   "
 S R   a a{J {rL   