+
    Ki  c                   s    R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	 ^ RI
Ht ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ R	IHt ^ R
IHt ^ RIHt R t ! R R]4      t ! R R]4      t ! R R]4      tR# )zXDG applications serviceN)gettext)Gio)settings)get_games_where)BaseService)ServiceGame)ServiceMedia)system)logger)slugifyc                s     \         P                  P                  V P                  4       4      ^ ,          #   \         d+    \
        P                  ! RT 4       T P                  4       u # i ; i)zGet the appid for the gamezPFailed to read ID for app %s (non UTF-8 encoding). Reverting to executable name.)ospathZsplitextZget_idZUnicodeDecodeErrorr   Z	exceptionget_executable)app   &8/usr/lib/python3.14/site-packages/lutris/services/xdg.py	get_appidr      s[    $ww

-a00 $^	
 !!##$s   36 2A+*A+c                   st    ] tR t^"tRtRtRt]P                  P                  ]
P                  R4      tR.tRtR# )XDGMediaxdglocalz	xdg/iconsz%s.png N)@   r   )__name__
__module____qualname____firstlineno__serviceZsourceZsizer
   r   Zjoinr   Z	CACHE_DIRZ	dest_pathZfile_patterns__static_attributes__r       r   r   r   "   s2    GFDX//=IJMr   r   c                   s   a  ] tR t^*t o Rt]! R4      tRtRtRt	Rt
R]/tRtRtRt]R 4       t]R 4       t]R	 4       tR
 tR tR tR tR tRtV tR# )
XDGServicer   ZLocallinuxFTiconc              #  s   "   \         P                  P                  4        F   pV P                  V4      '       g   K  Vx  K"  	  R# 5i)zIterates through XDG games onlyN)r   ZAppInfoZget_all_is_importable)clsr      & r   iter_xdg_gamesZXDGService.iter_xdg_games7   s4      ;;&&(C!!#&&	 )s
   6A
Ac              #  sx   "   \        \        P                  \        P                  ^R7       F  pVx  K	  	  R# 5i)z/Iterates through Lutris games imported from XDG)runnerinstaller_slugZ	installedN)r   XDGGamer$   r%   )selfgamer"   r   lutris_gamesZXDGService.lutris_games>   s+      $7>>'J`J`lmnDJ os   8:c           
     s  a \        V4      pVP                  4       ;'       g    Rp\        VP                  4       ;'       g    VP	                  4       V'       * VP                  R4      VP                  4       \        \        P                  V P                  4      9   VP                  4       V P                  9   .4      '       d   R# VP                  4       ;'       g    Rp\        \        RVP                  4       P                  R4      4      4      pRV9  d   R# \        R V P                    4       4      o\        ;QJ d    V3R lV 4       F  '       g   K   R	M	  RM! V3R lV 4       4      '       d   R# R	# )
z2Returns whether a XDG game is importable to Lutris z
net.lutrisFNZ;r(   c              3   s@   "   T F  qP                  4       x  K  	  R # 5iN)Zcasefold).0cr"   r   	<genexpr>,XDGService._is_importable.<locals>.<genexpr>[   s      N7M!7Ms   c              3   s8   <"   T F  qS9   g   K  Vx  K  	  R # 5ir+   r   )r,   r-   ignored_categoriess   & r   r.   r/   \   s     @*Q-?(?qq*s   
T)r   r   ZanyZget_nodisplayZget_is_hidden
startswithZlowermapZstrignored_gamesignored_executablesZget_categorieslistZfiltersplitZsetr0   )r!   r   appidZ
executableZ
categoriesr0   s   &&   @r   r    ZXDGService._is_importableD   s)    #'')//R
!!#::s'8'8':  .SYY0A0A!BB  "c&=&==
 
  '')//R
&z'7'7'9'?'?'DEF
# ! Ns7M7M NN3@*@333@*@@@r   c                s    R# )z&XDG games aren't on the lutris websiteNr   )r'   r   r   match_gamesZXDGService.match_games`   s    r   c                s    V P                  4        Uu. uF  p\        P                  V4      NK  	  ppV F  pVP                  4        K  	  V# u upi )z0Return the list of games stored in the XDG menu.)r#   r&   new_from_xdg_appZsave)r'   r   Z	xdg_gamesr(      &   r   loadZXDGService.loadd   sK    >B>Q>Q>ST>SsW--c2>S	TDIIK  Us   Ac                s    \         P                  ! VR ,          4      pRVR,          RRRVR,          RV P                  V4      RV P                  V4      RRR	VR	,          R
VR
,          RVR,          /RRR///# )detailsnameZversionZXDGslugZ	game_slugr$   scriptr(   exeargsZworking_dirr   r   Zdisable_runtimeT)jsonZloadsZget_installed_slugget_installed_runner_name)r'   db_gamer<   s   && r   generate_installerZXDGService.generate_installerk   s    **WY/0GFOuGFO009d44W=75>GFO!76?
 ,d3
 	
