mirror of https://github.com/mpv-player/mpv
command: print the number of chapters in show-text ${chapter-list}
Call cut_osd_list() like with ${playlist} to print position/count above the chapters. This is useful for movies with many chapters. Stop printing the chapter numbers because they are not useful here, they are only useful when navigating to a chapter. Remove one of the spaces before the circles because they are too many. This replicates osc-chapterlist before replacing it with show-text ${chapter-list}.
This commit is contained in:
parent
841b66d3ec
commit
89d78369c6
|
@ -1057,17 +1057,16 @@ static int mp_property_list_chapters(void *ctx, struct m_property *prop,
|
||||||
}
|
}
|
||||||
|
|
||||||
for (n = 0; n < count; n++) {
|
for (n = 0; n < count; n++) {
|
||||||
char *name = chapter_display_name(mpctx, n);
|
char *name = chapter_name(mpctx, n);
|
||||||
double t = chapter_start_time(mpctx, n);
|
double t = chapter_start_time(mpctx, n);
|
||||||
char* time = mp_format_time(t, false);
|
char* time = mp_format_time(t, false);
|
||||||
res = talloc_asprintf_append(res, "%s", time);
|
res = talloc_asprintf_append(res, "%s", time);
|
||||||
talloc_free(time);
|
talloc_free(time);
|
||||||
const char *m = n == cur ? list_current : list_normal;
|
const char *m = n == cur ? list_current : list_normal;
|
||||||
res = talloc_asprintf_append(res, " %s%s\n", m, name);
|
res = talloc_asprintf_append(res, " %s%s\n", m, name);
|
||||||
talloc_free(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*(char **)arg = res;
|
*(char **)arg = count ? cut_osd_list(mpctx, "Chapters", res, cur) : res;
|
||||||
return M_PROPERTY_OK;
|
return M_PROPERTY_OK;
|
||||||
}
|
}
|
||||||
case M_PROPERTY_SET: {
|
case M_PROPERTY_SET: {
|
||||||
|
|
Loading…
Reference in New Issue