alucryd / oxyromon

Rusty ROM OrgaNizer
Other
109 stars 13 forks source link

[Feature] Allow setting system on import via parameter #120

Closed maxexcloo closed 3 months ago

maxexcloo commented 4 months ago

When importing I'd like to be able to set the system manually via the options - import-roms -s SYSTEMNAME ROMDIR for example.

alucryd commented 4 months ago

Could you elaborate on the use case? When I started matching the whole database it pretty much eliminated the need to specify a system, barring exceptions like arcade systems which have lots of duplicates.

TylerVigario commented 4 months ago

@alucryd I could be wrong, but I think @maxexcloo wants to enhance the already available -s argument to allow passing a string matching a system name. This is in contrast to having to use the keyboard after the command. A benefit would be allowing this command to be scripted, although I doubt this will have much real-world utility now with the new -u argument.

alucryd commented 4 months ago

I guess so, now that I added a -s flag to convert-roms that select systems based on a string, I'm not really fond of the -s flag of import-roms to have a different behavior, so I might as well rewrite it in import-roms so both of them match. I think I'll have to sleep on it.

alucryd commented 4 months ago

One thing to note, is that the -s flag in import-roms was initially there to isolate systems that are using headers. If switching to something that would potentially return several systems, I'll have to iterate over each of them. I don't think that'll be a deal breaker in terms of performance, but something to keep in mind still.

maxexcloo commented 4 months ago

It was initially a question I had because I was getting duplicates across systems and games and I figured it might be easiest to simply import say all the PS1 games at once and avoid this issue (or at least make it simpler to pick the correct game…)

maxexcloo commented 4 months ago

For example:

max.schaefer@mini:/Volumes/Data/media/games/test$ ~/Downloads/oxyromon/target/release/oxyromon import-roms import-b/
Processing "Alienfront Online (USA).chd"
CUE file not found
No match
Processing "NHL 2K2 (USA).cue"
Matches "NHL 2K2 (USA).cue"
Creating "/Users/max.schaefer/Emulation/Sega - Dreamcast"
Moving to "/Users/max.schaefer/Emulation/Sega - Dreamcast/NHL 2K2 (USA).cue"
Copying to "/Users/max.schaefer/Emulation/Sega - Dreamcast/NHL 2K2 (USA).cue"
Deleting "/Volumes/Data/media/games/test/import-b/Sega - Dreamcast/NHL 2K2 (USA)/NHL 2K2 (USA).cue"
Processing "NHL 2K2 (USA) (Track 1).bin"
Matches "NHL 2K2 (USA) (Track 1).bin"
Moving to "/Users/max.schaefer/Emulation/Sega - Dreamcast/NHL 2K2 (USA) (Track 1).bin"
Copying to "/Users/max.schaefer/Emulation/Sega - Dreamcast/NHL 2K2 (USA) (Track 1).bin"
Deleting "/Volumes/Data/media/games/test/import-b/Sega - Dreamcast/NHL 2K2 (USA)/NHL 2K2 (USA) (Track 1).bin"
Processing "NHL 2K2 (USA) (Track 2).bin"
⠂                                                                                                                                                                                                                                                                                                                                                                                                                                           Please select a ROM: [Page 1/3] 
> None
  AirForce Delta (USA) (Track 02).bin (AirForce Delta (USA)) [Sega - Dreamcast]
  Disney-Pixar Buzz Lightyear of Star Command (USA) (Track 2).bin (Disney-Pixar Buzz Lightyear of Star Command (USA)) [Sega - Dreamcast]
  Disney-Pixar Toy Story 2 - Buzz Lightyear to the Rescue! (USA) (Track 2).bin (Disney-Pixar Toy Story 2 - Buzz Lightyear to the Rescue! (USA)) [Sega - Dreamcast]
  Hydro Thunder (USA) (Rev 1) (Track 02).bin (Hydro Thunder (USA) (Rev 1)) [Sega - Dreamcast]
  Max Steel - Covert Missions (USA) (Track 2).bin (Max Steel - Covert Missions (USA)) [Sega - Dreamcast]
  Monaco Grand Prix (USA) (Track 02).bin (Monaco Grand Prix (USA)) [Sega - Dreamcast]
  NBA Showtime - NBA on NBC (USA) (Track 2).bin (NBA Showtime - NBA on NBC (USA)) [Sega - Dreamcast]
  NFL Blitz 2000 (USA) (Rev 1) (Track 2).bin (NFL Blitz 2000 (USA) (Rev 1)) [Sega - Dreamcast]
  NFL Blitz 2001 (USA) (Track 2).bin (NFL Blitz 2001 (USA)) [Sega - Dreamcast]
alucryd commented 4 months ago

That's not going to help with your example as it's all Dreamcast but I get the gist, thanks, I'll probably go with what I described above, that should help, and be more in line with the convert-roms interface.

Looking at your log, it seems I should silence some of the moving/copying/deleting lines while I'm at it, it happens when the source and destination aren't on the same filesystem (which is a setup I don't personally have, I have a single large LVM). Directly moving files at the system level isn't possible across filesystems, so oxyromon first attempts to move, then resorts to copying and deleting the original. I think I'll just silence copying/deleting when this is the case.

alucryd commented 4 months ago

Following the discussion on convert-roms, I'll also make this one accept multiple strings so multiple different systems can be selected if needed.

alucryd commented 4 months ago

Implemented in https://github.com/alucryd/oxyromon/commit/74c0fedd72f7ee86d5a468fed406be477fd008cc.

The -s flag now matches the behavior of convert-roms :)