From 52e0186fc3edd55ab0bf441046b35bd4044ca38f Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sat, 15 Nov 2003 18:19:26 +0000 Subject: [PATCH] Added %N for the cue-to-chapter-name conversion routine (track number padded with a zero). --- doc/mkvmerge.1 | 7 +++++-- src/common/chapters.cpp | 6 +++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/doc/mkvmerge.1 b/doc/mkvmerge.1 index 0f042d13f..91b665bb4 100644 --- a/doc/mkvmerge.1 +++ b/doc/mkvmerge.1 @@ -66,9 +66,12 @@ for this name can be set. The following meta characters are supported: .br \fB%p\fR is replaced by the current entry's \fIPERFORMER\fR string, .br -\fB%t\fR is replaced by the current entry's \fITITLE\fR string and +\fB%t\fR is replaced by the current entry's \fITITLE\fR string, .br -\fB%n\fR is replaced by the current track number. +\fB%n\fR is replaced by the current track number and +.br +\fB%N\fR is replaced by the current track number padded with a leading zero if +it is < 10. .br Everything else is copied as-is. .br diff --git a/src/common/chapters.cpp b/src/common/chapters.cpp index c402930d3..1da3f9c27 100644 --- a/src/common/chapters.cpp +++ b/src/common/chapters.cpp @@ -283,7 +283,11 @@ static void cue_entries_to_chapter_name(string &performer, string &title, name += title; else if (*next_char == 'n') name += to_string(num); - else { + else if (*next_char == 'N') { + if (num < 10) + name += '0'; + name += to_string(num); + } else { name += *this_char; this_char--; }