Skip to content

Commit 623e9a1

Browse files
committed
Fix name schemes after last change
I knew that was needed somewhere. Oh well.
1 parent 0df3e90 commit 623e9a1

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ If you would like something different, read on. If for a one-off you'd like to s
175175

176176
The syntax is as follows: everything not inside `{` or `}` tags gets copied as-is unconditionally.
177177
Everything inside `{` or `}` tags is interpreted: if what's inside the tags matches a metadata key,
178-
the tag along with its outer brackets is replaced as-is. Otherwise nothing, including the brackets, remains.
178+
the tag along with its outer brackets is replaced as-is. Otherwise only the tag brackets are removed and what's inside is copied literally.
179179

180180
Conditions are possible and must follow this syntax: `{if #token1# != #token2#album name is |album|}`. Condition tokens must be wrapped in `#` tags, and both must exist.
181181
In between the 2 tokens must be either `>` or `<` or `==` or `!=`. If any of the tokens inside the `#` tags matches a metadata key, it is replaced with a value, otherwise its taken literally (so if the `album` tag exists, `#album#` resolves to the album name, otherwise to just `album`).

src/cyanrip_main.c

+14-6
Original file line numberDiff line numberDiff line change
@@ -1077,12 +1077,16 @@ static int process_cond(cyanrip_ctx *ctx, AVBPrint *buf, AVDictionary *meta,
10771077
continue;
10781078
}
10791079

1080+
int origin_is_tag = 1;
10801081
char *true_val = get_dir_tag_val(ctx, meta, ofmt, true_tok);
1081-
if (true_val) {
1082-
crip_bprint_sanitize(ctx, buf, true_val, dir_list, dir_list_nb, 1);
1083-
av_free(true_val);
1082+
if (!true_val) {
1083+
true_val = av_strdup(true_tok);
1084+
origin_is_tag = 0;
10841085
}
10851086

1087+
crip_bprint_sanitize(ctx, buf, true_val, dir_list, dir_list_nb, origin_is_tag);
1088+
av_free(true_val);
1089+
10861090
true_tok = av_strtok(NULL, "|", &true_save);
10871091
}
10881092
}
@@ -1095,12 +1099,16 @@ static int process_cond(cyanrip_ctx *ctx, AVBPrint *buf, AVDictionary *meta,
10951099
continue;
10961100
}
10971101

1102+
int origin_is_tag = 1;
10981103
char *val = get_dir_tag_val(ctx, meta, ofmt, tok);
1099-
if (val) {
1100-
crip_bprint_sanitize(ctx, buf, val, dir_list, dir_list_nb, 1);
1101-
av_free(val);
1104+
if (!val) {
1105+
val = av_strdup(tok);
1106+
origin_is_tag = 0;
11021107
}
11031108

1109+
crip_bprint_sanitize(ctx, buf, val, dir_list, dir_list_nb, origin_is_tag);
1110+
av_free(val);
1111+
11041112
tok = av_strtok(NULL, "{}", &save);
11051113
}
11061114

0 commit comments

Comments
 (0)