Project

General

Profile

Actions

Feature #4331

open

Status: Country flags

Feature #4331: Status: Country flags

Added by Pablo R. about 9 years ago. Updated about 9 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

Updated by saen acro about 9 years ago Actions #1

This option (GeoIP) take to much space and resources

Updated by Poul Kalff about 9 years ago Actions #2

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

Updated by Poul Kalff about 9 years ago Actions #3

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>

Updated by saen acro about 9 years ago Actions #4

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

Updated by Poul Kalff about 9 years ago Actions #5

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

Updated by Jaroslav Kysela about 9 years ago Actions #6

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,

Updated by Pablo R. about 9 years ago Actions #7

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?

Updated by Mark Clarkstone about 9 years ago Actions #8

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!

Updated by Pablo R. about 9 years ago Actions #9

Thanks!

Actions

Also available in: PDF Atom