Skip to content

Commit

Permalink
Improvements from the Python 2 branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wintermute0110 committed Jun 22, 2021
1 parent ffab311 commit 4c3b3c0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ WIP FIX Fix launching of ROMs with Windows network filenames.
See https://forum.kodi.tv/showthread.php?tid=287826&pid=2919639#pid2919639


[B]Advanced Emulator Launcher | version 0.10.0 | xx xxxxx 2021[/B]
[B]Advanced Emulator Launcher | version 0.10.0 | 22 June 2021[/B]

NOTE Python 3 version for Matrix in branch release-0.10.x-python3

Expand All @@ -161,7 +161,7 @@ FEATURE Create a Python 3 Matrix version 0.10.x to track release 0.9.x.
FEATURE Port release 0.9.10 to Python 3.


[B]Advanced Emulator Launcher | version 0.9.10 | xx xxxxx 2021[/B]
[B]Advanced Emulator Launcher | version 0.9.10 | 22 June 2021[/B]

NOTE Python 2 version for Leia/Krypon in branch release-0.9.x-python2
Have a look at AML code to ease the conversion.
Expand Down
6 changes: 4 additions & 2 deletions resources/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@
# Addon options and tuneables.
# -------------------------------------------------------------------------------------------------
# Compact, smaller size, non-human readable JSON. False forces human-readable JSON for development.
# In AEL speed is not as critical so False. In AML this must be True when releasing.
# In AEL speed is not as critical so False is OK.
# In AML this must be True when releasing.
OPTION_COMPACT_JSON = False

# Use less memory when writing big JSON files, but writing is slower.
# In AEL this can be False when releasing. In AML it must be True.
# In AEL this can be False when releasing.
# In AML it must be True when releasing.
OPTION_LOWMEM_WRITE_JSON = False

# The addon name in the GUI. Title of Kodi dialogs (yesno, progress, etc.) and used also in log functions.
Expand Down
5 changes: 2 additions & 3 deletions resources/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2678,9 +2678,8 @@ def _command_add_roms(self, launcher):
# Note that categoryID = VCATEGORY_FAVOURITES_ID, launcherID = VLAUNCHER_FAVOURITES_ID
# if we are editing a ROM in Favourites.
def _command_edit_rom(self, categoryID, launcherID, romID):
# --- ---
if romID == UNKNOWN_ROMS_PARENT_ID:
kodi_dialog_OK('You cannot edit this ROM!')
kodi_dialog_OK('You cannot edit this ROM! (Unknown parent ROM)')
return

# --- Load ROMs ---
Expand Down Expand Up @@ -2981,7 +2980,7 @@ def _command_edit_rom(self, categoryID, launcherID, romID):
# --- Edit ROM Assets (all) ---
elif mindex == 2:
sDialog = KodiSelectDialog('Edit ROM assets (all)', [
'Scrape all assets',
'Scrape all assets (choose scraper)',
'Unset all assets',
])
mindex2 = sDialog.executeDialog()
Expand Down
10 changes: 5 additions & 5 deletions resources/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,13 @@ def utils_load_JSON_file(json_filename, default_obj = {}, verbose = True):
# Note that there is a bug in the json module where the ensure_ascii=False flag can produce
# a mix of unicode and str objects.
# See http://stackoverflow.com/questions/18337407/saving-utf-8-texts-in-json-dumps-as-utf8-not-as-u-escape-sequence
def utils_write_JSON_file(json_filename, json_data, verbose = True, pprint = False, lowmem = False):
def utils_write_JSON_file(json_filename, json_data, verbose = True, pprint = False):
l_start = time.time()
if verbose: log_debug('utils_write_JSON_file() "{}"'.format(json_filename))

# Choose JSON iterative encoder or normal encoder.
if lowmem:
if verbose: log_debug('utils_write_JSON_file() Using lowmem option')
if OPTION_LOWMEM_WRITE_JSON:
if verbose: log_debug('utils_write_JSON_file() Using OPTION_LOWMEM_WRITE_JSON option')
if pprint:
jobj = json.JSONEncoder(ensure_ascii = False, sort_keys = True,
indent = JSON_INDENT, separators = JSON_SEP)
Expand All @@ -393,7 +393,7 @@ def utils_write_JSON_file(json_filename, json_data, verbose = True, pprint = Fal
# Write JSON to disk
try:
with io.open(json_filename, 'wt', encoding = 'utf-8') as file:
if lowmem:
if OPTION_LOWMEM_WRITE_JSON:
# Chunk by chunk JSON writer, uses less memory but takes longer.
for chunk in jobj.iterencode(json_data):
file.write(chunk)
Expand Down Expand Up @@ -1288,4 +1288,4 @@ def kodi_update_image_cache(img_path):
lod_error('(OSError) Cannot update cached image')

# Is this really needed?
# xbmc.executebuiltin('XBMC.ReloadSkin()')
# xbmc.executebuiltin('ReloadSkin()')

0 comments on commit 4c3b3c0

Please sign in to comment.