Cannot load .dat files with xbmcgui.Dialog.browse()
#1
In Advanced Emulator Launcher user may need to load a No-Intro DAT file to audit his/her ROMs. No-Intro DAT files downloaded from Dat-O-Matic are XML files but have DAT file extension. I use the following code to load the DAT file:

Code:
# --- Browse for No-Intro file ---
# BUG For some reason *.dat files are not shown on the dialog, but XML files are OK!!!
dialog = xbmcgui.Dialog()
                        
#  >> DOES NOT SHOW .DAT FILES BUT SHOWS .XML FILES
dat_file = dialog.browse(1, 'Select No-Intro XML DAT (XML|DAT)', 'files', '.dat|.xml').decode('utf-8')
                        
# >> SHOWS .DAT and .XML files. .DAT files have a video icon, .XML have a book icon
# dat_file = dialog.browse(1, 'Select No-Intro XML DAT (XML|DAT)', 'files').decode('utf-8')
                        
# >> DOES NOT SHOW .DAT FILES
# dat_file = dialog.browse(1, 'Select No-Intro XML DAT (XML|DAT)', 'files', '.dat').decode('utf-8')
                        
# >> DOES NOT SHOW .DAT NOR .XML files, but shows .ZIP files
# dat_file = dialog.browse(2, 'Select No-Intro XML DAT (XML|DAT)', 'files', '.dat|.xml').decode('utf-8')

if not FileName(dat_file).exists(): return
self.launchers[launcherID]['nointro_xml_file'] = dat_file
kodi_dialog_OK('DAT file successfully added. Audit your ROMs to update No-Intro status.')

I have tried many combinations of arguments and have done many tests (look at the comments in the Python code) but for some reason Kodi refuses to load .dat files unless the file mask optional argument is not specified. DAT files just don't show up on the file select dialog so cannot be chosen.

Yes... in case you are wondering I made sure there are .dat files in the directory I use for testing. These are the contents of that directory:

Code:
-rwxrwx---+ 1 Wintermute None 1.3M Oct  2 01:17 'Nintendo - Super Nintendo Entertainment System Parent-Clone (20160925-063400).dat'
-rwxrwx---+ 1 Wintermute None 1.3M Oct  2 01:17 'Nintendo - Super Nintendo Entertainment System Parent-Clone (20160925-063400).xml'
-rwxrwx---+ 1 Wintermute None 645K Oct  2 01:19 'Sega - Mega Drive - Genesis Parent-Clone (20160929-205256).dat'
-rwxrwx---+ 1 Wintermute None 645K Oct  2 01:19 'Sega - Mega Drive - Genesis Parent-Clone (20160929-205256).xml'

I'm currently using Krypton Beta 5 but same behavior happened in Jarvis. Anybody has a clue of what is going on? This could be a bug in the C++ Kodi core? I am doing something wrong? Thanks a lot Big Grin
Reply
#2
i have no info on why, but '.dat' files are indeed treated as a special case in kodi core:
https://github.com/xbmc/xbmc/blob/master...pp#L39-L82

Quote:If extension is ".dat", filename format must be
"AVSEQ##(#).DAT", "ITEM###(#).DAT" or "MUSIC##(#).DAT".
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
it's not so much a bug as unforeseen/unwanted consequences. to prettify the file listings, .DAT files must pass the code https://github.com/xbmc/xbmc/blob/master...ry.cpp#L69

this is there to hide most files for vcd's. sadly it bites you here.

EDIT: wrote dvd where i meant vcd.
Reply
#4
fix suggested https://github.com/xbmc/xbmc/pull/11004
Reply
#5
Thanks a lot guys, appreciated.
Reply

Logout Mark Read Team Forum Stats Members Help
Cannot load .dat files with xbmcgui.Dialog.browse()0