alucryd / oxyromon

Rusty ROM OrgaNizer
Other
114 stars 14 forks source link

No-Intro name parsing library that might be useful #7

Closed chyyran closed 3 years ago

chyyran commented 3 years ago

Hi there, I saw your project when I was publishing my crate shiratsu-naming and thought it might have some use for oxyromon.

I use shiratsu-naming to parse NoIntro, GoodTools and TOSEC names when generating DAT file databases. I've recently given it a rewrite and refactored it out into its own library. From my own testing it handles edge cases fairly well, and supports all three naming conventions.

Feel free to ask me any questions, or on the other hand, close this issue if you're not interested.

alucryd commented 3 years ago

Hey, that could be useful indeed, right now I'm using standard regexes to extract what I need, but who knows what I'll have to extract from those names in the future. I'll give your library a go, thanks!

alucryd commented 3 years ago

@chyyran I found a possible bug.

The Sega Genesis dat contains a game from Argentina Truco '96 (Argentina) (Unl). The region is correctly serialized to AR, but deserialization fails with BadRegionCode(TOSEC, 0, 0).

I see Argentina is not listed in the TOSEC documentation, and thus missing from your TOSEC_REGION constant. Would it be possible to include it?

chyyran commented 3 years ago

Thanks for catching that, should be fixed as of 0.1.3.

Added this test to confirm

    #[test]
    fn parse_argentina()
    {
        assert_eq!(do_parse("Truco '96 (Argentina) (Unl)"),
        Ok(("",
            vec![NoIntroToken::Title("Truco '96"),
            NoIntroToken::Region(vec!["Argentina"], vec![Region::Argentina]),
            NoIntroToken::Flag(FlagType::Parenthesized, "Unl")]
        )));

        assert_eq!(Ok(String::from("Truco '96 (Argentina) (Unl)")), NoIntroName
            ::try_parse("Truco '96 (Argentina) (Unl)").map(|s| s.to_string()));

        assert_eq!("AR", Region::Argentina.as_ref());
        assert_eq!("AR", Region::to_normalized_region_string(&[Region::Argentina]));
        assert_eq!(Ok(vec![Region::Argentina]), Region::try_from_tosec_region("AR"));
    }
alucryd commented 3 years ago

Awesome, thanks for the quick fix!

alucryd commented 3 years ago

Pushed the integration earlier today 84186bbb8946996ea644bdc0fc371b83728e30db.

Thanks for sharing your work!

chyyran commented 3 years ago

No problem, glad it was useful!

On Thu., Apr. 1, 2021, 12:55 p.m. Maxime Gauduin, @.***> wrote:

Pushed the integration earlier today 84186bb https://github.com/alucryd/oxyromon/commit/84186bbb8946996ea644bdc0fc371b83728e30db .

Thanks for sharing your work!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/alucryd/oxyromon/issues/7#issuecomment-812039952, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHUIN2B7DOZRMHLUSRJFLLTGSQPVANCNFSM42C2G2LA .