Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
DVR: add modifier (content type) for filename, fixes #3517
  • Loading branch information
perexg committed Jan 28, 2016
1 parent 8b906ac commit 3372921
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/dvr/dvr_rec.c
Expand Up @@ -331,6 +331,22 @@ dvr_sub_channel(const char *id, const void *aux, char *tmp, size_t tmplen)
return dvr_do_prefix(id, DVR_CH_NAME((dvr_entry_t *)aux), tmp, tmplen);
}

static const char *
dvr_sub_genre(const char *id, const void *aux, char *tmp, size_t tmplen)
{
const dvr_entry_t *de = aux;
epg_genre_t *genre;
char buf[64];

if (de->de_bcast == NULL || de->de_bcast->episode == NULL)
return "";
genre = LIST_FIRST(&de->de_bcast->episode->genre);
if (!genre || !genre->code)
return "";
epg_genre_get_str(genre, 0, 1, buf, sizeof(buf), "en");
return dvr_do_prefix(id, buf, tmp, tmplen);
}

static const char *
dvr_sub_owner(const char *id, const void *aux, char *tmp, size_t tmplen)
{
Expand Down Expand Up @@ -410,6 +426,13 @@ static htsstr_substitute_t dvr_subs_entry[] = {
{ .id = ".c", .getval = dvr_sub_channel },
{ .id = ",c", .getval = dvr_sub_channel },
{ .id = ";c", .getval = dvr_sub_channel },
{ .id = "g", .getval = dvr_sub_genre },
{ .id = " g", .getval = dvr_sub_genre },
{ .id = "-g", .getval = dvr_sub_genre },
{ .id = "_g", .getval = dvr_sub_genre },
{ .id = ".g", .getval = dvr_sub_genre },
{ .id = ",g", .getval = dvr_sub_genre },
{ .id = ";g", .getval = dvr_sub_genre },
{ .id = NULL, .getval = NULL }
};

Expand Down Expand Up @@ -1481,7 +1504,7 @@ dvr_thread(void *aux)
void
dvr_spawn_postcmd(dvr_entry_t *de, const char *postcmd, const char *filename)
{
char buf1[2048], *buf2;
char buf1[MAX(PATH_MAX, 2048)], *buf2;
char tmp[MAX(PATH_MAX, 512)];
htsmsg_t *info, *e;
htsmsg_field_t *f;
Expand Down

0 comments on commit 3372921

Please sign in to comment.