From 9571a64133b78bca9e091ea8e3a9d579c821543f Mon Sep 17 00:00:00 2001 From: Shuanglei Tao Date: Mon, 8 Jan 2024 01:19:26 +0800 Subject: [PATCH] check for empty track lang --- lua/dyn_menu.lua | 5 +++-- src/menu.c | 2 +- src/menu.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lua/dyn_menu.lua b/lua/dyn_menu.lua index f57287c..e326922 100644 --- a/lua/dyn_menu.lua +++ b/lua/dyn_menu.lua @@ -47,9 +47,10 @@ local function abbr_title(str) end local function build_track_title(track, prefix, filename) + local type = track.type local title = track.title or '' + local lang = track.lang or '' local codec = escape_codec(track.codec) - local type = track.type if track.external and title ~= '' then if filename ~= '' then title = title:gsub(filename .. '%.?', '') end @@ -78,7 +79,7 @@ local function build_track_title(track, prefix, filename) if track.external then title = title .. ' (external)' end if track.default then title = title .. ' (*)' end - if track.lang then title = string.format('%s\t%s', title, track.lang:upper()) end + if lang ~= '' then title = string.format('%s\t%s', title, lang:upper()) end if prefix then title = string.format('%s: %s', type:sub(1, 1):upper(), title) end return title end diff --git a/src/menu.c b/src/menu.c index ce26cd7..8cc553d 100644 --- a/src/menu.c +++ b/src/menu.c @@ -271,7 +271,7 @@ void show_menu(plugin_ctx *ctx, POINT *pt) { } // run mpv command stored in menu item data -void handle_menu(plugin_ctx *ctx, int id) { +void handle_menu(plugin_ctx *ctx, UINT id) { MENUITEMINFOW mii = {0}; mii.cbSize = sizeof(mii); mii.fMask = MIIM_DATA; diff --git a/src/menu.h b/src/menu.h index e234a0a..9797e95 100644 --- a/src/menu.h +++ b/src/menu.h @@ -14,6 +14,6 @@ void load_menu(mpv_node *node, plugin_config *conf); void build_menu(void *talloc_ctx, HMENU hmenu, mpv_node *node); void update_menu(plugin_ctx *ctx, mpv_node *node); void show_menu(plugin_ctx *ctx, POINT *pt); -void handle_menu(plugin_ctx *ctx, int id); +void handle_menu(plugin_ctx *ctx, UINT id); #endif \ No newline at end of file