I've thought about this over the past days and like it a lot. Thank you for the suggestion.
I've also thought about the data schema for the JSON settings and came up with a slightly different version than you've suggested. I've used your existing settings to create an initial example settings schema:
{
"settings": [
{
"type": "string",
"key": "dateFormat",
"title": "DATE Format",
"description": "Format used for the DATE field.",
"choices": [
"YYYY-MM-DD",
"MMDD",
"DDMM"
],
"default": "YYYY-MM-DD"
},
{
"type": "string",
"key": "yearFormat",
"title": "YEAR Format",
"description": "Format used for the YEAR field.",
"choices": [
"YYYY-MM-DD",
"DD-MM-YYYY",
"YYYY"
],
"default": "YYYY-MM-DD"
},
{
"type": "bool",
"key": "genreRename",
"title": "Rename Genres",
"description": "'Progressive House' => 'House Progressive', 'Electro House' => 'House Electro', etc.",
"default": true
},
{
"type": "bool",
"key": "initialkeyAddPadding",
"title": "Add Padding to INITIALKEY",
"description": "8A => 08A, 7B => 07B, etc.",
"default": true
},
{
"type": "bool",
"key": "initialkeyAddPadding",
"title": "Add Padding to INITIALKEY",
"description": "8A => 08A, 7B => 07B, etc.",
"default": true
},
{
"type": "string",
"key": "initialkeyFormat",
"title": "INITIALKEY Format",
"description": "Format used for the INITIALKEY field.",
"choices": [
"camelot",
"musical"
],
"default": "camelot"
},
{
"type": "bool",
"key": "totaltracksAddPadding",
"title": "Add Padding to TOTALTRACKS",
"default": true
},
{
"type": "bool",
"key": "trackAddPadding",
"title": "Add Padding to TRACK",
"default": true
},
{
"type": "bool",
"key": "trackTotaltracksAppend",
"title": "Append TOTALTRACKS to TRACK",
"description": "1/10, 2/10, 3/10 etc.",
"default": true
}
]
}
What I currently have in mind is that this information is stored in, e.g.,
Beatport by &stevehero v6#SETTINGS.settings
which can be referenced in, e.g.,
Beatport by &stevehero v6_Release Search.inc
via a new key
[Settings]=Beatport by &stevehero v6#SETTINGS.settings
to make the settings available to the WS.
The actual values that are configured by the user should most likely be stored in a separate file, e.g.,
Beatport by &stevehero v6#SETTINGS.user
as simple key-value pairs, e.g.,
{
"dateFormat": "MMDD",
"genreRename": false
}
This ensures that you can add new configuration options with future versions of the WS without the need to ask users to copy the additions to their settings file. It would just use the default if there is no value for the added key in the .user
file.
I've also thought about how to access the settings and think a dedicated function
IfVar "key" "value"
would be best. With the examples above, you'd use
IfVar "dateFormat" "MMDD"
...
Else
...
Endif
or
IfVar "genreRename" "true"
...
Else
...
Endif
I still need to implement all that, maybe without the dynamic generation of the UI in the first iteration. But I wanted to share this, so that you and others can potentially comment on my initial ideas.