r   c                s    V P                   # r+   )r$   )r'   rD      &&r   rC   Z$XDGService.get_installed_runner_name}   s    {{r   c                sj    \         P                  P                  VR,          R,          R,          4      # )z$Pull install location from installerr?   r(   r@   )r
   r   Zdirname)r'   Z	installerrF   r   get_game_directoryZXDGService.get_game_directory   s$    wwy26:5ABBr   r   N)lutris)rH   Zsteam)ZEmulatorZDevelopmentZUtility)r   r   r   r   Zid_r=   r   r$   Zonliner   r   Zmediasr3   r4   r0   classmethodr#   Zpropertyr)   r    r8   r;   rE   rC   rG   r   __classdictcell__Z__classdict__   @r   r   r   *   s     	BW:DDFFEhFM-?   
  6
$C Cr   r   c                   s   a  ] tR t^t o RtRtRtRt]R 4       t	]
R 4       t]R 4       t]R 4       t]R	 4       tR
tV tR# )r&   z-XDG game (Linux game with a desktop launcher)r   r   Z
desktopappc                sV    V P                  4       pV'       g   R# VP                  4       # )z8Return the name of the icon for an XDG app if one if setr*   )Zget_iconZ	to_string)xdg_appr   r"   r   get_app_iconZXDGGame.get_app_icon   s%     !~~r   c                s@   V ! 4       pVP                  4       Vn        V P                  V4      Vn        \	        V4      Vn        V P                  V4      Vn        V P                  V4      w  r4V P                  V4      p\        P                  ! RVRVRV/4      Vn        V# )z&Create a service game from a XDG entryr@   rA   r   )get_display_namer=   rO   r   r   r7   get_slugr>   get_command_argsget_desktop_entry_pathrB   Zdumpsr<   )r!   rN   Zservice_gamer@   rA   r   s   &&    r   r9   ZXDGGame.new_from_xdg_app   s     u#446,,W5&w/LL1((1	))'2#zzs 
 r   c                sL    \        V R4      '       d   V P                  R4      # R# )z1Retrieve the Path variable from the .desktop file
get_stringZPathN)ZhasattrrT   rN   r   r   rS   ZXDGGame.get_desktop_entry_path   s%     7L))%%f--r   c                s    \         P                  ! V P                  4       4      p\        \	        R VR,          4      4      pV^ ,          pVP                  R4      '       g   \        P                  ! V4      pV\        P                  ! V4      3# )z@Return a tuple with absolute command path and an argument stringc                 sR    \         P                  ! R RV 4      P                  RR4      # )z%[^%]r*   z%%Z%)reZsubZreplace)Zargr   r   Z<lambda>Z*XDGGame.get_command_args.<locals>.<lambda>   s    BFF7B$<$D$DT3$Or   :i   NNZ/)
shlexr6   Zget_commandliner5   r2   r1   r   Zfind_required_executable
subprocessZlist2cmdline)r   ZcommandrA   r@   r:   r   rR   ZXDGGame.get_command_args   sr     ++c1134COQXY[Q\]^aj~~c""11#6CJ++D111r   c                sl    \        V P                  4       4      ;'       g    \        \        V 4      4      # )zGet the slug from the game name)r	   rP   r   rU   r   r   rQ   ZXDGGame.get_slug   s*     w//12QQgi>P6QQr   r   N)r   r   r   r   __doc__r   r$   r%   ZstaticmethodrO   rJ   r9   rS   rR   rQ   r   rK   rL   rM   r   r&   r&      s{     7GF!N     $   2 2 R Rr   r&   )rY   rB   r
   rV   rW   rX   r    rI   Zgi.repositoryr   rH   r   Zlutris.database.gamesr   Zlutris.services.baser   Zlutris.services.service_gamer   Zlutris.services.service_mediar   Zlutris.utilr   Zlutris.util.logr   Zlutris.util.stringsr	   r   r   r   r&   r   r   r   <module>rZ      se      	 	       1 , 4 6  " '	$| XC XCv:Rk :Rr   