kosmosnautti / dltool

Tool to download contents of a DAT collection from Myrient
GNU General Public License v3.0
32 stars 3 forks source link

Issue when "game name" differs from "rom name" #7

Open Hooterman opened 5 months ago

Hooterman commented 5 months ago

There's a handful of systems where the "game name" and the "rom name" values differ for each entry. Example from the Sony - PlayStation 3 (PSN) (Content) dat:

<game name="Armored Core for Answer (Japan) (Demo)">
    <category>Demos</category>
    <description>Armored Core for Answer (Japan) (Demo)</description>
    <rom name="wRYnu4e4WDodGkBvXJtdC6IPfun6fLB2swDPQjFk7VP7UdBYSSD41u2DBqgo16TILWEjMvTlvRGVoJr9lPn1gl78Inyw5HLgLSPkJ.pkg" size="541446464" crc="767a742e" sha1="6f5819dc054cd3fa0501b7f8d40a4fe5c451bc1d" md5="9af08fa94c47b7554f0469fbe2835624"/>
</game>

It seems dltool searches for the rom name value, while Myrient only has the game name value. So even though the above example is on Myrient, dltool is not able to find it and prompts you to "grab these manually".

2024-06-04 13:36:58 | Amount of wanted ROMs in DAT-file   : 88
2024-06-04 13:36:58 | Amount of found ROMs at server      : 0
2024-06-04 13:36:58 | Amount of missing ROMs at server    : 88
2024-06-04 13:36:58 | Downloading complete!
2024-06-04 13:36:58 | Following 88 ROMs in DAT not automatically found from server, grab these manually:
2024-06-04 13:36:58 | wRYnu4e4WDodGkBvXJtdC6IPfun6fLB2swDPQjFk7VP7UdBYSSD41u2DBqgo16TILWEjMvTlvRGVoJr9lPn1gl78Inyw5HLgLSPkJ

Is there any way to have dltool search for the game name value instead?

alex-taxiera commented 4 months ago

@Hooterman I'm not sure if this will always work (would be nice if you'd test it), but you can change this line to rom = datchild.find('game') in order to have it try and read the name from the game field rather than rom.

Hooterman commented 4 months ago

@Hooterman I'm not sure if this will always work (would be nice if you'd test it), but you can change this line to rom = datchild.find('game') in order to have it try and read the name from the game field rather than rom.

Gave that a shot, get this error when running:

2024-06-30 13:01:25 | Opening input DAT-file...
2024-06-30 13:01:25 | Processing No-Intro: FixDat_Sony - PlayStation 3 (PSN) (Content)...
Traceback (most recent call last):
  File "D:\Rom Tools\dltool-main\dltool.py", line 137, in <module>
    filename = rom.attrib['name']
               ^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'attrib'
alex-taxiera commented 4 months ago

Can you post the dat you were using? I will test some stuff later

Hooterman commented 4 months ago

fixDat_Sony_Playstation 3_No-Intro_Sony - PlayStation 3 (PSN) (Content) (20240623-110732).zip

Here you go. Thanks!

alex-taxiera commented 4 months ago

@Hooterman this seems to be working, I had originally misunderstood the XML format.

remove this line (if you want, it won't matter with the other change) rom = datchild.find('rom') and replace the line after to be this: filename = datchild.attrib['name']

This will use the name field from the top level XML element which you posted in your OP.

Here was my example result with the change: image

Hooterman commented 4 months ago

@Hooterman this seems to be working, I had originally misunderstood the XML format.

remove this line (if you want, it won't matter with the other change) rom = datchild.find('rom') and replace the line after to be this: filename = datchild.attrib['name']

This will use the name field from the top level XML element which you posted in your OP.

Here was my example result with the change: image

That seems to be working great. Thank you!!