History

player/loadfile: strip common filename part from external track title

It's most of the time redundant and there is no point to repeat it in `title`.

Kacper Michajłow committed 1 year ago

Commit 57210df1 parent 2d154311 file · +8 −1Browse files

Unified · Split

player/loadfile.c+8−1
@@ -903,7 +903,14 @@ int mp_add_external_file(struct MPContext *mpctx, char *filename, · 902 unmodified lines
903 if (sh->title && sh->title[0]) {903 if (sh->title && sh->title[0]) {
904 t->title = talloc_strdup(t, sh->title);904 t->title = talloc_strdup(t, sh->title);
905 } else {905 } else {
906 t->title = talloc_strdup(t, mp_basename(disp_filename));906 bstr parent = {0};
907 if (mpctx->filename)
908 parent = bstr_strip_ext(bstr0(mp_basename(mpctx->filename)));
909 bstr title = bstr0(mp_basename(disp_filename));
910 bstr_eatstart(&title, parent);
911 bstr_eatstart(&title, bstr0("."));
912 if (title.len)
913 t->title = bstrdup0(t, title);
907 }914 }
908 t->external_filename = mp_normalize_user_path(t, mpctx->global, filename);915 t->external_filename = mp_normalize_user_path(t, mpctx->global, filename);
909 t->no_default = sh->type != filter;916 t->no_default = sh->type != filter;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t