command: only warn shared-script-properties once

Evidently I was wrong and mpv only actually warns once on deprecation
(playlist-pos nor display-fps did not and warned every time, but those
were outliers apparently). Someone complained so just hack it into
command_ctx for now.
This commit is contained in:
Dudemanguy 2023-09-27 13:48:40 -05:00
parent 1b4627f647
commit 5409274e6d
1 changed files with 6 additions and 2 deletions

View File

@ -110,6 +110,7 @@ struct command_ctx {
mpv_node udata;
double cached_window_scale;
bool shared_script_warning;
};
static const struct m_option script_props_type = {
@ -3617,8 +3618,11 @@ static int mp_property_script_props(void *ctx, struct m_property *prop,
{
MPContext *mpctx = ctx;
struct command_ctx *cmd = mpctx->command_ctx;
MP_WARN(mpctx, "The shared-script-properties property is deprecated and will "
"be removed in the future. Use the user-data property instead.\n");
if (!cmd->shared_script_warning) {
MP_WARN(mpctx, "The shared-script-properties property is deprecated and will "
"be removed in the future. Use the user-data property instead.\n");
cmd->shared_script_warning = true;
}
switch (action) {
case M_PROPERTY_GET_TYPE:
*(struct m_option *)arg = script_props_type;