Presets Download System - HoneyHazard/PixelMatchSwitcher GitHub Wiki

:construction: This feature is very fresh and is likely to undergo changes

Intro

  • Downloading presets allows convenient retrieval of presets from online servers. This makes it convenient for users to obtain presets that are shared and hosted on the web.
  • Use instructions should be straightforward and presented below.
  • The process of creating hosted presets is somewhat manual at the moment, and will be subject to further discussion and development.

Walkthrough

  1. Click the Download Preset(s) button:

    Download Presets Button

  2. Enter the URL of the preset XML (default URL is shown):

    Enter XML URL

  3. In the event of failures you will have a choice to retry:

    XML download failed

  4. Upon success you will have a choice of which presets to import:

    Select Presets

  5. After selecting one or more preset and clicking OK image retrieval begins:

    Images Progress

  6. You may encounter errors during image downloads and will have an option to retry:

    Images Failed

  7. Images are downloaded, successfully.

  8. It is possible you have a preset with the same name as the one being imported. You will have a choice to replace/rename/skip or abort the import alltogether:

    Preset Exists

  9. Upon successful import the details are shown:

    Finished

  10. The preset is now available for use

  11. If you ever delete the downloaded preset (and you haven't cloned it or shared its images with other presets), you will be prompted to delete the preset images:

    Remove Images

Implementation Details

:construction: Implementation details are subject to review and change

  • libcurl serves as a backend for all downloads, which allows retrieval from HTTP, HTTPS, FTP and more
    • It is already an OBS dependency and used by multiple modules
  • An XML file is hosted somewhere. It can contain one more multiple presets
  • User initiates retrieval by entering full URL of the XML file location:
    • ex: https://raw.githubusercontent.com/HoneyHazard/PixelMatchPresets/main/meta.xml
  • An XML file is downloaded and parsed into preset data structures. User is presented with a choice to import one, several, or all of the available presets.
  • For every selected preset, it's images are queued for download. Several threads work on downloading images.
  • Downloaded preset images are stored in the plugin's data folder.
    • On Windows this will be: %APPDATA%\obs-studio\plugin_config\PixelMatchSwitcher\presets
  • There will be a subfolder for every preset that combines its name with a hexagonal hash suffix that is based on the URL of origin
    • For example: Game_33b75e27 where Game is the name of the preset and the rest is URL hash.
  • User is able to cancel the retrieval process during the XML download or images download, and to retry in the event of failures.
  • The preset data structures are adjusted to use the downloaded and locally stored images, instead of URLs. The adjusted presets data structures are now saved into local configuration and available for use.
  • Just like when importing presets from XML, the user will have options to replace/rename/skip an incoming preset when a preset already exists with the same name.
  • Match images that were downloaded are flagged as such (in the preset data structures). In the event these images are "orphaned" (not used by any other preset or active match configuration) the user will be prompted to delete them from the plugin's data directory.
    • Examples of cases where downloaded images can become orphaned:
      • Match entry is removed
      • Match entry is modified to use another image that was not automatically downloaded
      • Preset is removed
      • Preset is overwritten