Skip to content

Commit a2a831f

Browse files
Fix Standalone Kodi builtin launchers.
1 parent 24c638a commit a2a831f

File tree

2 files changed

+33
-15
lines changed

2 files changed

+33
-15
lines changed

changelog.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ FIX Fix TheGamesDB scraper. New asset titlescreen in TheGamesDB.
186186
FIX Fix launching of LNK ROM launchers with spaces in LNK filename.
187187
See https://github.com/Wintermute0110/plugin.program.AEL/issues/125
188188

189+
FIX Fix Standalone Kodi builtin launchers.
190+
See https://forum.kodi.tv/showthread.php?tid=287826&pid=3036064#pid3036064
191+
189192

190193
[B]Advanced Emulator Launcher | version 0.9.9 | 13 March 2020[/B]
191194

resources/main.py

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2642,15 +2642,17 @@ def _command_edit_launcher(self, categoryID, launcherID):
26422642
rompath = self.launchers[launcherID]['rompath']
26432643
launcher_name = self.launchers[launcherID]['m_name']
26442644
# ROMs launcher
2645-
if rompath == '':
2645+
if rompath:
26462646
roms = fs_load_ROMs_JSON(g_PATHS.ROMS_DIR, self.launchers[launcherID])
26472647
ret = kodi_dialog_yesno('Launcher "{}" has {} ROMs. '.format(launcher_name, len(roms)) +
26482648
'Are you sure you want to delete it?')
26492649
# Standalone launcher
26502650
else:
26512651
ret = kodi_dialog_yesno('Launcher "{}" is standalone. '.format(launcher_name) +
26522652
'Are you sure you want to delete it?')
2653-
if not ret: return
2653+
if not ret:
2654+
kodi_notify('Delete Launcher cancelled')
2655+
return
26542656

26552657
# Remove JSON/XML file if exist
26562658
# Remove launcher from database. Categories.xml will be saved at the end of function
@@ -7880,31 +7882,44 @@ def _command_run_standalone_launcher(self, categoryID, launcherID):
78807882
return
78817883
launcher = self.launchers[launcherID]
78827884
minimize_flag = launcher['toggle_window']
7885+
log_info('_run_standalone_launcher() categoryID {}'.format(categoryID))
7886+
log_info('_run_standalone_launcher() launcherID {}'.format(launcherID))
78837887

78847888
# --- Execute Kodi built-in function under certain conditions ---
7885-
application = FileName(launcher['application'])
7886-
if application.getBase().lower().replace('.exe' , '') == 'xbmc' or \
7887-
'xbmc-fav-' in launcher['application'] or \
7888-
'xbmc-sea-' in launcher['application']:
7889-
xbmc.executebuiltin('XBMC.{}'.format(launcher['args']))
7889+
# Application is "xbmc", "xbmc.exe" or starts with "xbmc-fav-" or "xbmc-sea-".
7890+
# Upgraded to support kodi.
7891+
# Arguments is the builtin function to execute, for example:
7892+
# ActivateWindow(10821,"plugin://plugin.program.iagl/game_list/list_all/Dreamcast_Downloaded/1",return)
7893+
application_str = launcher['application']
7894+
arguments_str = launcher['args']
7895+
app_cleaned = application_str.lower().replace('.exe' , '')
7896+
if app_cleaned == 'xbmc' or app_cleaned == 'kodi' or \
7897+
'xbmc-fav-' in app_cleaned or 'xbmc-sea-' in app_cleaned or \
7898+
'kodi-fav-' in app_cleaned or 'kodi-sea-' in app_cleaned:
7899+
log_info('_run_standalone_launcher() Executing Kodi builtin function')
7900+
log_info('_run_standalone_launcher() application "{}"'.format(application_str))
7901+
log_info('_run_standalone_launcher() app_cleaned "{}"'.format(app_cleaned))
7902+
log_info('_run_standalone_launcher() arguments "{}"'.format(arguments_str))
7903+
if self.settings['display_launcher_notify']: kodi_notify('Launching Kodi builtin')
7904+
xbmc.executebuiltin('{}'.format(arguments_str))
7905+
log_info('_run_standalone_launcher() Exiting function.')
78907906
return
78917907

7892-
# ~~~~~ External application ~~~~~
7908+
# ----- External application -----
7909+
application = FileName(launcher['application'])
78937910
app_basename = application.getBase()
78947911
app_ext = application.getExt()
7895-
arguments = launcher['args']
78967912
launcher_title = launcher['m_name']
7897-
log_info('_run_standalone_launcher() categoryID {}'.format(categoryID))
7898-
log_info('_run_standalone_launcher() launcherID {}'.format(launcherID))
78997913
log_info('_run_standalone_launcher() application "{}"'.format(application.getPath()))
79007914
log_info('_run_standalone_launcher() apppath "{}"'.format(application.getDir()))
79017915
log_info('_run_standalone_launcher() app_basename "{}"'.format(app_basename))
79027916
log_info('_run_standalone_launcher() app_ext "{}"'.format(app_ext))
79037917
log_info('_run_standalone_launcher() launcher name "{}"'.format(launcher_title))
79047918

7905-
# ~~~ Argument substitution ~~~
7919+
# --- Argument substitution ---
7920+
arguments = launcher['args']
79067921
log_info('_run_standalone_launcher() raw arguments "{}"'.format(arguments))
7907-
arguments = arguments.replace('$apppath%' , application.getDir())
7922+
arguments = arguments.replace('$apppath$' , application.getDir())
79087923
log_info('_run_standalone_launcher() final arguments "{}"'.format(arguments))
79097924

79107925
# --- Check for errors and abort if errors found ---
@@ -7913,7 +7928,7 @@ def _command_run_standalone_launcher(self, categoryID, launcherID):
79137928
kodi_notify_warn('App {} not found.'.format(application.getOriginalPath()))
79147929
return
79157930

7916-
# ~~~~~ Execute external application ~~~~~
7931+
# --- Execute external application ---
79177932
non_blocking_flag = False
79187933
self._run_before_execution(launcher_title, minimize_flag)
79197934
self._run_process(application.getPath(), arguments, application.getDir(), app_ext, non_blocking_flag)
@@ -7924,7 +7939,7 @@ def _command_run_standalone_launcher(self, categoryID, launcherID):
79247939
def _command_run_rom(self, categoryID, launcherID, romID):
79257940
# --- ROM in Favourites ---
79267941
if categoryID == VCATEGORY_FAVOURITES_ID and launcherID == VLAUNCHER_FAVOURITES_ID:
7927-
log_info('_command_run_rom() Launching ROM in Favourites ...')
7942+
log_info('_command_run_rom() Launching ROM in Favourites...')
79287943
roms = fs_load_Favourites_JSON(g_PATHS.FAV_JSON_FILE_PATH)
79297944
rom = roms[romID]
79307945
recent_rom = rom

0 commit comments

Comments
 (0)