Skip to content

Commit

Permalink
check for empty track lang
Browse files Browse the repository at this point in the history
  • Loading branch information
tsl0922 committed Jan 7, 2024
1 parent c154245 commit 9571a64
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lua/dyn_menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 9571a64

Please sign in to comment.