Skip to content

Inner Workings

stoj edited this page Mar 29, 2023 · 15 revisions

Cleaner

Phase 1: Loading

  1. Parse the PinballX/Y DB to extract all the tables (aka games)

Phase 2: Checking

  1. For each configured "content type" (e.g. table audio, wheel images, etc)..
    1. Enumerate all files within the the configured "content folder"
    2. For each configured "file extension", process files with matching extension..
      1. For each file match against a table based on ALL the available criteria (i.e. ignoring configured "check criteria".. this is only used when rendering results)..
        1. Associate file against a table (aka 'hit')..
          • Exact: DB Description == file name (minus file extension). 'Description' only used for content files; png, mp3, etc.
          • Duplicate extension: more than 1 exact match (i.e. different file extensions)
          • Wrong case: DB description == file name igoring case
          • Table: DB TableFile == file name (minus file extension). 'TableFile' only be used for Vpin files; vpx, b2s, and pov.
          • Fuzzy: refer Fuzzy Logic
        2. Mark file as 'unknown' if none of the above criteia match.
    3. For files that don't match any configured extension..
      1. Mark file as 'unsupported' IF the check criteria is enabled.

Phase 3: Fixing

  1. For each table (from the DB)..
    1. For each configured content type..
      1. For each 'hit' (matching file) AND if the fix criteria option is active..
        1. Rename file: the closest configured match based on priority order..
          • Wrong case
          • Table name
          • Fuzzy
        2. Delete files: anyting that wasn't a exact match (or renamed file).
      2. Delete unknown and unsupported files: i.e. anything that wasn't designatd as a table 'hit'
  2. ALL renamed and deleted files are first copied to the backup folder and indexed against the current date/time.
  3. If the backup folder is empty (e.g. no fixed files), then delete the backup folder (and any sub-folders)

Merger

Phase 1: Loading

  1. Same as Cleaner

Phase 2: Checking

  1. Effectively the same as Cleaner, except..
    • the source folder is the folder specified in the merger setup, i.e. NOT the folder corresponding to the configured content type.
    • Content types is limited to one.
    • Match criteria types is reduced, e.g. "unknown files" is n/a.

Phase 3: Merging

  1. For each table (from the DB)..
    1. For the single configured content type..
      1. For each 'hit' (matching file) AND if the fix criteria option is active AND if the ignore option is not relevant..
        • Remove the existing file from the destination folder
        • Copy the new file from the source folder. Note, no attempt to 'clean' the file is performed.. the 'Cleaner' needs to be run again.
  2. File backup handling is the same as Cleaner.