]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
ui: Add tickbox for 'new programmes only'. (#1167).
authorE.Smith <31170571+azlm8t@users.noreply.github.com>
Tue, 5 Dec 2017 02:07:01 +0000 (02:07 +0000)
committerJaroslav Kysela <perex@perex.cz>
Sun, 10 Dec 2017 15:41:11 +0000 (16:41 +0100)
Issue: #1167.

src/api/api_epg.c
src/epg.c
src/epg.h
src/webui/static/app/epg.js

index 60847c5d7b7e0fad65a5ee12af1bd1ad1c344222..f12d55ebea7c1f6ba69302714cc5fe562bfc0e30 100644 (file)
@@ -343,6 +343,7 @@ api_epg_grid
   if (str)
     eq.stitle = strdup(str);
   eq.fulltext = htsmsg_get_bool_or_default(args, "fulltext", 0);
+  eq.new_only = htsmsg_get_bool_or_default(args, "new", 0);
   str = htsmsg_get_str(args, "channel");
   if (str)
     eq.channel = strdup(str);
index 9977f5784b6400f6c6b31d6e1f8e87bb0f3e2112..e4ce0d3c2640ebd1ada814e1dd5b89de38799572 100644 (file)
--- a/src/epg.c
+++ b/src/epg.c
@@ -2949,6 +2949,10 @@ _eq_add ( epg_query_t *eq, epg_broadcast_t *e )
     }
     if (!r) return;
   }
+  if (eq->new_only) {
+    if (!e->is_new)
+      return;
+  }
   if (fulltext) {
     if ((s = epg_episode_get_title(ep, lang)) == NULL ||
         regex_match(&eq->stitle_re, s)) {
index 7ce6a4205ff54c94cdcf8adcccc767b66d27419c..da2de66a4a0e20930f23c033fe368e75843933b5 100644 (file)
--- a/src/epg.h
+++ b/src/epg.h
@@ -692,6 +692,7 @@ typedef struct epg_query {
   char             *stitle;
   tvh_regex_t       stitle_re;
   int               fulltext;
+  int               new_only;
   char             *channel;
   char             *channel_tag;
   uint32_t          genre_count;
index 76ba7ee01418111d76575a8351884864e06a649d..b7b8327ef42dff4fb1f6671b934516d29ac11b2e 100644 (file)
@@ -748,6 +748,10 @@ tvheadend.epg = function() {
         width: 20
     });
 
+    var epgFilterNewOnly = new Ext.form.Checkbox({
+        width: 20
+    });
+
     // Channels, uses global store
 
     var epgFilterChannels = new Ext.form.ComboBox({
@@ -907,6 +911,11 @@ tvheadend.epg = function() {
         epgFilterFulltext.setValue(0);
     };
 
+    clearNewOnlyFilter = function() {
+        delete epgStore.baseParams.newOnly;
+        epgFilterNewOnly.setValue(0);
+    }
+
     clearChannelFilter = function() {
         delete epgStore.baseParams.channel;
         epgFilterChannels.setValue("");
@@ -937,6 +946,7 @@ tvheadend.epg = function() {
         clearModeFilter();
         clearTitleFilter();
         clearFulltextFilter();
+        clearNewOnlyFilter();
         clearChannelFilter();
         clearChannelTagsFilter();
         clearDurationFilter();
@@ -1030,6 +1040,13 @@ tvheadend.epg = function() {
         }
     });
 
+    epgFilterNewOnly.on('check', function(c, value) {
+        if (epgStore.baseParams.new !== value) {
+            epgStore.baseParams.new = value;
+            epgView.reset();
+        }
+    });
+
     var epgView = new Ext.ux.grid.livegrid.GridView({
         nearLimit: 100,
         loadMask: {
@@ -1054,7 +1071,7 @@ tvheadend.epg = function() {
 
     var tbar = [
         epgMode, '-',
-        epgFilterTitle, { text: _('Fulltext') }, epgFilterFulltext, '-',
+        epgFilterTitle, { text: _('Fulltext') }, epgFilterFulltext, { text: _('New only') }, epgFilterNewOnly, '-',
         epgFilterChannels, '-',
         epgFilterChannelTags, '-',
         epgFilterContentGroup, '-',
@@ -1232,6 +1249,9 @@ tvheadend.epg = function() {
         var fulltext = epgStore.baseParams.fulltext ?
                 " <i>(" + _("Fulltext") + ")</i>"
                 : "";
+        var newOnly = epgStore.baseParams.new ?
+                " <i>(" + _("New only") + ")</i>"
+                : "";
         var channel = epgStore.baseParams.channel ?
                 tvheadend.channelLookupName(epgStore.baseParams.channel)
                 : "<i>" + _("Don't care") + "</i>";
@@ -1254,7 +1274,7 @@ tvheadend.epg = function() {
         Ext.MessageBox.confirm(_('Auto Recorder'), _('This will create an automatic rule that '
                 + 'continuously scans the EPG for programs '
                 + 'to record that match this query') + ': ' + '<br><br>'
-                + '<div class="x-smallhdr">' + _('Title') + ':</div>' + title + fulltext + '<br>'
+                + '<div class="x-smallhdr">' + _('Title') + ':</div>' + title + fulltext + newOnly + '<br>'
                 + '<div class="x-smallhdr">' + _('Channel') + ':</div>' + channel + '<br>'
                 + '<div class="x-smallhdr">' + _('Tag') + ':</div>' + tag + '<br>'
                 + '<div class="x-smallhdr">' + _('Genre') + ':</div>' + contentType + '<br>'
@@ -1278,6 +1298,7 @@ tvheadend.epg = function() {
         };
         if (params.title) conf.title = params.title;
         if (params.fulltext) conf.fulltext = params.fulltext;
+        if (params.new) conf.btype = 3; // DVR_AUTOREC_BTYPE_NEW in dvr.h has value 3.
         if (params.channel) conf.channel = params.channel;
         if (params.channelTag) conf.tag = params.channelTag;
         if (params.contentType) conf.content_type = params.contentType;