View Full Version : Accessing info in an XBE
i want to know how do i go about getting info stored in an xbe when a dvd is inserted?
how do i extract the title and logo image of a game?
so i found the xbe file format on caustik's website:
xbe file format, by caustik (http://www.caustik.com/xbox/download/xbe.htm)
very nice caustik
so i could potenitally write a decoder, but caustik already wrote one, all i have to do is translate his code into python and give him credit.
yes i'm aware that darkie could provide me acess to xbmc's method, but then they would probably have to write an interface for it and include it in the xbmc python library for everyone to use, and i would have to wait until the next release.
the only question i have now is; what method do i use to open the xbe file, so that i can access this data?
i finally got it, i can now retreive the title of an xbe, here is the script i used:
import xbmc, xbmcgui, os
disc_present = 96 # xbmc.tray_closed_media_present
dvd_dir = "d:\\" # the dvd drive base directory.
class xbeparser:
textfile = open("e:\gametitle.txt", "a+") # create a text file to output data to (a.k.a - log file).
if xbmc.getdvdstate() == disc_present: #if a disc is in the dvd dive then execute code below.
openedxbe = open("d:\\default.xbe", "rb")
openedxbe.seek(384, 0)
textfile.write(openedxbe.read(80) + "\n")
openedxbe.close() # never forget to close a file you opened.
textfile.close() # never forget to close a file you opened.
x = xbeparser() # call the class so that the code can be run.
del x
this method results in a binary string.
after alot of testing and thinking, i have finally solved it :d
my dirty hack:
openedxbe = open("test.xbe", "rb") # open test.xbe for reading in binary mode
openedxbe.seek(400, 0) # set startingpoint for reading
xbetext = openedxbe.read(80) # read out the entire section assigned to the title
openedxbe.close() # never forget to close a file you opened.
bintext = xbetext[::2] # copy every odd character to a new string
xbetext = "" # empty the xbetext string
for s in bintext: # iterate the string
if ord(s) in range(32, 127): #if the current character is in the ascii range
xbename += s # add the character to xbename
thats all there is to it...