feat: add else clause and value modifiers to file naming patterns (#2724)
This commit is contained in:
@@ -32,6 +32,7 @@ public class PathPatternResolver {
|
||||
private final Pattern CONTROL_CHARACTER_PATTERN = Pattern.compile("\\p{Cntrl}");
|
||||
private final Pattern INVALID_CHARS_PATTERN = Pattern.compile("[\\\\/:*?\"<>|]");
|
||||
private final Pattern PLACEHOLDER_PATTERN = Pattern.compile("\\{(.*?)}");
|
||||
private final Pattern MODIFIER_PLACEHOLDER_PATTERN = Pattern.compile("\\{([^}:]+)(?::([^}]+))?}");
|
||||
private final Pattern COMMA_SPACE_PATTERN = Pattern.compile(", ");
|
||||
private final Pattern SLASH_PATTERN = Pattern.compile("/");
|
||||
|
||||
@@ -154,32 +155,27 @@ public class PathPatternResolver {
|
||||
|
||||
values.put("extension", extension);
|
||||
|
||||
// Handle optional blocks enclosed in <...>
|
||||
// Handle optional blocks enclosed in <...>, supporting else clause via pipe: <left|right>
|
||||
Pattern optionalBlockPattern = Pattern.compile("<([^<>]*)>");
|
||||
Matcher matcher = optionalBlockPattern.matcher(pattern);
|
||||
StringBuilder resolved = new StringBuilder(1024);
|
||||
|
||||
while (matcher.find()) {
|
||||
String block = matcher.group(1);
|
||||
Matcher placeholderMatcher = PLACEHOLDER_PATTERN.matcher(block);
|
||||
boolean allHaveValues = true;
|
||||
String blockContent = matcher.group(1);
|
||||
|
||||
// Check if all placeholders inside optional block have non-blank values
|
||||
while (placeholderMatcher.find()) {
|
||||
String key = placeholderMatcher.group(1);
|
||||
String value = values.getOrDefault(key, "");
|
||||
if (value.isBlank()) {
|
||||
allHaveValues = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Split on first unescaped pipe for else clause
|
||||
int pipeIndex = blockContent.indexOf('|');
|
||||
String primaryBlock = pipeIndex >= 0 ? blockContent.substring(0, pipeIndex) : blockContent;
|
||||
String fallbackBlock = pipeIndex >= 0 ? blockContent.substring(pipeIndex + 1) : null;
|
||||
|
||||
boolean allHaveValues = checkAllPlaceholdersHaveValues(primaryBlock, values);
|
||||
|
||||
if (allHaveValues) {
|
||||
String resolvedBlock = block;
|
||||
for (Map.Entry<String, String> entry : values.entrySet()) {
|
||||
resolvedBlock = resolvedBlock.replace("{" + entry.getKey() + "}", entry.getValue());
|
||||
}
|
||||
String resolvedBlock = resolveBlockPlaceholders(primaryBlock, values);
|
||||
matcher.appendReplacement(resolved, Matcher.quoteReplacement(resolvedBlock));
|
||||
} else if (fallbackBlock != null) {
|
||||
String resolvedFallback = resolveBlockPlaceholders(fallbackBlock, values);
|
||||
matcher.appendReplacement(resolved, Matcher.quoteReplacement(resolvedFallback));
|
||||
} else {
|
||||
matcher.appendReplacement(resolved, "");
|
||||
}
|
||||
@@ -188,18 +184,22 @@ public class PathPatternResolver {
|
||||
|
||||
String result = resolved.toString();
|
||||
|
||||
// Replace known placeholders with values, preserve unknown ones
|
||||
Matcher placeholderMatcher = PLACEHOLDER_PATTERN.matcher(result);
|
||||
// Replace known placeholders (with optional modifiers) with values, preserve unknown ones
|
||||
Matcher placeholderMatcher = MODIFIER_PLACEHOLDER_PATTERN.matcher(result);
|
||||
StringBuilder finalResult = new StringBuilder(1024);
|
||||
|
||||
while (placeholderMatcher.find()) {
|
||||
String key = placeholderMatcher.group(1);
|
||||
if (values.containsKey(key)) {
|
||||
String replacement = values.get(key);
|
||||
String fieldName = placeholderMatcher.group(1);
|
||||
String modifier = placeholderMatcher.group(2);
|
||||
if (values.containsKey(fieldName)) {
|
||||
String replacement = values.get(fieldName);
|
||||
if (modifier != null && !modifier.isEmpty()) {
|
||||
replacement = applyModifier(replacement, modifier, fieldName);
|
||||
}
|
||||
placeholderMatcher.appendReplacement(finalResult, Matcher.quoteReplacement(replacement));
|
||||
} else {
|
||||
// Preserve unknown placeholders (e.g., {foo})
|
||||
placeholderMatcher.appendReplacement(finalResult, Matcher.quoteReplacement("{" + key + "}"));
|
||||
placeholderMatcher.appendReplacement(finalResult, Matcher.quoteReplacement(placeholderMatcher.group()));
|
||||
}
|
||||
}
|
||||
placeholderMatcher.appendTail(finalResult);
|
||||
@@ -223,6 +223,67 @@ public class PathPatternResolver {
|
||||
return validateFinalPath(result, folderBased);
|
||||
}
|
||||
|
||||
private boolean checkAllPlaceholdersHaveValues(String block, Map<String, String> values) {
|
||||
Matcher placeholderMatcher = MODIFIER_PLACEHOLDER_PATTERN.matcher(block);
|
||||
while (placeholderMatcher.find()) {
|
||||
String fieldName = placeholderMatcher.group(1);
|
||||
String value = values.getOrDefault(fieldName, "");
|
||||
if (value.isBlank()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private String resolveBlockPlaceholders(String block, Map<String, String> values) {
|
||||
Matcher m = MODIFIER_PLACEHOLDER_PATTERN.matcher(block);
|
||||
StringBuilder sb = new StringBuilder(256);
|
||||
while (m.find()) {
|
||||
String fieldName = m.group(1);
|
||||
String modifier = m.group(2);
|
||||
String replacement = values.getOrDefault(fieldName, "");
|
||||
if (modifier != null && !modifier.isEmpty()) {
|
||||
replacement = applyModifier(replacement, modifier, fieldName);
|
||||
}
|
||||
m.appendReplacement(sb, Matcher.quoteReplacement(replacement));
|
||||
}
|
||||
m.appendTail(sb);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private String applyModifier(String value, String modifier, String fieldName) {
|
||||
if (value == null || value.isEmpty()) {
|
||||
return value;
|
||||
}
|
||||
return switch (modifier) {
|
||||
case "first" -> {
|
||||
String[] parts = COMMA_SPACE_PATTERN.split(value);
|
||||
yield parts[0].trim();
|
||||
}
|
||||
case "sort" -> {
|
||||
String firstItem = COMMA_SPACE_PATTERN.split(value)[0].trim();
|
||||
int lastSpace = firstItem.lastIndexOf(' ');
|
||||
if (lastSpace > 0) {
|
||||
yield firstItem.substring(lastSpace + 1) + ", " + firstItem.substring(0, lastSpace);
|
||||
}
|
||||
yield firstItem;
|
||||
}
|
||||
case "initial" -> {
|
||||
String target = value;
|
||||
if ("authors".equals(fieldName)) {
|
||||
// For authors, use the first letter of the last name of the first author
|
||||
String firstAuthor = COMMA_SPACE_PATTERN.split(value)[0].trim();
|
||||
int lastSpace = firstAuthor.lastIndexOf(' ');
|
||||
target = lastSpace > 0 ? firstAuthor.substring(lastSpace + 1) : firstAuthor;
|
||||
}
|
||||
yield target.substring(0, 1).toUpperCase();
|
||||
}
|
||||
case "upper" -> value.toUpperCase();
|
||||
case "lower" -> value.toLowerCase();
|
||||
default -> value;
|
||||
};
|
||||
}
|
||||
|
||||
private String sanitize(String input) {
|
||||
if (input == null) return "";
|
||||
return WHITESPACE_PATTERN.matcher(CONTROL_CHARACTER_PATTERN.matcher(INVALID_CHARS_PATTERN.matcher(input).replaceAll("")).replaceAll("")).replaceAll(" ")
|
||||
|
||||
@@ -279,4 +279,146 @@ class PathPatternResolverTest {
|
||||
assertThat(PathPatternResolver.resolvePattern(book1, pattern)).isEqualTo("Title - Subtitle.epub");
|
||||
assertThat(PathPatternResolver.resolvePattern(book2, pattern)).isEqualTo("file.epub");
|
||||
}
|
||||
|
||||
// ===== Else Clause Tests =====
|
||||
|
||||
@Test void elseClause_leftSideWhenPresent() {
|
||||
var book = createBook("Title", List.of("Author"), null, "Series", 1f, null, null, null, null, "f.epub");
|
||||
assertThat(PathPatternResolver.resolvePattern(book, "<{series}|Standalone>/{title}")).isEqualTo("Series/Title.epub");
|
||||
}
|
||||
|
||||
@Test void elseClause_fallbackWhenMissing() {
|
||||
var book = createBook("Title", List.of("Author"), null, null, null, null, null, null, null, "f.epub");
|
||||
assertThat(PathPatternResolver.resolvePattern(book, "<{series}|Standalone>/{title}")).isEqualTo("Standalone/Title.epub");
|
||||
}
|
||||
|
||||
@Test void elseClause_fallbackWithPlaceholders() {
|
||||
var book = createBook("Title", List.of("Author"), null, null, null, null, null, null, null, "f.epub");
|
||||
assertThat(PathPatternResolver.resolvePattern(book, "<{series}/{seriesIndex} - {title}|{title}>")).isEqualTo("Title.epub");
|
||||
}
|
||||
|
||||
@Test void elseClause_backwardCompatibleNoPipe() {
|
||||
var book = createBook("Title", List.of("Author"), null, null, null, null, null, null, null, "f.epub");
|
||||
assertThat(PathPatternResolver.resolvePattern(book, "<{series}/>{title}")).isEqualTo("Title.epub");
|
||||
}
|
||||
|
||||
@Test void elseClause_mixedBlocksWithAndWithoutElse() {
|
||||
var book = createBook("Title", List.of("Author"), null, null, null, null, null, null, null, "f.epub");
|
||||
assertThat(PathPatternResolver.resolvePattern(book, "<{series}|Standalone>/<{year} - >{title}")).isEqualTo("Standalone/Title.epub");
|
||||
}
|
||||
|
||||
// ===== Modifier Tests =====
|
||||
|
||||
@Test void modifier_firstMultipleAuthors() {
|
||||
var book = createBook("Title", List.of("Patrick Rothfuss", "Brandon Sanderson"), null, null, null, null, null, null, null, "f.epub");
|
||||
assertThat(PathPatternResolver.resolvePattern(book, "{authors:first}/{title}")).isEqualTo("Patrick Rothfuss/Title.epub");
|
||||
}
|
||||
|
||||
@Test void modifier_sortAuthor() {
|
||||
var book = createBook("Title", List.of("Patrick Rothfuss"), null, null, null, null, null, null, null, "f.epub");
|
||||
assertThat(PathPatternResolver.resolvePattern(book, "{authors:sort}/{title}")).isEqualTo("Rothfuss, Patrick/Title.epub");
|
||||
}
|
||||
|
||||
@Test void modifier_initialTitle() {
|
||||
var book = createBook("The Name of the Wind", List.of("Author"), null, null, null, null, null, null, null, "f.epub");
|
||||
assertThat(PathPatternResolver.resolvePattern(book, "{title:initial}/{title}")).isEqualTo("T/The Name of the Wind.epub");
|
||||
}
|
||||
|
||||
@Test void modifier_initialAuthorsUsesLastName() {
|
||||
var book = createBook("Title", List.of("Patrick Rothfuss"), null, null, null, null, null, null, null, "f.epub");
|
||||
assertThat(PathPatternResolver.resolvePattern(book, "{authors:initial}/{authors:sort}/{title}")).isEqualTo("R/Rothfuss, Patrick/Title.epub");
|
||||
}
|
||||
|
||||
@Test void modifier_upper() {
|
||||
var book = createBook("Title", List.of("Author"), null, null, null, null, null, null, null, "f.epub");
|
||||
assertThat(PathPatternResolver.resolvePattern(book, "{title:upper}")).isEqualTo("TITLE.epub");
|
||||
}
|
||||
|
||||
@Test void modifier_lower() {
|
||||
var book = createBook("Title", List.of("Author"), null, null, null, null, null, null, null, "f.epub");
|
||||
assertThat(PathPatternResolver.resolvePattern(book, "{title:lower}")).isEqualTo("title.epub");
|
||||
}
|
||||
|
||||
@Test void modifier_insideElseClause() {
|
||||
var book = createBook("Title", List.of("Patrick Rothfuss"), null, null, null, null, null, null, null, "f.epub");
|
||||
assertThat(PathPatternResolver.resolvePattern(book, "<{series}|{authors:sort}>/{title}")).isEqualTo("Rothfuss, Patrick/Title.epub");
|
||||
}
|
||||
|
||||
@Test void modifier_inOptionalBlock() {
|
||||
var book = createBook("Title", List.of("Patrick Rothfuss"), null, null, null, null, null, null, null, "f.epub");
|
||||
assertThat(PathPatternResolver.resolvePattern(book, "<{authors:sort}/>{title}")).isEqualTo("Rothfuss, Patrick/Title.epub");
|
||||
}
|
||||
|
||||
// ===== Edge Case Tests =====
|
||||
|
||||
@Test void modifier_sortThreeWordName() {
|
||||
var book = createBook("T", List.of("Mary Jane Watson"), null, null, null, null, null, null, null, "f.epub");
|
||||
assertThat(PathPatternResolver.resolvePattern(book, "{authors:sort}/{title}")).isEqualTo("Watson, Mary Jane/T.epub");
|
||||
}
|
||||
|
||||
@Test void modifier_initialSingleWordAuthor() {
|
||||
var book = createBook("T", List.of("Plato"), null, null, null, null, null, null, null, "f.epub");
|
||||
assertThat(PathPatternResolver.resolvePattern(book, "{authors:initial}/{title}")).isEqualTo("P/T.epub");
|
||||
}
|
||||
|
||||
@Test void elseClause_multipleBlocks() {
|
||||
var book = createBook("Title", List.of("Author"), null, null, null, null, null, null, null, "f.epub");
|
||||
assertThat(PathPatternResolver.resolvePattern(book, "<{series}|Standalone>/<{year}|Unknown> - {title}"))
|
||||
.isEqualTo("Standalone/Unknown - Title.epub");
|
||||
}
|
||||
|
||||
@Test void elseClause_emptyFallback() {
|
||||
var book = createBook("Title", List.of("Author"), null, null, null, null, null, null, null, "f.epub");
|
||||
assertThat(PathPatternResolver.resolvePattern(book, "<{series}|>{title}")).isEqualTo("Title.epub");
|
||||
}
|
||||
|
||||
@Test void elseClause_primaryPartiallyMissing() {
|
||||
var book = createBook("Title", List.of("Author"), null, "Series", null, null, null, null, null, "f.epub");
|
||||
// series present but seriesIndex missing → fallback
|
||||
assertThat(PathPatternResolver.resolvePattern(book, "<{series} #{seriesIndex}|{title}>")).isEqualTo("Title.epub");
|
||||
}
|
||||
|
||||
@Test void modifier_inPrimarySideOfElseClause() {
|
||||
var book = createBook("Title", List.of("Patrick Rothfuss"), null, "Series", null, null, null, null, null, "f.epub");
|
||||
assertThat(PathPatternResolver.resolvePattern(book, "<{series} by {authors:sort}|{title}>"))
|
||||
.isEqualTo("Series by Rothfuss, Patrick.epub");
|
||||
}
|
||||
|
||||
@Test void modifier_chainedDifferentFields() {
|
||||
var book = createBook("Title", List.of("Patrick Rothfuss"), null, null, null, null, null, null, null, "f.epub");
|
||||
assertThat(PathPatternResolver.resolvePattern(book, "{title:initial}/{authors:first}/{title:lower}"))
|
||||
.isEqualTo("T/Patrick Rothfuss/title.epub");
|
||||
}
|
||||
|
||||
@Test void modifier_onMissingFieldInOptionalBlock() {
|
||||
var book = createBook("Title", null, null, null, null, null, null, null, null, "f.epub");
|
||||
assertThat(PathPatternResolver.resolvePattern(book, "<{authors:sort}/>{title}")).isEqualTo("Title.epub");
|
||||
}
|
||||
|
||||
@Test void modifier_firstWithManyAuthors() {
|
||||
var book = createBook("Title", List.of("Alice", "Bob", "Carol", "Dave"), null, null, null, null, null, null, null, "f.epub");
|
||||
assertThat(PathPatternResolver.resolvePattern(book, "{authors:first}/{title}")).isEqualTo("Alice/Title.epub");
|
||||
}
|
||||
|
||||
@Test void modifier_withElseClauseAndExtensionPlaceholder() {
|
||||
var book = createBook("Title", List.of("Jane Doe"), null, null, null, null, null, null, null, "f.epub");
|
||||
assertThat(PathPatternResolver.resolvePattern(book, "<{series:upper}|{authors:sort}>/{title}.{extension}"))
|
||||
.isEqualTo("Doe, Jane/Title.epub");
|
||||
}
|
||||
|
||||
@Test void modifier_initialLowercaseTitle() {
|
||||
var book = createBook("lowercase title", List.of("Author"), null, null, null, null, null, null, null, "f.epub");
|
||||
assertThat(PathPatternResolver.resolvePattern(book, "{title:initial}/{title}")).isEqualTo("L/lowercase title.epub");
|
||||
}
|
||||
|
||||
@Test void elseClause_primaryCompleteIgnoresFallback() {
|
||||
var book = createBook("Title", List.of("Author"), null, "Series", 5f, null, null, null, null, "f.epub");
|
||||
assertThat(PathPatternResolver.resolvePattern(book, "<{series} #{seriesIndex}|{title}>")).isEqualTo("Series #05.epub");
|
||||
}
|
||||
|
||||
@Test void elseClause_existingPatternsUnchanged() {
|
||||
var book = createBook("Title", List.of("Author"), LocalDate.of(2023, 1, 1), "Series", 1f, null, null, null, null, "f.epub");
|
||||
assertThat(PathPatternResolver.resolvePattern(book, "{authors}/<{series}/><{seriesIndex}. >{title}< ({year})>"))
|
||||
.isEqualTo("Author/Series/01. Title (2023).epub");
|
||||
}
|
||||
}
|
||||
@@ -890,6 +890,434 @@ class PathPatternResolverTest {
|
||||
"Result bytes should be <= " + MAX_FILENAME_BYTES);
|
||||
}
|
||||
|
||||
// ===== Else Clause Tests =====
|
||||
|
||||
@Test
|
||||
@DisplayName("Else clause: should use left side when values are present")
|
||||
void testElseClause_leftSideUsedWhenPresent() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Book Title")
|
||||
.seriesName("My Series")
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata, "<{series}|Standalone>/{title}", "original.pdf");
|
||||
|
||||
assertEquals("My Series/Book Title.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Else clause: should use fallback when values are missing")
|
||||
void testElseClause_fallbackUsedWhenMissing() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Book Title")
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata, "<{series}|Standalone>/{title}", "original.pdf");
|
||||
|
||||
assertEquals("Standalone/Book Title.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Else clause: fallback can contain placeholders")
|
||||
void testElseClause_fallbackWithPlaceholders() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Book Title")
|
||||
.authors(Set.of("John Doe"))
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata, "<{series}/{seriesIndex} - {title}|{title}>", "original.pdf");
|
||||
|
||||
assertEquals("Book Title.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Else clause: backward compatible without pipe")
|
||||
void testElseClause_backwardCompatibleNoPipe() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Book Title")
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata, "<{series}/>{title}", "original.pdf");
|
||||
|
||||
assertEquals("Book Title.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Else clause: literal text in fallback")
|
||||
void testElseClause_literalFallback() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Book Title")
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata, "<{series}|No Series>/{title}", "original.pdf");
|
||||
|
||||
assertEquals("No Series/Book Title.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Else clause: mixed blocks with and without else")
|
||||
void testElseClause_mixedBlocks() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Book Title")
|
||||
.authors(Set.of("Author"))
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata, "<{series}|Standalone>/<{year} - >{title}", "original.pdf");
|
||||
|
||||
assertEquals("Standalone/Book Title.pdf", result);
|
||||
}
|
||||
|
||||
// ===== Modifier Tests =====
|
||||
|
||||
@Test
|
||||
@DisplayName("Modifier: first with multiple authors")
|
||||
void testModifier_firstMultipleAuthors() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Book Title")
|
||||
.authors(new LinkedHashSet<>(List.of("Patrick Rothfuss", "Brandon Sanderson")))
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata, "{authors:first}/{title}", "original.pdf");
|
||||
|
||||
assertEquals("Patrick Rothfuss/Book Title.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Modifier: first with single author")
|
||||
void testModifier_firstSingleAuthor() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Book Title")
|
||||
.authors(Set.of("Patrick Rothfuss"))
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata, "{authors:first}/{title}", "original.pdf");
|
||||
|
||||
assertEquals("Patrick Rothfuss/Book Title.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Modifier: sort transforms 'First Last' to 'Last, First'")
|
||||
void testModifier_sort() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Book Title")
|
||||
.authors(Set.of("Patrick Rothfuss"))
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata, "{authors:sort}/{title}", "original.pdf");
|
||||
|
||||
assertEquals("Rothfuss, Patrick/Book Title.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Modifier: sort with single-word author name")
|
||||
void testModifier_sortSingleWord() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Book Title")
|
||||
.authors(Set.of("Plato"))
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata, "{authors:sort}/{title}", "original.pdf");
|
||||
|
||||
assertEquals("Plato/Book Title.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Modifier: initial on title")
|
||||
void testModifier_initialTitle() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("The Name of the Wind")
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata, "{title:initial}/{title}", "original.pdf");
|
||||
|
||||
assertEquals("T/The Name of the Wind.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Modifier: initial on authors uses first letter of last name")
|
||||
void testModifier_initialAuthors() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Book Title")
|
||||
.authors(Set.of("Patrick Rothfuss"))
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata, "{authors:initial}/{authors:sort}/{title}", "original.pdf");
|
||||
|
||||
assertEquals("R/Rothfuss, Patrick/Book Title.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Modifier: upper")
|
||||
void testModifier_upper() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Book Title")
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata, "{title:upper}", "original.pdf");
|
||||
|
||||
assertEquals("BOOK TITLE.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Modifier: lower")
|
||||
void testModifier_lower() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Book Title")
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata, "{title:lower}", "original.pdf");
|
||||
|
||||
assertEquals("book title.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Modifier: unknown modifier passes through unchanged")
|
||||
void testModifier_unknownPassesThrough() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Book Title")
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata, "{title:reverse}", "original.pdf");
|
||||
|
||||
assertEquals("Book Title.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Modifier inside else clause fallback")
|
||||
void testModifier_insideElseClause() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Book Title")
|
||||
.authors(Set.of("Patrick Rothfuss"))
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata, "<{series}|{authors:sort}>/{title}", "original.pdf");
|
||||
|
||||
assertEquals("Rothfuss, Patrick/Book Title.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Modifier in optional block with present values")
|
||||
void testModifier_inOptionalBlock() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Book Title")
|
||||
.authors(Set.of("Patrick Rothfuss"))
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata, "<{authors:sort}/>{title}", "original.pdf");
|
||||
|
||||
assertEquals("Rothfuss, Patrick/Book Title.pdf", result);
|
||||
}
|
||||
|
||||
// ===== Edge Case Tests =====
|
||||
|
||||
@Test
|
||||
@DisplayName("Modifier: sort with three-word author name uses last word as last name")
|
||||
void testModifier_sortThreeWordName() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Book Title")
|
||||
.authors(Set.of("Mary Jane Watson"))
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata, "{authors:sort}/{title}", "original.pdf");
|
||||
|
||||
assertEquals("Watson, Mary Jane/Book Title.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Modifier: initial on single-word author name uses that name")
|
||||
void testModifier_initialSingleWordAuthor() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Book Title")
|
||||
.authors(Set.of("Plato"))
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata, "{authors:initial}/{title}", "original.pdf");
|
||||
|
||||
assertEquals("P/Book Title.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Modifier: first on non-authors field takes first comma-separated value")
|
||||
void testModifier_firstOnNonAuthorsField() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Intro, Outro, Epilogue")
|
||||
.build();
|
||||
|
||||
// The title contains commas, but they are sanitized first (commas are allowed chars).
|
||||
// However, sanitize doesn't remove commas, so :first should split on ", "
|
||||
String result = PathPatternResolver.resolvePattern(metadata, "{title:first}", "original.pdf");
|
||||
|
||||
// The title value after sanitize is "Intro, Outro, Epilogue" and first splits on ", "
|
||||
assertEquals("Intro.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Modifier: sort on non-authors field still works (splits on last space)")
|
||||
void testModifier_sortOnTitle() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("The Wind")
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata, "{title:sort}", "original.pdf");
|
||||
|
||||
assertEquals("Wind, The.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Multiple else clause blocks in same pattern")
|
||||
void testElseClause_multipleBlocks() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Book Title")
|
||||
.authors(Set.of("Author"))
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata,
|
||||
"<{series}|Standalone>/<{year}|Unknown Year> - {title}", "original.pdf");
|
||||
|
||||
assertEquals("Standalone/Unknown Year - Book Title.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Else clause with empty fallback produces empty string")
|
||||
void testElseClause_emptyFallback() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Book Title")
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata, "<{series}|>{title}", "original.pdf");
|
||||
|
||||
assertEquals("Book Title.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Else clause: primary side partially missing with multiple placeholders triggers fallback")
|
||||
void testElseClause_primaryPartiallyMissing() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Book Title")
|
||||
.seriesName("My Series")
|
||||
// seriesIndex is null
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata,
|
||||
"<{series} #{seriesIndex}|{title}>", "original.pdf");
|
||||
|
||||
// series present but seriesIndex missing → fallback to {title}
|
||||
assertEquals("Book Title.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Modifier in primary side of else clause with all values present")
|
||||
void testModifier_inPrimarySideOfElseClause() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Book Title")
|
||||
.authors(Set.of("Patrick Rothfuss"))
|
||||
.seriesName("My Series")
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata,
|
||||
"<{series} by {authors:sort}|{title}>", "original.pdf");
|
||||
|
||||
assertEquals("My Series by Rothfuss, Patrick.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Chained modifiers on different fields in same pattern")
|
||||
void testModifier_chainedDifferentFields() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Book Title")
|
||||
.authors(Set.of("Patrick Rothfuss"))
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata,
|
||||
"{title:initial}/{authors:first}/{title:lower}", "original.pdf");
|
||||
|
||||
assertEquals("B/Patrick Rothfuss/book title.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Modifier on field used in optional block where field is missing - block should be removed")
|
||||
void testModifier_onMissingFieldInOptionalBlock() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Book Title")
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata,
|
||||
"<{authors:sort}/>{title}", "original.pdf");
|
||||
|
||||
assertEquals("Book Title.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Modifier: first with truncated author list preserves first author")
|
||||
void testModifier_firstWithManyAuthors() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Book Title")
|
||||
.authors(new LinkedHashSet<>(List.of("Alice", "Bob", "Carol", "Dave")))
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata, "{authors:first}/{title}", "original.pdf");
|
||||
|
||||
assertEquals("Alice/Book Title.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Modifier combined with else clause and extension check")
|
||||
void testModifier_withElseClauseAndExtension() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("My Book")
|
||||
.authors(Set.of("Jane Doe"))
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata,
|
||||
"<{series:upper}|{authors:sort}>/{title}.{extension}", "original.epub");
|
||||
|
||||
assertEquals("Doe, Jane/My Book.epub", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Modifier: initial on lowercase title produces uppercase letter")
|
||||
void testModifier_initialLowercaseTitle() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("lowercase title")
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata, "{title:initial}/{title}", "original.pdf");
|
||||
|
||||
assertEquals("L/lowercase title.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Else clause with all primary values present ignores fallback")
|
||||
void testElseClause_primaryCompleteIgnoresFallback() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Book Title")
|
||||
.seriesName("My Series")
|
||||
.seriesNumber(5f)
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata,
|
||||
"<{series} #{seriesIndex}|{title}>", "original.pdf");
|
||||
|
||||
assertEquals("My Series #05.pdf", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Else clause preserves backward compatibility with existing patterns")
|
||||
void testElseClause_existingPatternsUnchanged() {
|
||||
BookMetadata metadata = BookMetadata.builder()
|
||||
.title("Book Title")
|
||||
.authors(Set.of("Author"))
|
||||
.seriesName("Series")
|
||||
.seriesNumber(1f)
|
||||
.publishedDate(LocalDate.of(2023, 1, 1))
|
||||
.build();
|
||||
|
||||
String result = PathPatternResolver.resolvePattern(metadata,
|
||||
"{authors}/<{series}/><{seriesIndex}. >{title}< ({year})>", "original.epub");
|
||||
|
||||
assertEquals("Author/Series/01. Book Title (2023).epub", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Should remove leading slash from resolved pattern if first component is empty")
|
||||
void testResolvePattern_removesLeadingSlash_whenFirstComponentIsEmpty() {
|
||||
|
||||
+167
-57
@@ -197,6 +197,47 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="placeholder-group">
|
||||
<h4 class="group-title">
|
||||
<i class="pi pi-replay"></i>
|
||||
{{ t('placeholders.elseClause') }}
|
||||
</h4>
|
||||
<p class="group-description" [innerHTML]="t('placeholders.elseDesc')">
|
||||
</p>
|
||||
<div class="example-block">
|
||||
<div class="example-pattern">
|
||||
<span class="pattern-prefix">{{ t('placeholders.pattern') }}</span>
|
||||
<code>{{ '{<{series}|Standalone>/{title}' }}</code>
|
||||
</div>
|
||||
<div class="example-results">
|
||||
<div class="result-item">
|
||||
<span class="result-prefix">{{ t('placeholders.withSeries') }}</span>
|
||||
<code>The Kingkiller Chronicle/The Name of the Wind</code>
|
||||
</div>
|
||||
<div class="result-item">
|
||||
<span class="result-prefix">{{ t('placeholders.withoutSeries') }}</span>
|
||||
<code>Standalone/The Name of the Wind</code>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="placeholder-group">
|
||||
<h4 class="group-title">
|
||||
<i class="pi pi-wrench"></i>
|
||||
{{ t('placeholders.modifiers') }}
|
||||
</h4>
|
||||
<p class="group-description" [innerHTML]="t('placeholders.modifiersDesc')">
|
||||
</p>
|
||||
<div class="placeholder-list">
|
||||
<div class="placeholder-item"><code>{{ '{authors:first}' }}</code><span>{{ t('placeholders.modFirst') }}</span></div>
|
||||
<div class="placeholder-item"><code>{{ '{authors:sort}' }}</code><span>{{ t('placeholders.modSort') }}</span></div>
|
||||
<div class="placeholder-item"><code>{{ '{title:initial}' }}</code><span>{{ t('placeholders.modInitial') }}</span></div>
|
||||
<div class="placeholder-item"><code>{{ '{title:upper}' }}</code><span>{{ t('placeholders.modUpper') }}</span></div>
|
||||
<div class="placeholder-item"><code>{{ '{title:lower}' }}</code><span>{{ t('placeholders.modLower') }}</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -214,44 +255,57 @@
|
||||
|
||||
<div class="section-body">
|
||||
<div class="examples-container">
|
||||
<div class="example-category">
|
||||
<div class="category-header">
|
||||
<h4 class="category-title">
|
||||
<i class="pi pi-check-circle"></i>
|
||||
{{ t('examples.withFull') }}
|
||||
</h4>
|
||||
<div class="sample-metadata">
|
||||
<div class="metadata-items">
|
||||
<span><strong>title:</strong> <code>The Name of the Wind</code></span>
|
||||
<span><strong>subtitle:</strong> <code>Special Edition</code></span>
|
||||
<span><strong>authors:</strong> <code>Patrick Rothfuss</code></span>
|
||||
<span><strong>series:</strong> <code>The Kingkiller Chronicle</code></span>
|
||||
<span><strong>seriesIndex:</strong> <code>01</code></span>
|
||||
<span><strong>year:</strong> <code>2007</code></span>
|
||||
</div>
|
||||
<div class="metadata-reference">
|
||||
<div class="metadata-panel metadata-panel-full">
|
||||
<div class="metadata-panel-header">
|
||||
<i class="pi pi-check-circle metadata-icon-full"></i>
|
||||
<span>{{ t('examples.fullMetadata') }}</span>
|
||||
</div>
|
||||
<div class="metadata-grid">
|
||||
<span class="metadata-key">title</span><code class="metadata-val">The Name of the Wind</code>
|
||||
<span class="metadata-key">subtitle</span><code class="metadata-val">Special Edition</code>
|
||||
<span class="metadata-key">authors</span><code class="metadata-val">Patrick Rothfuss</code>
|
||||
<span class="metadata-key">series</span><code class="metadata-val">The Kingkiller Chronicle</code>
|
||||
<span class="metadata-key">seriesIndex</span><code class="metadata-val">01</code>
|
||||
<span class="metadata-key">year</span><code class="metadata-val">2007</code>
|
||||
</div>
|
||||
</div>
|
||||
<div class="metadata-panel metadata-panel-partial">
|
||||
<div class="metadata-panel-header">
|
||||
<i class="pi pi-question-circle metadata-icon-partial"></i>
|
||||
<span>{{ t('examples.partialMetadata') }}</span>
|
||||
</div>
|
||||
<div class="metadata-grid">
|
||||
<span class="metadata-key">title</span><code class="metadata-val">Project Hail Mary</code>
|
||||
<span class="metadata-key">subtitle</span><em class="metadata-val not-set">{{ t('examples.notSet') }}</em>
|
||||
<span class="metadata-key">authors</span><code class="metadata-val">Andy Weir</code>
|
||||
<span class="metadata-key">year</span><code class="metadata-val">2021</code>
|
||||
<span class="metadata-key">series</span><em class="metadata-val not-set">{{ t('examples.notSet') }}</em>
|
||||
<span class="metadata-key">seriesIndex</span><em class="metadata-val not-set">{{ t('examples.notSet') }}</em>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="example-category">
|
||||
<h4 class="category-title">
|
||||
<i class="pi pi-hashtag"></i>
|
||||
{{ t('examples.basicGroup') }}
|
||||
</h4>
|
||||
<div class="example-grid">
|
||||
<div class="example-row">
|
||||
<span class="pattern-label">{{ t('examples.basicPattern') }}</span>
|
||||
<span class="pattern-col"><code>{{ '{authors} - {title}' }}</code></span>
|
||||
<span class="result-col"><code>Patrick Rothfuss - The Name of the Wind.epub</code></span>
|
||||
</div>
|
||||
<div class="example-row">
|
||||
<span class="pattern-label">{{ t('examples.withPunctuation') }}</span>
|
||||
<span class="pattern-col"><code>{{ '{title}: {series}' }}</code></span>
|
||||
<span class="result-col"><code>The Name of the Wind: The Kingkiller Chronicle.epub</code></span>
|
||||
</div>
|
||||
<div class="example-row">
|
||||
<span class="pattern-label">{{ t('examples.seriesInFolder') }}</span>
|
||||
<span class="pattern-col"><code>{{ '{authors}/{series}/{seriesIndex} - {title}' }}</code></span>
|
||||
<span class="result-col"><code>Patrick Rothfuss/The Kingkiller Chronicle/01 - The Name of the Wind.epub</code></span>
|
||||
</div>
|
||||
<div class="example-row">
|
||||
<span class="pattern-label">{{ t('examples.folderOnly') }}</span>
|
||||
<span class="pattern-col"><code>{{ '{title}/' }}</code></span>
|
||||
<span class="result-col"><code>The Name of the Wind/name_of_the_wind_original.epub</code></span>
|
||||
<span class="pattern-label">{{ t('examples.titleSubtitle') }}</span>
|
||||
<span class="pattern-col"><code>{{ '{title}: {subtitle}' }}</code></span>
|
||||
<span class="result-col"><code>The Name of the Wind: Special Edition.epub</code></span>
|
||||
</div>
|
||||
<div class="example-row">
|
||||
<span class="pattern-label">{{ t('examples.absolutePath') }}</span>
|
||||
@@ -259,9 +313,14 @@
|
||||
<span class="result-col"><code>/Patrick Rothfuss/The Name of the Wind.epub</code></span>
|
||||
</div>
|
||||
<div class="example-row">
|
||||
<span class="pattern-label">{{ t('examples.titleSubtitle') }}</span>
|
||||
<span class="pattern-col"><code>{{ '{title}: {subtitle}' }}</code></span>
|
||||
<span class="result-col"><code>The Name of the Wind: Special Edition.epub</code></span>
|
||||
<span class="pattern-label">{{ t('examples.folderOnly') }}</span>
|
||||
<span class="pattern-col"><code>{{ '{title}/' }}</code></span>
|
||||
<span class="result-col"><code>The Name of the Wind/name_of_the_wind_original.epub</code></span>
|
||||
</div>
|
||||
<div class="example-row">
|
||||
<span class="pattern-label">{{ t('examples.yearPrefix') }}</span>
|
||||
<span class="pattern-col"><code>{{ '({year}) {title}' }}</code></span>
|
||||
<span class="result-col"><code>(2007) The Name of the Wind.epub</code></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -269,53 +328,104 @@
|
||||
<div class="section-divider"><hr></div>
|
||||
|
||||
<div class="example-category">
|
||||
<div class="category-header">
|
||||
<h4 class="category-title">
|
||||
<i class="pi pi-question-circle"></i>
|
||||
{{ t('examples.withMissing') }}
|
||||
</h4>
|
||||
<div class="sample-metadata">
|
||||
<div class="metadata-items">
|
||||
<span><strong>title:</strong> <code>Project Hail Mary</code></span>
|
||||
<span><strong>subtitle:</strong> <em class="not-set">{{ t('examples.notSet') }}</em></span>
|
||||
<span><strong>authors:</strong> <code>Andy Weir</code></span>
|
||||
<span><strong>year:</strong> <code>2021</code></span>
|
||||
<span><strong>series:</strong> <em class="not-set">{{ t('examples.notSet') }}</em></span>
|
||||
<span><strong>seriesIndex:</strong> <em class="not-set">{{ t('examples.notSet') }}</em></span>
|
||||
<h4 class="category-title">
|
||||
<i class="pi pi-code"></i>
|
||||
{{ t('examples.conditionalGroup') }}
|
||||
</h4>
|
||||
<div class="example-grid">
|
||||
<div class="example-row-conditional">
|
||||
<span class="pattern-label">{{ t('examples.optionalBlock') }}</span>
|
||||
<span class="pattern-col"><code>{{ '<{seriesIndex}. >{title}' }}</code></span>
|
||||
<div class="result-col-dual">
|
||||
<span class="result-with"><i class="pi pi-check-circle"></i> <code>01. The Name of the Wind.epub</code></span>
|
||||
<span class="result-without"><i class="pi pi-question-circle"></i> <code>Project Hail Mary.epub</code></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="example-row-conditional">
|
||||
<span class="pattern-label">{{ t('examples.subtitleConditional') }}</span>
|
||||
<span class="pattern-col"><code>{{ '{title}<: {subtitle}>' }}</code></span>
|
||||
<div class="result-col-dual">
|
||||
<span class="result-with"><i class="pi pi-check-circle"></i> <code>The Name of the Wind: Special Edition.epub</code></span>
|
||||
<span class="result-without"><i class="pi pi-question-circle"></i> <code>Project Hail Mary.epub</code></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="example-row-conditional">
|
||||
<span class="pattern-label">{{ t('examples.multipleOptional') }}</span>
|
||||
<span class="pattern-col"><code>{{ '{authors}/<{series}/><{seriesIndex}. >{title}< ({year})>' }}</code></span>
|
||||
<div class="result-col-dual">
|
||||
<span class="result-with"><i class="pi pi-check-circle"></i> <code>Patrick Rothfuss/The Kingkiller Chronicle/01. The Name of the Wind (2007).epub</code></span>
|
||||
<span class="result-without"><i class="pi pi-question-circle"></i> <code>Andy Weir/Project Hail Mary (2021).epub</code></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="example-row-conditional">
|
||||
<span class="pattern-label">{{ t('examples.elseClause') }}</span>
|
||||
<span class="pattern-col"><code>{{ '<{series}|Standalone>/{title}' }}</code></span>
|
||||
<div class="result-col-dual">
|
||||
<span class="result-with"><i class="pi pi-check-circle"></i> <code>The Kingkiller Chronicle/The Name of the Wind.epub</code></span>
|
||||
<span class="result-without"><i class="pi pi-question-circle"></i> <code>Standalone/Project Hail Mary.epub</code></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="example-row-conditional">
|
||||
<span class="pattern-label">{{ t('examples.elseClauseFallback') }}</span>
|
||||
<span class="pattern-col"><code>{{ '<{series}/{seriesIndex} - {title}|{title}>' }}</code></span>
|
||||
<div class="result-col-dual">
|
||||
<span class="result-with"><i class="pi pi-check-circle"></i> <code>The Kingkiller Chronicle/01 - The Name of the Wind.epub</code></span>
|
||||
<span class="result-without"><i class="pi pi-question-circle"></i> <code>Project Hail Mary.epub</code></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="example-row-conditional">
|
||||
<span class="pattern-label">{{ t('examples.elseWithModifier') }}</span>
|
||||
<span class="pattern-col"><code>{{ '<{series}|{authors:sort}>/{title}' }}</code></span>
|
||||
<div class="result-col-dual">
|
||||
<span class="result-with"><i class="pi pi-check-circle"></i> <code>The Kingkiller Chronicle/The Name of the Wind.epub</code></span>
|
||||
<span class="result-without"><i class="pi pi-question-circle"></i> <code>Weir, Andy/Project Hail Mary.epub</code></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-divider"><hr></div>
|
||||
|
||||
<div class="example-category">
|
||||
<h4 class="category-title">
|
||||
<i class="pi pi-wrench"></i>
|
||||
{{ t('examples.modifiersGroup') }}
|
||||
</h4>
|
||||
<div class="example-grid">
|
||||
<div class="example-row">
|
||||
<span class="pattern-label">{{ t('examples.optionalBlocks') }}</span>
|
||||
<span class="pattern-col"><code>{{ '{authors}/<{series}/><{seriesIndex}. >{title}< ({year})>' }}</code></span>
|
||||
<span class="result-col"><code>Andy Weir/Project Hail Mary (2021).epub</code></span>
|
||||
<span class="pattern-label">{{ t('examples.modifierSort') }}</span>
|
||||
<span class="pattern-col"><code>{{ '{authors:sort}/{title}' }}</code></span>
|
||||
<span class="result-col"><code>Rothfuss, Patrick/The Name of the Wind.epub</code></span>
|
||||
</div>
|
||||
<div class="example-row">
|
||||
<span class="pattern-label">{{ t('examples.seriesIndexFallback') }}</span>
|
||||
<span class="pattern-col"><code>{{ '<{seriesIndex}. >{title}< - {authors}>' }}</code></span>
|
||||
<span class="result-col"><code>Project Hail Mary - Andy Weir.epub</code></span>
|
||||
<span class="pattern-label">{{ t('examples.modifierInitial') }}</span>
|
||||
<span class="pattern-col"><code>{{ '{authors:initial}/{authors:sort}/{title}' }}</code></span>
|
||||
<span class="result-col"><code>R/Rothfuss, Patrick/The Name of the Wind.epub</code></span>
|
||||
</div>
|
||||
<div class="example-row">
|
||||
<span class="pattern-label">{{ t('examples.bracketsFallback') }}</span>
|
||||
<span class="pattern-col"><code>{{ '<[{series}] >{title} - {authors}' }}</code></span>
|
||||
<span class="result-col"><code>Project Hail Mary - Andy Weir.epub</code></span>
|
||||
<span class="pattern-label">{{ t('examples.modFirst') }}</span>
|
||||
<span class="pattern-col"><code>{{ '{authors:first}/{title}' }}</code></span>
|
||||
<span class="result-col"><code>Patrick Rothfuss/The Name of the Wind.epub</code></span>
|
||||
</div>
|
||||
<div class="example-row">
|
||||
<span class="pattern-label">{{ t('examples.seriesPunctuation') }}</span>
|
||||
<span class="pattern-col"><code>{{ '<{series}: >{title} by {authors}' }}</code></span>
|
||||
<span class="result-col"><code>Project Hail Mary by Andy Weir.epub</code></span>
|
||||
<span class="pattern-label">{{ t('examples.modUpper') }}</span>
|
||||
<span class="pattern-col"><code>{{ '{title:upper}' }}</code></span>
|
||||
<span class="result-col"><code>THE NAME OF THE WIND.epub</code></span>
|
||||
</div>
|
||||
<div class="example-row">
|
||||
<span class="pattern-label">{{ t('examples.yearPrefix') }}</span>
|
||||
<span class="pattern-col"><code>{{ '{authors}/{year}__{currentFilename}' }}</code></span>
|
||||
<span class="result-col"><code>Andy Weir/2021__project_hail_mary_final.epub</code></span>
|
||||
<span class="pattern-label">{{ t('examples.modLower') }}</span>
|
||||
<span class="pattern-col"><code>{{ '{title:lower}' }}</code></span>
|
||||
<span class="result-col"><code>the name of the wind.epub</code></span>
|
||||
</div>
|
||||
<div class="example-row">
|
||||
<span class="pattern-label">{{ t('examples.subtitleFallback') }}</span>
|
||||
<span class="pattern-col"><code>{{ '{title}<: {subtitle}>' }}</code></span>
|
||||
<span class="result-col"><code>Project Hail Mary.epub</code></span>
|
||||
<span class="pattern-label">{{ t('examples.letterFolder') }}</span>
|
||||
<span class="pattern-col"><code>{{ '{title:initial}/{authors}/{title}' }}</code></span>
|
||||
<span class="result-col"><code>T/Patrick Rothfuss/The Name of the Wind.epub</code></span>
|
||||
</div>
|
||||
<div class="example-row">
|
||||
<span class="pattern-label">{{ t('examples.combinedMods') }}</span>
|
||||
<span class="pattern-col"><code>{{ '{authors:sort} - {title:lower}' }}</code></span>
|
||||
<span class="result-col"><code>Rothfuss, Patrick - the name of the wind.epub</code></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+137
-44
@@ -371,16 +371,91 @@
|
||||
gap: 1.5rem;
|
||||
}
|
||||
|
||||
.metadata-reference {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 1rem;
|
||||
margin-bottom: 0.5rem;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
.metadata-panel {
|
||||
background: color-mix(in srgb, var(--ground-background) 50%, var(--p-surface-800) 50%);
|
||||
padding: 1rem 1.25rem;
|
||||
border-radius: 6px;
|
||||
border-left: 3px solid var(--p-content-border-color);
|
||||
|
||||
&.metadata-panel-full {
|
||||
border-left-color: var(--p-green-400);
|
||||
}
|
||||
|
||||
&.metadata-panel-partial {
|
||||
border-left-color: var(--p-orange-400);
|
||||
}
|
||||
}
|
||||
|
||||
.metadata-panel-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
font-size: settings.$settings-label-size;
|
||||
font-weight: 600;
|
||||
color: var(--p-text-color);
|
||||
margin-bottom: 0.875rem;
|
||||
padding-bottom: 0.625rem;
|
||||
border-bottom: 1px solid color-mix(in srgb, var(--p-content-border-color) 50%, transparent);
|
||||
|
||||
.pi {
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
}
|
||||
|
||||
.metadata-icon-full {
|
||||
color: var(--p-green-400);
|
||||
}
|
||||
|
||||
.metadata-icon-partial {
|
||||
color: var(--p-orange-400);
|
||||
}
|
||||
|
||||
.metadata-grid {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
gap: 0.5rem 0.75rem;
|
||||
font-size: settings.$settings-section-description-size;
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
.metadata-key {
|
||||
color: var(--p-text-muted-color);
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
|
||||
&::after {
|
||||
content: ':';
|
||||
}
|
||||
}
|
||||
|
||||
.metadata-val {
|
||||
color: var(--p-text-color);
|
||||
font-size: settings.$settings-description-size;
|
||||
|
||||
&.not-set {
|
||||
opacity: 0.5;
|
||||
font-style: italic;
|
||||
color: var(--p-text-muted-color);
|
||||
}
|
||||
}
|
||||
|
||||
.example-category {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.category-header {
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
.category-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -388,48 +463,11 @@
|
||||
font-size: settings.$settings-label-size;
|
||||
font-weight: 600;
|
||||
color: var(--p-text-color);
|
||||
margin: 0 0 0.5rem 0;
|
||||
margin: 0;
|
||||
|
||||
.pi {
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.pi-check-circle {
|
||||
color: var(--p-green-400);
|
||||
}
|
||||
|
||||
.pi-question-circle {
|
||||
color: var(--p-orange-400);
|
||||
}
|
||||
}
|
||||
|
||||
.sample-metadata {
|
||||
background: color-mix(in srgb, var(--ground-background) 50%, var(--p-surface-800) 50%);
|
||||
padding: 0.75rem 1rem;
|
||||
border-radius: 4px;
|
||||
border-left: 3px solid var(--p-content-border-color);
|
||||
}
|
||||
|
||||
.metadata-items {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem 1rem;
|
||||
font-size: settings.$settings-section-description-size;
|
||||
color: var(--p-text-muted-color);
|
||||
|
||||
strong {
|
||||
color: var(--p-text-color);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
code {
|
||||
color: var(--p-text-color);
|
||||
font-size: settings.$settings-description-size;
|
||||
}
|
||||
|
||||
.not-set {
|
||||
opacity: 0.6;
|
||||
font-style: italic;
|
||||
color: var(--p-primary-color);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -452,7 +490,22 @@
|
||||
@media (max-width: 1024px) {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 0.375rem;
|
||||
padding: 0.625rem 0.75rem;
|
||||
}
|
||||
}
|
||||
|
||||
.example-row-conditional {
|
||||
display: grid;
|
||||
grid-template-columns: 130px 1fr 1fr;
|
||||
gap: 0.75rem;
|
||||
padding: 0.625rem 0.75rem;
|
||||
background: color-mix(in srgb, var(--ground-background) 50%, var(--p-surface-800) 50%);
|
||||
border-radius: 4px;
|
||||
font-size: settings.$settings-section-description-size;
|
||||
align-items: start;
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 0.375rem;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -491,3 +544,43 @@
|
||||
border-left: 2px solid var(--p-green-400);
|
||||
}
|
||||
}
|
||||
|
||||
.result-col-dual {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.375rem;
|
||||
|
||||
code {
|
||||
font-size: settings.$settings-description-size;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.pi {
|
||||
font-size: 0.625rem;
|
||||
margin-right: 0.25rem;
|
||||
}
|
||||
}
|
||||
|
||||
.result-with {
|
||||
color: var(--p-green-400);
|
||||
|
||||
.pi {
|
||||
color: var(--p-green-400);
|
||||
}
|
||||
|
||||
code {
|
||||
color: var(--p-green-400);
|
||||
}
|
||||
}
|
||||
|
||||
.result-without {
|
||||
color: var(--p-orange-400);
|
||||
|
||||
.pi {
|
||||
color: var(--p-orange-400);
|
||||
}
|
||||
|
||||
code {
|
||||
color: var(--p-orange-400);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-11
@@ -12,6 +12,7 @@ import {InputText} from 'primeng/inputtext';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
import {ExternalDocLinkComponent} from '../../../shared/components/external-doc-link/external-doc-link.component';
|
||||
import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/transloco';
|
||||
import {replacePlaceholders} from '../../../shared/util/pattern-resolver';
|
||||
|
||||
@Component({
|
||||
selector: 'app-file-naming-pattern',
|
||||
@@ -58,15 +59,8 @@ export class FileNamingPatternComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
private replacePlaceholders(pattern: string, values: Record<string, string>): string {
|
||||
pattern = pattern.replace(/<([^<>]+)>/g, (_, block) => {
|
||||
const placeholders = [...block.matchAll(/{(.*?)}/g)].map((m) => m[1]);
|
||||
const allHaveValues = placeholders.every((key) => values[key]?.trim());
|
||||
return allHaveValues
|
||||
? block.replace(/{(.*?)}/g, (_: string, key: string) => values[key] ?? '')
|
||||
: '';
|
||||
});
|
||||
return pattern.replace(/{(.*?)}/g, (_, key) => values[key] ?? '').trim();
|
||||
private resolvePattern(pattern: string, values: Record<string, string>): string {
|
||||
return replacePlaceholders(pattern, values);
|
||||
}
|
||||
|
||||
private appendExtensionIfMissing(path: string, ext = '.pdf'): string {
|
||||
@@ -76,7 +70,7 @@ export class FileNamingPatternComponent implements OnInit {
|
||||
}
|
||||
|
||||
private generatePreview(pattern: string): string {
|
||||
let path = this.replacePlaceholders(pattern || '', this.exampleMetadata);
|
||||
let path = this.resolvePattern(pattern || '', this.exampleMetadata);
|
||||
|
||||
if (!path) return '/original_filename.pdf';
|
||||
if (path.endsWith('/')) return path + 'original_filename.pdf';
|
||||
@@ -97,7 +91,7 @@ export class FileNamingPatternComponent implements OnInit {
|
||||
}
|
||||
|
||||
validatePattern(pattern: string): boolean {
|
||||
const validPatternRegex = /^[\w\s\-{}\[\]\/().<>.,:'"#]*$/;
|
||||
const validPatternRegex = /^[\w\s\-{}\[\]\/().<>.,:'"#|]*$/;
|
||||
return validPatternRegex.test(pattern);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import {LibraryService} from "../../../features/book/service/library.service";
|
||||
import {AppSettingsService} from '../../service/app-settings.service';
|
||||
import {Select} from 'primeng/select';
|
||||
import {Library, LibraryPath} from '../../../features/book/model/library.model';
|
||||
import {replacePlaceholders} from '../../util/pattern-resolver';
|
||||
|
||||
interface FilePreview {
|
||||
bookId: number;
|
||||
@@ -267,15 +268,7 @@ export class FileMoverComponent implements OnDestroy {
|
||||
if (!pattern?.trim()) {
|
||||
newPath = fileName;
|
||||
} else {
|
||||
newPath = pattern.replace(/<([^<>]+)>/g, (_, block) => {
|
||||
const placeholders = [...block.matchAll(/{(.*?)}/g)].map(m => m[1]);
|
||||
const allHaveValues = placeholders.every(key => values[key]?.trim());
|
||||
return allHaveValues
|
||||
? block.replace(/{(.*?)}/g, (_: string, key: string) => values[key] ?? '')
|
||||
: '';
|
||||
});
|
||||
|
||||
newPath = newPath.replace(/{(.*?)}/g, (_, key) => values[key] ?? '');
|
||||
newPath = replacePlaceholders(pattern, values);
|
||||
|
||||
if (!newPath.endsWith(extension)) {
|
||||
newPath += extension;
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
const MODIFIER_PLACEHOLDER_REGEX = /\{([^}:]+)(?::([^}]+))?}/g;
|
||||
|
||||
export function applyModifier(value: string, modifier: string, fieldName: string): string {
|
||||
if (!value) return value;
|
||||
|
||||
switch (modifier) {
|
||||
case 'first':
|
||||
return value.split(', ')[0].trim();
|
||||
case 'sort': {
|
||||
const first = value.split(', ')[0].trim();
|
||||
const lastSpace = first.lastIndexOf(' ');
|
||||
return lastSpace > 0 ? `${first.substring(lastSpace + 1)}, ${first.substring(0, lastSpace)}` : first;
|
||||
}
|
||||
case 'initial': {
|
||||
let target = value;
|
||||
if (fieldName === 'authors') {
|
||||
const firstAuthor = value.split(', ')[0].trim();
|
||||
const lastSpace = firstAuthor.lastIndexOf(' ');
|
||||
target = lastSpace > 0 ? firstAuthor.substring(lastSpace + 1) : firstAuthor;
|
||||
}
|
||||
return target.charAt(0).toUpperCase();
|
||||
}
|
||||
case 'upper':
|
||||
return value.toUpperCase();
|
||||
case 'lower':
|
||||
return value.toLowerCase();
|
||||
default:
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
function resolveModifierPlaceholders(block: string, values: Record<string, string>): string {
|
||||
return block.replace(MODIFIER_PLACEHOLDER_REGEX, (_, fieldName: string, modifier?: string) => {
|
||||
const val = values[fieldName] ?? '';
|
||||
return modifier ? applyModifier(val, modifier, fieldName) : val;
|
||||
});
|
||||
}
|
||||
|
||||
function checkAllPlaceholdersPresent(block: string, values: Record<string, string>): boolean {
|
||||
const matches = [...block.matchAll(MODIFIER_PLACEHOLDER_REGEX)];
|
||||
return matches.every(m => values[m[1]]?.trim());
|
||||
}
|
||||
|
||||
export function replacePlaceholders(pattern: string, values: Record<string, string>): string {
|
||||
// Handle optional blocks with else clause: <primary|fallback>
|
||||
pattern = pattern.replace(/<([^<>]+)>/g, (_, blockContent: string) => {
|
||||
const pipeIndex = blockContent.indexOf('|');
|
||||
const primary = pipeIndex >= 0 ? blockContent.substring(0, pipeIndex) : blockContent;
|
||||
const fallback = pipeIndex >= 0 ? blockContent.substring(pipeIndex + 1) : null;
|
||||
|
||||
if (checkAllPlaceholdersPresent(primary, values)) {
|
||||
return resolveModifierPlaceholders(primary, values);
|
||||
}
|
||||
return fallback != null ? resolveModifierPlaceholders(fallback, values) : '';
|
||||
});
|
||||
|
||||
// Replace remaining top-level placeholders (with optional modifiers)
|
||||
return resolveModifierPlaceholders(pattern, values).trim();
|
||||
}
|
||||
@@ -47,25 +47,46 @@
|
||||
"optionalDesc": "Wrap parts in angle brackets <code>{{syntax}}</code> to make them conditional. If any placeholder in the block has no value, the entire block is omitted.",
|
||||
"pattern": "Pattern:",
|
||||
"withIndex": "With index:",
|
||||
"without": "Without:"
|
||||
"without": "Without:",
|
||||
"elseClause": "Else Clause",
|
||||
"elseDesc": "Add a fallback after a pipe <code>|</code> inside an optional block. If the primary side has missing values, the fallback is used instead.",
|
||||
"withSeries": "With series:",
|
||||
"withoutSeries": "Without series:",
|
||||
"modifiers": "Value Modifiers",
|
||||
"modifiersDesc": "Append <code>:modifier</code> to a placeholder to transform its value. Example: <code>{authors:sort}</code>",
|
||||
"modFirst": "First author only",
|
||||
"modSort": "\"Last, First\" format",
|
||||
"modInitial": "First letter, uppercased",
|
||||
"modUpper": "UPPERCASE",
|
||||
"modLower": "lowercase"
|
||||
},
|
||||
"examples": {
|
||||
"sectionTitle": "Pattern Examples",
|
||||
"sectionDesc": "Sample patterns with example metadata to help you understand how patterns work.",
|
||||
"withFull": "With Full Metadata",
|
||||
"withMissing": "With Missing Optional Fields",
|
||||
"fullMetadata": "Full Metadata",
|
||||
"partialMetadata": "Partial Metadata",
|
||||
"notSet": "not set",
|
||||
"basicGroup": "Basic Patterns",
|
||||
"conditionalGroup": "Conditional Blocks",
|
||||
"modifiersGroup": "Value Modifiers",
|
||||
"basicPattern": "Basic pattern",
|
||||
"withPunctuation": "With punctuation",
|
||||
"seriesInFolder": "Series in folder",
|
||||
"folderOnly": "Folder only",
|
||||
"absolutePath": "Absolute path",
|
||||
"titleSubtitle": "Title + Subtitle",
|
||||
"optionalBlocks": "Optional blocks",
|
||||
"seriesIndexFallback": "SeriesIndex fallback",
|
||||
"bracketsFallback": "Brackets fallback",
|
||||
"seriesPunctuation": "Series punctuation",
|
||||
"absolutePath": "Absolute path",
|
||||
"folderOnly": "Folder only",
|
||||
"yearPrefix": "Year prefix",
|
||||
"subtitleFallback": "Subtitle fallback"
|
||||
"optionalBlock": "Optional block",
|
||||
"subtitleConditional": "Subtitle conditional",
|
||||
"multipleOptional": "Multiple optionals",
|
||||
"elseClause": "Else clause",
|
||||
"elseClauseFallback": "Else fallback",
|
||||
"elseWithModifier": "Else + modifier",
|
||||
"modifierSort": "Author sort",
|
||||
"modifierInitial": "Author initial",
|
||||
"modFirst": "First author",
|
||||
"modUpper": "Uppercase",
|
||||
"modLower": "Lowercase",
|
||||
"letterFolder": "Letter folder",
|
||||
"combinedMods": "Combined mods"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,25 +47,46 @@
|
||||
"optionalDesc": "Envuelve partes en corchetes angulares <code>{{syntax}}</code> para hacerlas condicionales. Si algún marcador en el bloque no tiene valor, se omite el bloque completo.",
|
||||
"pattern": "Patrón:",
|
||||
"withIndex": "Con índice:",
|
||||
"without": "Sin:"
|
||||
"without": "Sin:",
|
||||
"elseClause": "Cláusula alternativa",
|
||||
"elseDesc": "Agrega un respaldo después de una barra vertical <code>|</code> dentro de un bloque opcional. Si el lado primario tiene valores faltantes, se usa el respaldo.",
|
||||
"withSeries": "Con serie:",
|
||||
"withoutSeries": "Sin serie:",
|
||||
"modifiers": "Modificadores de valor",
|
||||
"modifiersDesc": "Agrega <code>:modificador</code> a un marcador para transformar su valor. Ejemplo: <code>{authors:sort}</code>",
|
||||
"modFirst": "Solo primer autor",
|
||||
"modSort": "Formato \"Apellido, Nombre\"",
|
||||
"modInitial": "Primera letra, en mayúscula",
|
||||
"modUpper": "MAYÚSCULAS",
|
||||
"modLower": "minúsculas"
|
||||
},
|
||||
"examples": {
|
||||
"sectionTitle": "Ejemplos de patrones",
|
||||
"sectionDesc": "Patrones de ejemplo con metadatos de muestra para ayudarte a entender cómo funcionan los patrones.",
|
||||
"withFull": "Con metadatos completos",
|
||||
"withMissing": "Con campos opcionales faltantes",
|
||||
"fullMetadata": "Metadatos completos",
|
||||
"partialMetadata": "Metadatos parciales",
|
||||
"notSet": "no establecido",
|
||||
"basicGroup": "Patrones básicos",
|
||||
"conditionalGroup": "Bloques condicionales",
|
||||
"modifiersGroup": "Modificadores de valor",
|
||||
"basicPattern": "Patrón básico",
|
||||
"withPunctuation": "Con puntuación",
|
||||
"seriesInFolder": "Serie en carpeta",
|
||||
"folderOnly": "Solo carpeta",
|
||||
"absolutePath": "Ruta absoluta",
|
||||
"titleSubtitle": "Título + Subtítulo",
|
||||
"optionalBlocks": "Bloques opcionales",
|
||||
"seriesIndexFallback": "Respaldo de índice de serie",
|
||||
"bracketsFallback": "Respaldo de corchetes",
|
||||
"seriesPunctuation": "Puntuación de serie",
|
||||
"absolutePath": "Ruta absoluta",
|
||||
"folderOnly": "Solo carpeta",
|
||||
"yearPrefix": "Prefijo de año",
|
||||
"subtitleFallback": "Respaldo de subtítulo"
|
||||
"optionalBlock": "Bloque opcional",
|
||||
"subtitleConditional": "Subtítulo condicional",
|
||||
"multipleOptional": "Múltiples opcionales",
|
||||
"elseClause": "Cláusula alternativa",
|
||||
"elseClauseFallback": "Respaldo alternativo",
|
||||
"elseWithModifier": "Alternativa + modificador",
|
||||
"modifierSort": "Ordenar autor",
|
||||
"modifierInitial": "Inicial del autor",
|
||||
"modFirst": "Primer autor",
|
||||
"modUpper": "Mayúsculas",
|
||||
"modLower": "Minúsculas",
|
||||
"letterFolder": "Carpeta por letra",
|
||||
"combinedMods": "Mods combinados"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user