<tr><td>$t$n.$x</td><td>Default format (title, unique number, extension)</td><td>Tenis - Wimbledon-1.mkv</td></tr>
<br>
<tr><td>$t</td><td>Event title name</td><td>Tenis - Wimbledon</td></tr>
+ <tr><td>$s</td><td>Event subtitle name</td><td>Sport</td></tr>
<tr><td>$e</td><td>Event episode name</td><td>S02-E06</td></tr>
+ <tr><td>$c</td><td>Channel name</td><td>SkySport</td></tr>
<tr><td>$n</td><td>Unique number added when the file already exists </td><td>-1</td></tr>
<tr><td>$x</td><td>Filename extension (from the active stream muxer</td><td>mkv</td></tr>
<br>
<tr><td>%R</td><td>The time in 24-hour notation</td><td>14:12</td></tr>
</table>
+ The format strings <i>$t,$s,%e,$c</i> have also delimiter variants like
+ <i>$ t</i> (space after the dolar character), <i>$-t</i>, <i>$_t</i>,
+ <i>$.t</i>, <i>$,t</i>, <i>$;t</i>, . In this case, the delimiter is applied
+ only when the substituted string is not empty.
+
<br><br>
<hr>
<b>Subdirectory Options</b>
cfg->dvr_channel_dir = dvr_match_fmtstr(cfg, "$c/") >= 0;
cfg->dvr_title_dir = dvr_match_fmtstr(cfg, "$t/") >= 0;
- cfg->dvr_channel_in_title = dvr_match_fmtstr_nodir(cfg, "$c-") >= 0;
+ cfg->dvr_channel_in_title = dvr_match_fmtstr_nodir(cfg, "$-c") >= 0;
cfg->dvr_date_in_title = dvr_match_fmtstr_nodir(cfg, "%F") >= 0;
cfg->dvr_time_in_title = dvr_match_fmtstr_nodir(cfg, "%R") >= 0;
- cfg->dvr_episode_in_title = dvr_match_fmtstr_nodir(cfg, "$e") >= 0;
- cfg->dvr_subtitle_in_title = dvr_match_fmtstr_nodir(cfg, ".$s") >= 0;
+ cfg->dvr_episode_in_title = dvr_match_fmtstr_nodir(cfg, "$-e") >= 0;
+ cfg->dvr_subtitle_in_title = dvr_match_fmtstr_nodir(cfg, "$.s") >= 0;
cfg->dvr_omit_title = dvr_match_fmtstr_nodir(cfg, "$t") < 0;
}
dvr_insert_fmtstr_before_extension(cfg, "$t");
}
- dvr_match_and_insert_or_remove(cfg, "$c-", cfg->dvr_channel_in_title, -1);
- dvr_match_and_insert_or_remove(cfg, ".$s", cfg->dvr_subtitle_in_title, -1);
+ dvr_match_and_insert_or_remove(cfg, "$-c", cfg->dvr_channel_in_title, -1);
+ dvr_match_and_insert_or_remove(cfg, "$.s", cfg->dvr_subtitle_in_title, -1);
dvr_match_and_insert_or_remove(cfg, "%F", cfg->dvr_date_in_title, -1);
dvr_match_and_insert_or_remove(cfg, "%R", cfg->dvr_time_in_title, -1);
- dvr_match_and_insert_or_remove(cfg, "$e", cfg->dvr_episode_in_title, -1);
+ dvr_match_and_insert_or_remove(cfg, "$-e", cfg->dvr_episode_in_title, -1);
dvr_match_and_insert_or_remove(cfg, "$t/", cfg->dvr_title_dir, 0);
dvr_match_and_insert_or_remove(cfg, "$c/", cfg->dvr_channel_dir, 0);
#include <pthread.h>
#include <assert.h>
#include <string.h>
+#include <ctype.h>
#include <sys/stat.h>
#include <libgen.h> /* basename */
tvherror("dvr", "unable to find access (owner '%s', creator '%s')",
de->de_owner, de->de_creator);
return -1;
- }
+ }
if (aa->aa_conn_limit) {
rec_count = dvr_usage_count(aa);
/**
*
*/
+static const char *dvr_do_prefix(const char *id, const char *s)
+{
+ static char buf[128];
+
+ if (s == NULL)
+ s = "";
+ if (s[0] && !isalpha(id[0])) {
+ snprintf(buf, sizeof(buf), "%c%s", id[0], s);
+ return buf;
+ }
+ return s;
+}
+
static const char *dvr_sub_title(const char *id, const void *aux)
{
- return lang_str_get(((dvr_entry_t *)aux)->de_title, NULL) ?: "";
+ return dvr_do_prefix(id, lang_str_get(((dvr_entry_t *)aux)->de_title, NULL));
}
static const char *dvr_sub_subtitle(const char *id, const void *aux)
{
- return lang_str_get(((dvr_entry_t *)aux)->de_subtitle, NULL) ?: "";
+ return dvr_do_prefix(id, lang_str_get(((dvr_entry_t *)aux)->de_subtitle, NULL));
}
static const char *dvr_sub_episode(const char *id, const void *aux)
epg_episode_number_format(de->de_bcast->episode,
buf, sizeof(buf),
".", "S%02d", NULL, "E%02d", NULL);
- return buf;
+ return dvr_do_prefix(id, buf);
}
static const char *dvr_sub_channel(const char *id, const void *aux)
{
- return DVR_CH_NAME((dvr_entry_t *)aux);
+ return dvr_do_prefix(id, DVR_CH_NAME((dvr_entry_t *)aux));
}
-
static str_substitute_t dvr_subs_entry[] = {
- { .id = "t", .getval = dvr_sub_title },
- { .id = "s", .getval = dvr_sub_subtitle },
- { .id = "e", .getval = dvr_sub_episode },
- { .id = "c", .getval = dvr_sub_channel },
+ { .id = "t", .getval = dvr_sub_title },
+ { .id = " t", .getval = dvr_sub_title },
+ { .id = "-t", .getval = dvr_sub_title },
+ { .id = "_t", .getval = dvr_sub_title },
+ { .id = ".t", .getval = dvr_sub_title },
+ { .id = ",t", .getval = dvr_sub_title },
+ { .id = ";t", .getval = dvr_sub_title },
+ { .id = "s", .getval = dvr_sub_subtitle },
+ { .id = " s", .getval = dvr_sub_subtitle },
+ { .id = "-s", .getval = dvr_sub_subtitle },
+ { .id = "_s", .getval = dvr_sub_subtitle },
+ { .id = ".s", .getval = dvr_sub_subtitle },
+ { .id = ",s", .getval = dvr_sub_subtitle },
+ { .id = ";s", .getval = dvr_sub_subtitle },
+ { .id = "e", .getval = dvr_sub_episode },
+ { .id = " e", .getval = dvr_sub_episode },
+ { .id = "-e", .getval = dvr_sub_episode },
+ { .id = "_e", .getval = dvr_sub_episode },
+ { .id = ".e", .getval = dvr_sub_episode },
+ { .id = ",e", .getval = dvr_sub_episode },
+ { .id = ";e", .getval = dvr_sub_episode },
+ { .id = "c", .getval = dvr_sub_channel },
+ { .id = " c", .getval = dvr_sub_channel },
+ { .id = "-c", .getval = dvr_sub_channel },
+ { .id = "_c", .getval = dvr_sub_channel },
+ { .id = ".c", .getval = dvr_sub_channel },
+ { .id = ",c", .getval = dvr_sub_channel },
+ { .id = ";c", .getval = dvr_sub_channel },
{ .id = NULL, .getval = NULL }
};