§
   xE·8ÕMêvã                   ó6   — d Z dZdZdZd„ Zeefd„Zd„ Zd
d„Zd	S )uj   Pure rules of the library (docs/plan/milionar-library/040 Â§3, Â§6): no Kodi, no store, fully unit-tested.é´   éZ   g      ø?c                 óR   — | r| dk    rt          | ¦  «        nt          |pd¦  «        S )zPPlayer total time, or the TMDb runtime when the player reports 0 (some streams).é    )Úfloat)ÚtotalÚruntime_secondss     úa/Users/chudy/Library/Application Support/Kodi/addons/plugin.video.milionar/wcs/library2/policy.pyÚeffective_totalr
   	   s,   € à ÐO U¨Q¢Y Y�5�‰<Œ<ˆ<µE¸/Ð:NÈQÑ4OÔ4OÐOó    c                 óJ   — | |k     rdS |rdS |r|dk    r| |z  dz  |k    rdS dS )au  What a stop / end does to the stored state.

    'short'   - position below the resume threshold: nothing is saved (a play that ended naturally below it
                is still 'short' - a trailer-length clip is not a watched film);
    'watched' - position >= watched_percent of total, or the playback ended naturally past the threshold;
    'resume'  - in progress.
    ÚshortÚwatchedr   g      Y@Úresume© )Úpositionr   ÚendedÚmin_secondsÚwatched_percents        r	   Úoutcomer      sO   € ð �+ÒÐØˆwØð ØˆyØð �˜’� ¨5Ñ 0°EÑ9¸_ÒLÐLØˆyØˆ8r   c                 ój  — |r|                      d¦  «        €dS t          |                      d¦  «        pd¦  «        t          |                      d¦  «        pd¦  «        k    }t          t          |                      d¦  «        pd¦  «        t          |                      d¦  «        pd¦  «        z
  ¦  «        t          k    }|r|rdS |                       d¦  «        pd|d         k    rdS t          |                      d¦  «        pd¦  «        t          |                      d¦  «        pd¦  «        dœS )u©  Decide whether Kodi's current record carries a user change that must be adopted (040 Â§6).

    ours     {'last_played_at'}                      what the addon stored last
    kodi     {'playcount', 'resume_pos'}             Kodi's record for the canonical URL now
    mirrored {'playcount', 'resume_pos', 'at'}       what the addon wrote into Kodi last, or None

    Returns None (nothing to adopt) or {'playcount', 'resume_pos'} to apply.
    A difference is a user change made in Kodi unless the addon has newer data than its last mirror
    (a play ended after the mirror: Kodi's own stop-time bookmark is older than ours and is ignored;
    the addon re-mirrors instead).
    ÚatNÚ	playcountr   Ú
resume_posÚlast_played_at)r   r   )ÚgetÚintÚabsr   ÚRESUME_TOLERANCE_S)ÚoursÚkodiÚmirroredÚ
same_countÚsame_poss        r	   Ú	reconciler$      s&  € ð ð �x—|’| DÑ)Ô)Ð1ØˆtÝ�T—X’X˜kÑ*Ô*Ð/¨aÑ0Ô0µC¸¿ºÀ[Ñ8QÔ8QÐ8VÐUVÑ4WÔ4WÒW€JÝ•5˜Ÿš ,Ñ/Ô/Ð4°1Ñ5Ô5½¸h¿lºlÈ<Ñ>XÔ>XÐ>]Ð\]Ñ8^Ô8^Ñ^Ñ_Ô_ÕcuÒu€HØð �hð ØˆtØ�ŠÐ!Ñ"Ô"Ð' a¨8°D¬>Ò9Ð9ØˆtÝ˜TŸXšX kÑ2Ô2Ð7°aÑ8Ô8ÍÈdÏhÊhÐWcÑNdÔNdÐNiÐhiÑHjÔHjÐkÐkÐkr   é   c                 óæ   — | r|                       d¦  «        sdS |r|| d         k    rdS t          |                       d¦  «        ¦  «        o&|| d         z
  |k    o|pd                     d¦  «         S )zÃDoes the now-playing contract belong to the file Kodi started? Exact stream URL match; failing that a
    fresh contract is accepted only while the player has not reported a canonical plugin URL.Ú
stream_urlFTÚtsÚ z	plugin://)r   ÚboolÚ
startswith)ÚnpÚplaying_fileÚnowÚ	max_age_ss       r	   Ú
np_matchesr0   6   s‡   € ð ð �R—V’V˜LÑ)Ô)ð ØˆuØð ˜¨¨<Ô(8Ò8Ð8ØˆtÝ�—’�t‘”ÑÔÐt 3¨¨D¬¡>°iÒ"?ÐtÈÐI[ÐY[×HgÒHgÐhsÑHtÔHtÐDtÐtr   N)r%   )Ú__doc__ÚDEFAULT_RESUME_MIN_SECONDSÚDEFAULT_WATCHED_PERCENTr   r
   r   r$   r0   r   r   r	   ú<module>r4      s‚   ðà pÐ pà Ð ØÐ ØÐ ðPð Pð Pð
 1KÐ\sð ð ð ð ð"lð lð lð.uð uð uð uð uð ur   