]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Change search icons to a combobox and fix search string in Thedbtv site
authorpablozg <pablozg@gmail.com>
Thu, 13 Sep 2018 21:45:58 +0000 (23:45 +0200)
committerJaroslav Kysela <perex@perex.cz>
Thu, 20 Sep 2018 12:27:18 +0000 (14:27 +0200)
src/webui/static/app/dvr.js
src/webui/static/app/epg.js
src/webui/static/icons/filmaffinity.png [new file with mode: 0644]

index 09db21628aceafb55e6996b63af977f6667bbc21..7a623658b62e8f8dffa4558933e9a12701d43dc2 100644 (file)
@@ -118,27 +118,36 @@ tvheadend.dvrDetails = function(uuid) {
 
         var buttons = [];
 
-        buttons.push(new Ext.Button({
-            handler: searchIMDB,
-            iconCls: 'imdb',
-            tooltip: _('Search IMDB (for title)'),
-        }));
-
-        buttons.push(new Ext.Button({
-            handler: searchTheTVDB,
-            iconCls: 'thetvdb',
-            tooltip: _('Search TheTVDB (for title)'),
-        }));
-
-        function searchIMDB() {
-            window.open('http://akas.imdb.com/find?q=' +
-                        encodeURIComponent(title), '_blank');
-        }
+        var comboGetInfo = new Ext.form.ComboBox({
+            store: new Ext.data.ArrayStore({
+                data: [
+                  [1, 'Find info from IMDB', 'imdb.png'],
+                  [2, 'Find info from TheTVDB', 'thetvdb.png'],
+                  [3, 'Find info from FilmAffinity', 'filmaffinity.png'],
+                ],
+                id: 0,
+                fields: ['value', 'text', 'url']
+            }),
+            triggerAction: 'all',
+            mode: 'local',
+            tpl : '<tpl for=".">' +
+                  '<div class="x-combo-list-item" ><img src="../static/icons/{url}">&nbsp;&nbsp;{text}</div>' +
+                  '</tpl>',
+            emptyText:'Find info from ...',
+            valueField: 'value',
+            displayField: 'text',
+            width: 160,
+            forceSelection : true,
+            editable: false,
+            listeners: {
+                select: function(combo, records, index) {
+                    tvheadend.seachTitleWeb(combo.getValue(), title);
+                }
+            },
+        });
 
-        function searchTheTVDB(){
-            window.open('http://thetvdb.com/?string='+
-                        encodeURIComponent(title)+'&searchseriesid=&tab=listseries&function=Search','_blank');
-        }
+        if (title)
+            buttons.push(comboGetInfo);
 
         var windowHeight = Ext.getBody().getViewSize().height - 150;
 
index 0a3f5afc16036194af11359499458e3d7d0cec00..56105e8abf829633b9da0d55269183e840e31566 100644 (file)
@@ -104,6 +104,25 @@ tvheadend.durationLookupRange = function(value) {
     return durationString;
 };
 
+tvheadend.seachTitleWeb = function(index, title){
+    switch(index){
+        case 1:
+            window.open('http://akas.imdb.com/find?q=' + encodeURIComponent(title), '_blank');
+            break;
+        case 2:
+            window.open('https://www.thetvdb.com/search?q='+ encodeURIComponent(title)+'&l=en','_blank');
+            break;
+        case 3:
+            window.open(tvheadend.filmAffinityLanguage() + encodeURIComponent(title), '_blank');
+            break;
+    }
+};
+
+tvheadend.filmAffinityLanguage = function() {
+    if (tvh_locale_lang.search("es") !== -1) return 'https://www.filmaffinity.com/es/search.php?stext=';
+    else return 'https://www.filmaffinity.com/en/search.php?stext=';
+};
+
 tvheadend.epgDetails = function(event) {
 
     var content = '';
@@ -210,19 +229,36 @@ tvheadend.epgDetails = function(event) {
     var recording = event.dvrState.indexOf('recording') === 0;
     var scheduled = event.dvrState.indexOf('scheduled') === 0;
 
-    buttons.push(new Ext.Button({
-        disabled: !event.title,
-        handler: searchIMDB,
-        iconCls: 'imdb',
-        tooltip: _('Search IMDB (for title)'),
-    }));
+    var comboGetInfo = new Ext.form.ComboBox({
+        store: new Ext.data.ArrayStore({
+            data: [
+              [1, 'Find info from IMDB', 'imdb.png'],
+              [2, 'Find info from TheTVDB', 'thetvdb.png'],
+              [3, 'Find info from FilmAffinity', 'filmaffinity.png'],
+            ],
+            id: 0,
+            fields: ['value', 'text', 'url']
+        }),
+        triggerAction: 'all',
+        mode: 'local',
+        tpl : '<tpl for=".">' +
+              '<div class="x-combo-list-item" ><img src="../static/icons/{url}">&nbsp;&nbsp;{text}</div>' +
+              '</tpl>',
+        emptyText:'Find info from ...',
+        valueField: 'value',
+        displayField: 'text',
+        width: 160,
+        forceSelection : true,
+        editable: false,
+        listeners: {
+            select: function(combo, records, index) {
+                tvheadend.seachTitleWeb(combo.getValue(), event.title);
+            }
+        },
+    });
 
-    buttons.push(new Ext.Button({
-        disabled: !event.title,
-        handler: searchTheTVDB,
-        iconCls: 'thetvdb',
-        tooltip: _('Search TheTVDB (for title)'),
-    }));
+    if (event.title)
+        buttons.push(comboGetInfo);
 
     buttons.push(new Ext.Button({
         disabled: event.start > now || event.stop < now,
@@ -320,16 +356,6 @@ tvheadend.epgDetails = function(event) {
     });
     win.show();
 
-    function searchIMDB() {
-        window.open('http://akas.imdb.com/find?q=' +
-                    encodeURIComponent(event.title), '_blank');
-    }
-
-    function searchTheTVDB(){
-        window.open('http://thetvdb.com/?string='+
-                    encodeURIComponent(event.title)+'&searchseriesid=&tab=listseries&function=Search','_blank');
-    }
-
     function playProgram() {
         var title = event.title;
         if (event.episodeOnscreen)
diff --git a/src/webui/static/icons/filmaffinity.png b/src/webui/static/icons/filmaffinity.png
new file mode 100644 (file)
index 0000000..3671f47
Binary files /dev/null and b/src/webui/static/icons/filmaffinity.png differ