Project

General

Profile

Feature #4331

Status: Country flags

Added by Pablo R. over 7 years ago. Updated over 7 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
User Interface
Target version:
-
Start date:
2017-04-24
Due date:
% Done:

0%

Estimated time:

Description

Hello!

I would like to see next to the IP of the users an indicative flag of the country to which they belong.
I have attached an image of a possible aspect of the functionality

Regards.


Files

Country flags.png (9.26 KB) Country flags.png Pablo R., 2017-04-24 23:50

History

#1

Updated by saen acro over 7 years ago

This option (GeoIP) take to much space and resources

#2

Updated by Poul Kalff over 7 years ago

saen acro wrote:

This option (GeoIP) take to much space and resources

What? Really? Isn't it just a simple API-call; http://api.geoiplookup.net/?query=104.31.95.73

#3

Updated by Poul Kalff over 7 years ago

Poul Kalff wrote:

saen acro wrote:

This option (GeoIP) take to much space and resources

What? Really? Isn't it just a simple API-call; http://api.geoiplookup.net/?query=104.31.95.73

... and then parse for <countrycode>

#4

Updated by saen acro over 7 years ago

Working with external sources is not most stable.
if someone try to make it better to use tool-tip.

#5

Updated by Poul Kalff over 7 years ago

saen acro wrote:

Working with external sources is not most stable.
if someone try to make it better to use tool-tip.

Well, this is 2017, and everything is an external source :-) Kodi relies heavily on external sources for scraping, can't see how this is different. In fact, all data that tvheadend is build to handle is external sources

#6

Updated by Jaroslav Kysela over 7 years ago

Here's a dirty code, when you have an HTTP server which can return the country flag image for queried IP:

diff --git a/src/webui/static/app/status.js b/src/webui/static/app/status.js
index c35d464..27a9c9c 100644
--- a/src/webui/static/app/status.js
+++ b/src/webui/static/app/status.js
@@ -91,7 +91,13 @@ tvheadend.status_subs = function(panel, index)
                 id: 'hostname',
                 header: _("Hostname"),
                 dataIndex: 'hostname',
-                sortable: true
+                sortable: true,
+                renderer: function(v) {
+                    if (!v.startswith('10.') && !v.startswith('192.168.') &&
+                        !v.startswith('172.16.') && !v.startwith('127.'))
+                        return '<img src="URL_image_country_flag/?"' + v + '"/>' + v;
+                    return v;
+                }
             },
             {
                 width: 50,
#7

Updated by Pablo R. over 7 years ago

I get following in tvheadend log and nothing is show, just loading.

Comet failure [e=v.startswith is not a function]

Any tip to fix it?

#8

Updated by Mark Clarkstone over 7 years ago

Pablo Rodríguez wrote:

I get following in tvheadend log and nothing is show, just loading.

Comet failure [e=v.startswith is not a function]

Any tip to fix it?

"startswith" should be "startsWith". looks like Jaroslav confused function names between languages, glad I'm not the only one who does this!

#9

Updated by Pablo R. over 7 years ago

Thanks!

Also available in: Atom PDF