Jump to content


Photo

Picons by 'Service name'.


  • Please log in to reply
97 replies to this topic

Re: Picons by 'Service name'. #21 ims

  • PLi® Core member
  • 13,623 posts

+212
Excellent

Posted 13 November 2014 - 20:16

Thanks. Now plugin can save true filenames :) and e2 use it


Kdo nic nedělá, nic nezkazí!

Re: Picons by 'Service name'. #22 Huevos

  • PLi® Contributor
  • 4,244 posts

+158
Excellent

Posted 13 November 2014 - 21:45

By the way I've changed our algorithm slightly just in case there are any characters that have been overlooked. Result is the same but test is whitelist rather than blacklist. So easier to read. Also been pushed to OpenWebIF.

	if not pngname: # picon by channel name
		name = ServiceReference(serviceName).getServiceName()
		name = unicodedata.normalize('NFKD', unicode(name, 'utf_8')).encode('ASCII', 'ignore')
		name = re.sub('[^a-z0-9]', '', name.replace('&', 'and').replace('+', 'plus').replace('*', 'star').lower())
		if len(name) > 0:
			pngname = findPicon(name)

Edited by Huevos, 13 November 2014 - 21:46.


Re: Picons by 'Service name'. #23 Huevos

  • PLi® Contributor
  • 4,244 posts

+158
Excellent

Posted 13 November 2014 - 22:02

@ Huevos - my plugin SetPicon can save all used picon from actual bouquet as service_name.png.

F.eg:

Eurosport_HD.png

Eurosport__HD.png

Fishing_and_Hunting.png

eeee

but e2 does not accept it with your changes. Something I overlooked ? Names all in lower ?

Reason it was done lower case is because sometimes the same channel is written differently on different satellites. For example on 13E, DAS ERSTE, and 19.2E, Das Erste. Also BBC One HD on 28E, or BBC ONE HD on terrestrial. Space was just got rid of completely because sometimes it is tab, sometimes a space, sometimes multiple spaces etc. Easiest thing was just get rid of the spaces, and also easy for everyone to understand. And 'star', 'plus', & 'and' were converted to words, which allows the file names to be completely alphanumeric.



Re: Picons by 'Service name'. #24 rhurbarb

  • Senior Member
  • 143 posts

0
Neutral

Posted 21 November 2014 - 20:46

Hi ,Sorry are you saying this file is what i need to show pictures on my lcd screen,since updating to latest build i lost my lcd screen pictures which i used to get for streaming scenic webcam sites. 



Re: Picons by 'Service name'. #25 Huevos

  • PLi® Contributor
  • 4,244 posts

+158
Excellent

Posted 22 November 2014 - 10:51

Hi ,Sorry are you saying this file is what i need to show pictures on my lcd screen,since updating to latest build i lost my lcd screen pictures which i used to get for streaming scenic webcam sites. 

No, this is nothing to do with displaying websites. It is for displaying picons by service name on the infobar and channel list. And it doesn't remove any function. It just adds an extra fallback.



Re: Picons by 'Service name'. #26 littlesat

  • PLi® Core member
  • 56,260 posts

+691
Excellent

Posted 22 November 2014 - 12:41

Why doing if len(name) > 0 while if name is doing the same?

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: Picons by 'Service name'. #27 Huevos

  • PLi® Contributor
  • 4,244 posts

+158
Excellent

Posted 23 November 2014 - 01:01

Why doing if len(name) > 0 while if name is doing the same?

Littlesat, I'm not a Python coder. So to be sure I was looking for a zero-length string I wrote it like that. In some other languages string "0" returns false.

 

if "0":
    print 'True'
else:
    print 'False'

 

In Python that returns True.

In PHP it returns False even though it is not a zero-length string.

 

Whereas len(str) > 0 returns True in both.

 

Another example:

"0" == 0

Returns False in Python and True in PHP.



Re: Picons by 'Service name'. #28 littlesat

  • PLi® Core member
  • 56,260 posts

+691
Excellent

Posted 23 November 2014 - 09:16

So in puthon you can do if name.... Python != php. ;)

Edited by littlesat, 23 November 2014 - 09:17.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: Picons by 'Service name'. #29 Erik Slagter

  • PLi® Core member
  • 46,951 posts

+541
Excellent

Posted 23 November 2014 - 09:54

Indeed python is weird :ph34r: :D


* Wavefrontier T90 with 28E/23E/19E/13E via SCR switches 2 x 2 x 6 user bands
I don't read PM -> if you have something to ask or to report, do it in the forum so others can benefit. I don't take freelance jobs.
Ik lees geen PM -> als je iets te vragen of te melden hebt, doe het op het forum, zodat anderen er ook wat aan hebben.


Re: Picons by 'Service name'. #30 Huevos

  • PLi® Contributor
  • 4,244 posts

+158
Excellent

Posted 23 November 2014 - 11:44

All I'm saying is if you write in more than one language it is easy to get confused when things are different.

 

So if I explicitly test for a zero-length string I know that is what I am getting.

 

Lets say I made a mistake further back in the code and name was now holding a boolean True. In this case, using, "if name:" would return true, but in my code would raise an exception.

 

No point arguing about it. Neither is wrong.



Re: Picons by 'Service name'. #31 Erik Slagter

  • PLi® Core member
  • 46,951 posts

+541
Excellent

Posted 23 November 2014 - 12:59

Don't get me wrong, I agree with you!


* Wavefrontier T90 with 28E/23E/19E/13E via SCR switches 2 x 2 x 6 user bands
I don't read PM -> if you have something to ask or to report, do it in the forum so others can benefit. I don't take freelance jobs.
Ik lees geen PM -> als je iets te vragen of te melden hebt, doe het op het forum, zodat anderen er ook wat aan hebben.


