diff --git a/src/dvr/dvr.h b/src/dvr/dvr.h index e8ebee9..5760e25 100644 --- a/src/dvr/dvr.h +++ b/src/dvr/dvr.h @@ -52,6 +52,7 @@ extern struct dvr_entry_list dvrentries; #define DVR_EPISODE_IN_TITLE 0x80 #define DVR_CLEAN_TITLE 0x100 #define DVR_TAG_FILES 0x200 +#define DVR_SUBTITLE_IN_TITLE 0x400 typedef enum { DVR_PRIO_IMPORTANT, diff --git a/src/dvr/dvr_db.c b/src/dvr/dvr_db.c index efbc6c1..0d2edf4 100644 --- a/src/dvr/dvr_db.c +++ b/src/dvr/dvr_db.c @@ -194,6 +194,14 @@ dvr_make_title(char *output, size_t outlen, dvr_entry_t *de) de->de_episode.ee_episode); } +/* if(cfg->dvr_flags & DVR_SUBTITLE_IN_TITLE) { */ + + if(de->de_episode.ee_subtitle) + snprintf(output + strlen(output), outlen - strlen(output), + ".%s", + de->de_episode.ee_subtitle); +/* } */ + if(cfg->dvr_flags & DVR_CLEAN_TITLE) { for (i=0;ide_episode.ee_episode = ee->ee_episode; de->de_episode.ee_part = ee->ee_part; tvh_str_set(&de->de_episode.ee_onscreen, ee->ee_onscreen); + tvh_str_set(&de->de_episode.ee_subtitle, ee->ee_subtitle); } de->de_content_type = content_type; @@ -399,6 +408,7 @@ dvr_entry_dec_ref(dvr_entry_t *de) free(de->de_desc); free(de->de_episode.ee_onscreen); + free(de->de_episode.ee_subtitle); free(de); } @@ -514,6 +524,7 @@ dvr_db_load_one(htsmsg_t *c, int id) de->de_content_type = htsmsg_get_u32_or_default(c, "contenttype", 0); tvh_str_set(&de->de_episode.ee_onscreen, htsmsg_get_str(c, "episodename")); + tvh_str_set(&de->de_episode.ee_subtitle, htsmsg_get_str(c, "subtitle")); dvr_entry_link(de); } @@ -590,6 +601,8 @@ dvr_entry_save(dvr_entry_t *de) htsmsg_add_u32(m, "part", de->de_episode.ee_part); if(de->de_episode.ee_onscreen) htsmsg_add_str(m, "episodename", de->de_episode.ee_onscreen); + if(de->de_episode.ee_subtitle) + htsmsg_add_str(m, "subtitle", de->de_episode.ee_subtitle); if(de->de_content_type) htsmsg_add_u32(m, "contenttype", de->de_content_type); @@ -840,6 +853,9 @@ dvr_init(void) if(!htsmsg_get_u32(m, "episode-in-title", &u32) && u32) cfg->dvr_flags |= DVR_EPISODE_IN_TITLE; + if(!htsmsg_get_u32(m, "subtitle-in-title", &u32) && u32) + cfg->dvr_flags |= DVR_SUBTITLE_IN_TITLE; + if(!htsmsg_get_u32(m, "tag-files", &u32) && !u32) cfg->dvr_flags &= ~DVR_TAG_FILES; @@ -990,6 +1006,7 @@ dvr_save(dvr_config_t *cfg) htsmsg_add_u32(m, "whitespace-in-title", !!(cfg->dvr_flags & DVR_WHITESPACE_IN_TITLE)); htsmsg_add_u32(m, "title-dir", !!(cfg->dvr_flags & DVR_DIR_PER_TITLE)); htsmsg_add_u32(m, "episode-in-title", !!(cfg->dvr_flags & DVR_EPISODE_IN_TITLE)); + htsmsg_add_u32(m, "subtitle-in-title", !!(cfg->dvr_flags & DVR_SUBTITLE_IN_TITLE)); htsmsg_add_u32(m, "tag-files", !!(cfg->dvr_flags & DVR_TAG_FILES)); if(cfg->dvr_postproc != NULL) htsmsg_add_str(m, "postproc", cfg->dvr_postproc); diff --git a/src/epg.c b/src/epg.c index aac82ea..d2da3d5 100644 --- a/src/epg.c +++ b/src/epg.c @@ -148,9 +148,35 @@ epg_event_set_desc(event_t *e, const char *desc) */ return 0; } + + if (desc[1] == '/' || desc[2] == '/' || desc[3] == '/') { + char *tmp; + tmp = strndup (desc, strchr (desc,'/')-desc); + e->e_episode.ee_episode = atoi (tmp); + e->e_episode.ee_onscreen = malloc (strlen (tmp+1)); + sprintf (e->e_episode.ee_onscreen, "E%d", e->e_episode.ee_episode); + free (tmp); + } + + int i,j=-1; + for (i=0;i0) { + if (e->e_episode.ee_subtitle) { + free (e->e_episode.ee_subtitle); + } + e->e_episode.ee_subtitle = strndup (desc,j); + } + free(e->e_desc); - e->e_desc = strdup(desc); - return 1; + e->e_desc = strdup(desc+j+1); + +return 1; } /** @@ -272,6 +298,7 @@ epg_event_destroy(event_t *e) free(e->e_title); free(e->e_desc); free(e->e_episode.ee_onscreen); + free(e->e_episode.ee_subtitle); LIST_REMOVE(e, e_global_link); free(e); } @@ -589,6 +616,9 @@ epg_event_create_by_msg(htsmsg_t *c, time_t now) if((s = htsmsg_get_str(c, "epname")) != NULL) tvh_str_set(&e->e_episode.ee_onscreen, s); + if((s = htsmsg_get_str(c, "subtitle")) != NULL) + tvh_str_set(&e->e_episode.ee_subtitle, s); + return 1; } @@ -701,6 +731,9 @@ epg_save(void) if(e->e_episode.ee_onscreen) htsmsg_add_str(m, "epname", e->e_episode.ee_onscreen); + if(e->e_episode.ee_subtitle) + htsmsg_add_str(m, "subtitle", e->e_episode.ee_subtitle); + int r = htsmsg_binary_serialize(m, &msgdata, &msglen, 0x10000); htsmsg_destroy(m); diff --git a/src/epg.h b/src/epg.h index ebd7b0c..e3b3a6e 100644 --- a/src/epg.h +++ b/src/epg.h @@ -31,6 +31,7 @@ typedef struct epg_episode { uint16_t ee_part; char *ee_onscreen; + char *ee_subtitle; } epg_episode_t; diff --git a/src/webui/extjs.c b/src/webui/extjs.c index cd95ceb..261a1f1 100644 --- a/src/webui/extjs.c +++ b/src/webui/extjs.c @@ -716,6 +716,9 @@ extjs_epg(http_connection_t *hc, const char *remain, void *opaque) if(e->e_episode.ee_onscreen != NULL) htsmsg_add_str(m, "episode", e->e_episode.ee_onscreen); + if(e->e_episode.ee_subtitle != NULL) + htsmsg_add_str(m, "subtitle", e->e_episode.ee_subtitle); + if(e->e_ext_desc != NULL) htsmsg_add_str(m, "ext_desc", e->e_ext_desc); @@ -901,6 +904,7 @@ extjs_dvr(http_connection_t *hc, const char *remain, void *opaque) htsmsg_add_u32(r, "whitespaceInTitle", !!(cfg->dvr_flags & DVR_WHITESPACE_IN_TITLE)); htsmsg_add_u32(r, "titleDirs", !!(cfg->dvr_flags & DVR_DIR_PER_TITLE)); htsmsg_add_u32(r, "episodeInTitle", !!(cfg->dvr_flags & DVR_EPISODE_IN_TITLE)); + htsmsg_add_u32(r, "subtitleInTitle", !!(cfg->dvr_flags & DVR_SUBTITLE_IN_TITLE)); htsmsg_add_u32(r, "cleanTitle", !!(cfg->dvr_flags & DVR_CLEAN_TITLE)); htsmsg_add_u32(r, "tagFiles", !!(cfg->dvr_flags & DVR_TAG_FILES)); @@ -948,6 +952,8 @@ extjs_dvr(http_connection_t *hc, const char *remain, void *opaque) flags |= DVR_DIR_PER_TITLE; if(http_arg_get(&hc->hc_req_args, "episodeInTitle") != NULL) flags |= DVR_EPISODE_IN_TITLE; + if(http_arg_get(&hc->hc_req_args, "subtitleInTitle") != NULL) + flags |= DVR_SUBTITLE_IN_TITLE; if(http_arg_get(&hc->hc_req_args, "tagFiles") != NULL) flags |= DVR_TAG_FILES; @@ -1044,6 +1050,9 @@ extjs_dvrlist(http_connection_t *hc, const char *remain, void *opaque) if(de->de_episode.ee_onscreen) htsmsg_add_str(m, "episode", de->de_episode.ee_onscreen); + if(de->de_episode.ee_subtitle) + htsmsg_add_str(m, "subtitle", de->de_episode.ee_subtitle); + htsmsg_add_u32(m, "id", de->de_id); htsmsg_add_u32(m, "start", de->de_start); htsmsg_add_u32(m, "end", de->de_stop); diff --git a/src/webui/static/app/dvr.js b/src/webui/static/app/dvr.js index 74de7cf..4dab5de 100644 --- a/src/webui/static/app/dvr.js +++ b/src/webui/static/app/dvr.js @@ -199,6 +199,11 @@ tvheadend.dvrschedule = function() { dataIndex: 'episode' },{ width: 100, + id:'subtitle', + header: "Subtitle", + dataIndex: 'subtitle' + },{ + width: 100, id:'pri', header: "Priority", dataIndex: 'pri', @@ -579,6 +584,7 @@ tvheadend.dvr = function() { {name: 'channel'}, {name: 'title'}, {name: 'episode'}, + {name: 'subtitle'}, {name: 'pri'}, {name: 'description'}, {name: 'chicon'}, @@ -667,7 +673,7 @@ tvheadend.dvrsettings = function() { 'channelDirs','channelInTitle', 'dateInTitle','timeInTitle', 'preExtraTime', 'postExtraTime', 'whitespaceInTitle', - 'titleDirs', 'episodeInTitle', 'cleanTitle', 'tagFiles']); + 'titleDirs', 'episodeInTitle', 'subtitleInTitle', 'cleanTitle', 'tagFiles']); var confcombo = new Ext.form.ComboBox({ store: tvheadend.configNames, @@ -743,6 +749,9 @@ tvheadend.dvrsettings = function() { fieldLabel: 'Include episode in filename', name: 'episodeInTitle' }), new Ext.form.Checkbox({ + fieldLabel: 'Include subtitle in filename', + name: 'subtitleInTitle' + }), new Ext.form.Checkbox({ fieldLabel: 'Replace whitespace in title with \'-\'', name: 'whitespaceInTitle' }), new Ext.form.Checkbox({ diff --git a/src/webui/static/app/epg.js b/src/webui/static/app/epg.js index 471565a..95c19f7 100644 --- a/src/webui/static/app/epg.js +++ b/src/webui/static/app/epg.js @@ -17,6 +17,7 @@ tvheadend.epgDetails = function(event) { content += '
' + event.title + '
'; content += '
' + event.episode + '
'; + content += '
' + event.subtitle + '
'; content += '
' + event.description + '
'; content += '
' + event.contentgrp + '
'; @@ -126,6 +127,7 @@ tvheadend.epg = function() { {name: 'channelid'}, {name: 'title'}, {name: 'episode'}, + {name: 'subtitle'}, {name: 'description'}, {name: 'ext_desc'}, {name: 'ext_item'}, @@ -195,6 +197,12 @@ tvheadend.epg = function() { renderer: renderText },{ width: 100, + id:'subtitle', + header: "Subtitle", + dataIndex: 'subtitle', + renderer: renderText + },{ + width: 100, id:'start', header: "Start", dataIndex: 'start',