1313from resources .lib import launch
1414from resources .lib import common
1515from resources .lib import dialogs
16- from urllib .parse import unquote
1716# ## Plugin Initialization Stuff ##
1817# SLEEP_HACK=50 #https://github.com/xbmc/xbmc/issues/18576
1918plugin = routing .Plugin ()
@@ -1534,8 +1533,8 @@ def add_to_favorites_random(link_name):
15341533@plugin .route ('/context_menu/action/remove_link_from_favorites' )
15351534def remove_link_from_favorites ():
15361535 xbmc .log (msg = 'IAGL: /remove_link_from_favorites' ,level = xbmc .LOGDEBUG )
1537- if isinstance (xbmc .getInfoLabel ('ListItem.FileNameAndPath' ), str ) and isinstance ( xbmc . getInfoLabel ( 'ListItem.FileNameAndPath' ). split ( 'query=' )[ - 1 ] ,str ) and len (xbmc .getInfoLabel ('ListItem.FileNameAndPath' ). split ( 'query=' )[ - 1 ] )> 0 :
1538- query_in = unquote ( xbmc .getInfoLabel ('ListItem.FileNameAndPath' ). split ( 'query=' )[ - 1 ] ).replace ('"' ,'""' )
1536+ if isinstance (xbmc .getInfoLabel ('ListItem.Property(link_query)' ) ,str ) and len (xbmc .getInfoLabel ('ListItem.Property(link_query)' ) )> 0 :
1537+ query_in = xbmc .getInfoLabel ('ListItem.Property(link_query)' ).replace ('"' ,'""' )
15391538 if xbmcgui .Dialog ().yesno (cm .get_loc (30237 ),cm .get_loc (30238 )):
15401539 result = db .delete_favorite_from_link (query_in = query_in )
15411540 if isinstance (result ,int ) and result > 0 :
@@ -1546,15 +1545,17 @@ def remove_link_from_favorites():
15461545@plugin .route ('/context_menu/action/rename_link_from_favorites/<link_id>' )
15471546def rename_link_from_favorites (link_id ):
15481547 xbmc .log (msg = 'IAGL: /rename_link_from_favorites/{}' .format (link_id ),level = xbmc .LOGDEBUG )
1549- if isinstance (xbmc .getInfoLabel ('ListItem.FileNameAndPath' ), str ) and isinstance ( xbmc . getInfoLabel ( 'ListItem.FileNameAndPath' ). split ( 'query=' )[ - 1 ] ,str ) and len (xbmc .getInfoLabel ('ListItem.FileNameAndPath' ). split ( 'query=' )[ - 1 ] )> 0 :
1550- link_query = unquote ( xbmc .getInfoLabel ('ListItem.FileNameAndPath' ). split ( 'query=' )[ - 1 ] ).replace ('"' ,'""' )
1548+ if isinstance (xbmc .getInfoLabel ('ListItem.Property(link_query)' ) ,str ) and len (xbmc .getInfoLabel ('ListItem.Property(link_query)' ) )> 0 :
1549+ link_query = xbmc .getInfoLabel ('ListItem.Property(link_query)' ).replace ('"' ,'""' )
15511550 new_name = xbmcgui .Dialog ().input (heading = cm .get_loc (30230 ),defaultt = xbmc .getInfoLabel ('ListItem.Label' ))
15521551 if isinstance (new_name ,str ) and len (new_name )> 0 and isinstance (link_query ,str ) and len (link_query )> 0 :
15531552 result = db .rename_favorite_link (new_name = new_name ,link_query = link_query )
15541553 if isinstance (result ,int ) and result > 0 :
15551554 ok_ret = xbmcgui .Dialog ().ok (cm .get_loc (30233 ),cm .get_loc (30481 ))
15561555 xbmc .sleep (config .defaults .get ('sleep' ))
15571556 xbmc .executebuiltin ('Container.Refresh' )
1557+ else :
1558+ xbmc .log (msg = 'IAGL: Error finding link_query for link_id {}' .format (link_id ),level = xbmc .LOGERROR )
15581559
15591560@plugin .route ('/context_menu/action/update_launcher/<game_list_id>' )
15601561def update_game_list_launcher (game_list_id ):
0 commit comments