LaunchBox Plugin Not Showing All Images & Info For Fade & Pause Screens

teeedubb

New member
Supporter
RL Member
Ok I think I have gotten my head around it.

Incase anyone is interested, this is a python 2 script to batch convert LB xml's into RL game data ini's. You need to set the two variables to the respective LB + RL data folders.

Code:
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import print_function
from itertools import izip
from HTMLParser import HTMLParser
import os
import shutil
import re
import sys
import xml.etree.ElementTree as ET

try:
	txt_encode = sys.getfilesystemencoding()
except:
	txt_encode = 'utf-8'
reload(sys)  
sys.setdefaultencoding('utf-8')

lb_dir = 'c:/Users/tw/Desktop/lb-rl-info'
rl_dir = 'c:/Users/tw/Desktop/lb-rl-output'

###
rl_dir_backup = os.path.join(rl_dir, 'backup')
for system in os.listdir(lb_dir):
	if system.endswith(".xml"):
		system_name = system[:-4]
		print(system_name)
		xml_lb = os.path.join(lb_dir, system)
		ini_rl = os.path.join(rl_dir, system_name+'.ini')
		h = HTMLParser()
		if os.path.exists(ini_rl):
			if not os.path.exists(rl_dir_backup):
				os.makedirs(rl_dir_backup)
			if os.path.exists(os.path.join(rl_dir_backup, system_name+'.ini')):
				if os.path.exists(os.path.join(rl_dir_backup, system_name+'.ini.old')):
					os.remove(os.path.join(rl_dir_backup, system_name+'.ini.old'))
				shutil.move(os.path.join(rl_dir_backup, system_name+'.ini'), os.path.join(rl_dir_backup, system_name+'.ini.old'))
			shutil.move(ini_rl, rl_dir_backup)
		tree = ET.parse(xml_lb)
		root = tree.getroot()
		lb_label = ['Title', 'Publisher', 'Developer', 'ReleaseDate', 'Genre', 'StarRating', 'PlayMode', 'Rating', 'WikipediaURL', 'Notes']
		rl_label = ['Title', 'Publisher', 'Developer', 'Released', 'Genre', 'Score', 'Players', 'Rating', 'Url', 'Description']
		with open(ini_rl, 'w') as f:
			for game in root.findall('Game'):
				for lbl,rll in izip(lb_label, rl_label):
					if game.find(lbl) != None and game.find(lbl).text:
						if rll == 'Title':
							info = '[' + h.unescape(game.find(lbl).text) + ']'
							info = info.replace('\r', ' ').replace('\n', ' ') + "\n"
							info = re.sub(' +', ' ', info)
						elif rll == 'Released':
							info = h.unescape(game.find(lbl).text)[:4]
							info = rll + '=' + info + "\n"
						else:
							info = rll + '=' + h.unescape(game.find(lbl).text)
							info = info.replace('\r', ' ').replace('\n', ' ') + "\n"
							info = re.sub(' +', ' ', info)
						f.write(info)
				f.write("\n")
 

teeedubb

New member
Supporter
RL Member
@bleasby quick question... Do you know if it is possible to place the LB game data ini's somewhere so they are not overwritten on RL updates? Like a user game data ini folder or something?

Thanks
 

bleasby

RocketLauncher Developer
Developer
I can't check it right now, but the game info files shouldn't be replaced while updating.

They should most probably use the "(example)" tag on the official file names to avoid that.
Brolly, do you know if this is happening and why these files are not distributed as example files to avoid such issue?

Sent from my SM-J200M using Tapatalk
 

brolly

Administrator
Developer
Don't know, but this applies to everything in the Data folder actually (history.dat, moves list) so we should probably review that. If anything should be renamed I think it would make more sense to do it on the actual folders not files (would also be a lot easier).
The only drawback of doing this is that users will need to manually rename their folders on first use and this might lead to a bunch of questions here asking why no info is showing. I think it's the first time I see someone actually trying to edit these files :)
 

bleasby

RocketLauncher Developer
Developer
Yeah, funny that this only came up now, after such a long time.
Maybe the correct way to handle that would be to just rename the Data folder to Data (example).
We should also add a warning on the update change log about renaming it if you are a new user, but sadly most of the newer users will not bother reading the big red letters and will just come here complaining that their install do not work.
 

brolly

Administrator
Developer
Do we have any reliable way of checking if it's the first time the user runs RL? Like checking the statistics file for example?
If we do then we could simply rename that folder back to "Data" on first run and only in the first run (if such a folder doesn't already exist of course), this should take care of that problem and still allow users to customize things as they see fit without getting everything overwritten on updates.
 

bleasby

RocketLauncher Developer
Developer
You would need to ask djvj for that.
In my opinion this could be definitely done.
 

brolly

Administrator
Developer
Will do once we find out where he is hiding :)
How would this be done then? Through the stats file or something else?
 

bleasby

RocketLauncher Developer
Developer
I believe that the statistics could be disabled by the user.
We could simply check for the existence of a specific text file in the data folder for example.
Either that or just test directly if the Data folder exists if we go on the route of shipping the default files in a renamed Data (example)" folder.
 
Top