lambdan / no_intro_dat_matcher

Pretty names for ROMs based on no_intro filenames
MIT License
12 stars 2 forks source link

Fails when dat has multiple roms per game #2

Open milnak opened 1 year ago

milnak commented 1 year ago

Example:

        <game name="Kid Vid Voice Module (USA) (Audio Tapes)">
                <description>Kid Vid Voice Module (USA) (Audio Tapes)</description>
                <rom name="KVB1.WAV" size="4219542" crc="33909225" md5="77b10df7d3e4796396e987e8f121bcc4" sha1="6a582aebcefd6e2a97bdd8968202aab985$
                <rom name="KVB2.WAV" size="9593878" crc="c3373775" md5="64fbcd99d2348cd6fdb1e04b9e275ed5" sha1="60a425c6bde3226ab731995562716321be$
                <rom name="KVB3.WAV" size="7676992" crc="ad7c821b" md5="9752e8697aa944b7b34f78af8595e9da" sha1="5e34125c4d6c209b21d1c892f3df0ec164$
                <rom name="KVS1.WAV" size="3436329" crc="ace0dfbc" md5="4e265258451af7cc7946ae0e2486bfd1" sha1="b094c2c1fca81a0e531e0541f302346150$
                <rom name="KVS2.WAV" size="2086275" crc="81da7f78" md5="abefa5b2a46efcb60400754cb2de6c7a" sha1="8b83b2eea01b3e08ceb885aeb153d4084b$
                <rom name="KVS3.WAV" size="3720920" crc="4d3c8575" md5="6a4f12a2ea946b35438f93478230e9ef" sha1="86896a1e272d8715489de9b407f0b8a42f$
                <rom name="KVSHARED.WAV" size="3059116" crc="fff1fb4d" md5="818525569cb66d481d9cd48c2b0f7360" sha1="9adf10cdf1de833b194c7d8797ad1f$
        </game>

When scanning, this will fail with:

Traceback (most recent call last):
  File "/home/pi/Downloads/no_intro_dat_matcher/no-intro-dat-matcher.py", line 173, in <module>
    destination = os.path.join(outfolder, g['rom']['@name'])
TypeError: list indices must be integers or slices, not str
milnak commented 1 year ago

it appears for this object, a 'list' is returned, and not a 'dict'.

Expecting something like:

{'@name': 'Keystone Kapers (USA).a26', '@size': '4096', '@crc': '3e55f3a1', '@md5': 'be929419902e21bd7830a7a7d746195d', '@sha1': '3eefc193dec3b242bcfd43f5a4d9f023e55378a4'}

Got:

[{'@name': 'KVB1.WAV', '@size': '4219542', '@crc': '33909225', '@md5': '77b10df7d3e4796396e987e8f121bcc4', '@sha1': '6a582aebcefd6e2a97bdd8968202aab9851a889c'}, {'@name': 'KVB2.WAV', '@size': '9593878', '@crc': 'c3373775', '@md5': '64fbcd99d2348cd6fdb1e04b9e275ed5', '@sha1': '60a425c6bde3226ab731995562716321be20fc49'}, {'@name': 'KVB3.WAV', '@size': '7676992', '@crc': 'ad7c821b', '@md5': '9752e8697aa944b7b34f78af8595e9da', '@sha1': '5e34125c4d6c209b21d1c892f3df0ec1644fd0d8'}, {'@name': 'KVS1.WAV', '@size': '3436329', '@crc': 'ace0dfbc', '@md5': '4e265258451af7cc7946ae0e2486bfd1', '@sha1': 'b094c2c1fca81a0e531e0541f302346150ec4604'}, {'@name': 'KVS2.WAV', '@size': '2086275', '@crc': '81da7f78', '@md5': 'abefa5b2a46efcb60400754cb2de6c7a', '@sha1': '8b83b2eea01b3e08ceb885aeb153d4084bddb63c'}, {'@name': 'KVS3.WAV', '@size': '3720920', '@crc': '4d3c8575', '@md5': '6a4f12a2ea946b35438f93478230e9ef', '@sha1': '86896a1e272d8715489de9b407f0b8a42f82d4a0'}, {'@name': 'KVSHARED.WAV', '@size': '3059116', '@crc': 'fff1fb4d', '@md5': '818525569cb66d481d9cd48c2b0f7360', '@sha1': '9adf10cdf1de833b194c7d8797ad1f041ad98dd3'}]