Re: Picons by 'Service name'. #32 littlesat

  • PLi® Core member
  • 56,260 posts

+691
Excellent

Posted 23 November 2014 - 13:18

Even with len(name) it wile rise an exception when name = True... So no difference here.....
In fact python makes it easy for you here...

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: Picons by 'Service name'. #33 Huevos

  • PLi® Contributor
  • 4,244 posts

+158
Excellent

Posted 23 November 2014 - 16:24

Even with len(name) it wile rise an exception when name = True... So no difference here.....
In fact python makes it easy for you here...

Littlesat that is exactly what I am saying. len(name) raises an exception if the data type is wrong. if name: does not raise that exception, so the chance to catch a bug is missed.



Re: Picons by 'Service name'. #34 rhurbarb

  • Senior Member
  • 143 posts

0
Neutral

Posted 23 November 2014 - 19:43

 

Hi ,Sorry are you saying this file is what i need to show pictures on my lcd screen,since updating to latest build i lost my lcd screen pictures which i used to get for streaming scenic webcam sites. 

No, this is nothing to do with displaying websites. It is for displaying picons by service name on the infobar and channel list. And it doesn't remove any function. It just adds an extra fallback.

 

Thanks Huevos

 

Re: Picons by 'Service name'. #35 Taapat

  • PLi® Core member
  • 2,342 posts

+120
Excellent

Posted 29 November 2014 - 21:14

Very nice option but it works only for users who use latin characters.
First of all, as I wrote in another topic, it will not work if in the name of the channel is, for example, the Cyrillic symbol. Maybe someone has an idea how to use such names. Maybe could be used translit from here: https://github.com/j2a/pytils to replace the symbols, but I think, that replace it one by one, is slowly. If it would be acceptable for one picon, then build the channel list with picons, not seem a good idea. Maybe someone else has a better and faster solution?

 

Second, if in the user bouquet is a wrong entry, then if it worked before with no problems, now is GSOD.
Today I saw one crashlog where in the user IPTV bouquet is strange entries, coming from the wrong convertible, and which now causes GSOD. For example:

#SERVICE 4097:0:0:0:0:0:0:0:0:0:http%3a//109.87.127.138%3a8888/udp/238.0.0.4%3a1234:ÈÍÒÅÐ

Causes:

File "/usr/lib/enigma2/python/Components/Renderer/Picon.py", line 75, in getPiconName
    name = unicodedata.normalize('NFKD', unicode(name, 'utf_8')).encode('ASCII', 'ignore')
  File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xc8 in position 0: invalid continuation byte

Of course, we can say that the user correct their bouquets, but very possible that someone may be sat channel with a similar problem.

Therefore, it seems to me that the manipulation of the encoding needs to be included in the try, but maybe also here is a better solution?



Re: Picons by 'Service name'. #36 Huevos

  • PLi® Contributor
  • 4,244 posts

+158
Excellent

Posted 29 November 2014 - 21:56

Taapat, your bouquets files should only contain UTF-8 characters. If you have used the wrong charset that is not the fault of this code, but the person creating the settings.



Re: Picons by 'Service name'. #37 Erik Slagter

  • PLi® Core member
  • 46,951 posts

+541
Excellent

Posted 30 November 2014 - 09:02

I agree with Huevos, but can't we make it failsafe and just ignore the non-UTF-noise?


* Wavefrontier T90 with 28E/23E/19E/13E via SCR switches 2 x 2 x 6 user bands
I don't read PM -> if you have something to ask or to report, do it in the forum so others can benefit. I don't take freelance jobs.
Ik lees geen PM -> als je iets te vragen of te melden hebt, doe het op het forum, zodat anderen er ook wat aan hebben.


Re: Picons by 'Service name'. #38 athoik

  • PLi® Core member
  • 8,458 posts

+327
Excellent

Posted 30 November 2014 - 09:09

I agree with Huevos, but can't we make it failsafe and just ignore the non-UTF-noise?


Can you try this:
 
    name = unicodedata.normalize('NFKD', name.decode('utf-8', 'ignore')).encode('ASCII', 'ignore')

Edited by athoik, 30 November 2014 - 09:10.

Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: Picons by 'Service name'. #39 Huevos

  • PLi® Contributor
  • 4,244 posts

+158
Excellent

Posted 1 December 2014 - 10:13

Works for me... but I don't have broken settings.



Re: Picons by 'Service name'. #40 Pr2

  • PLi® Contributor
  • 6,070 posts

+257
Excellent

Posted 22 December 2014 - 23:03

Hi,

 

I am now creating my picons based on the name instead of the service reference (when possible) and this give me the following idea:

 

- Can you improve the picon assignement by name by ignoring the HD reference in the TV channel name when the picon is not there.

 

For exemple TF1 HD can use the picon tf1.png if tf1hd.png doesn't exist.

 

What do you think of this improvement?

This will avoid to duplicate picons and create symlink for SD and HD channels since most of them use the same logos.

 

Pr2


NO SUPPORT by PM, it is a forum make your question public so everybody can benefit from the question/answer.
If you think that my answer helps you, you can press the up arrow in bottom right of the answer.

Wanna help with OpenPLi Translation? Please read our Wiki Information for translators

Sat: Hotbird 13.0E, Astra 19.2E, Eutelsat5A 5.0W
VU+ Solo 4K: 2*DVB-S2 + 2*DVB-C/T/T2 (used in DVB-C) & Duo 4K: 2*DVB-S2X + DVB-C (FBC)

AB-Com: PULSe 4K 1*DVB-S2X (+ DVB-C/T/T2)
Edision OS Mio 4K: 1*DVB-S2X + 1*DVB-C/T/T2
 



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users