Jump to content


Photo

%f ,%d phyton code


  • Please log in to reply
33 replies to this topic

#1 jpuigs

  • Senior Member
  • 1,143 posts

+32
Good

Posted 19 September 2014 - 10:36

I've modified channel list skin's code to include a transponder or frequency information when browsing channel lists.

<widget borderWidth="2" source="ServiceEvent" foregroundColor="foreground" backgroundColor="secondBG" render="Label" position="598,635" size="571,25" transparent="1" noWrap="1" font="prive3; 22" zPosition="1">

      <convert type="ServiceName2">TpansponderInfo</convert>

    </widget>

 

I want the terrestrial freq. to be shown in Mhz format , not Khz.

 

On ServiceName2.py file , line which contains:

elif f == 'F': # %F - frequency (dvb-s/s2/c/t) in KHz

    if type in ('DVB-S','DVB-C','DVB-T'):

     result += '%d'%(self.tpdata.get('frequency', 0) / 1000)

 

 

has been "slipt" to be different between DVB-T and DVB-S

elif f == 'F': # %F - frequency (dvb-s/s2/c/t) in KHz

    if type in ('DVB-S'):

     result += '%d'%(self.tpdata.get('frequency', 0) / 1000)

    if type in ('DVB-T','DVB-C'):

     result += '%.3f'%(((self.tpdata.get('frequency', 0) / 1000) +1) /1000)

 

The "+1" is there because terrestrial freq's. showed 569999 instead 570000

 

But I have a problem:

If I use the last code I've written, I get 184.000 , and the real value I'd have to get is 184.500 Mhz.

If I change code to

result += '%.3f'%((self.tpdata.get('frequency', 0) / 1000) +1)

I get : 184500.000 

 

I want to get 184.500

 

How Could I do it ?

 


Enigma is getting old....

 

Spoiler

Re: %f ,%d phyton code #2 littlesat

  • PLi® Core member
  • 56,262 posts

+691
Excellent

Posted 19 September 2014 - 14:29

Devide the freq by 1000000

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


Re: %f ,%d phyton code #3 MiLo

  • PLi® Core member
  • 14,045 posts

+298
Excellent

Posted 19 September 2014 - 18:11

1/2 delivers an integer result in Python, hence it's "0". If one of the numbers is a floating point, it will use floating point output.

 

>>> 1/2
0
>>> 1.0/2
0.5
>>> 1/2.0
0.5

So use "1000.0" instead of "1000" and it'll probably do as you expect.


Real musicians never die - they just decompose

Re: %f ,%d phyton code #4 MiLo

  • PLi® Core member
  • 14,045 posts

+298
Excellent

Posted 19 September 2014 - 18:13

By the way, if you want to "round" the outcome, add half the divider:

 

kHz = (MHz + 500)/ 1000

 

That will work better than the "+1" later on.


Real musicians never die - they just decompose

Re: %f ,%d phyton code #5 jpuigs

  • Senior Member
  • 1,143 posts

+32
Good

Posted 19 September 2014 - 21:18

OK thanks. I'll try.


Enigma is getting old....

 

Spoiler

Re: %f ,%d phyton code #6 jpuigs

  • Senior Member
  • 1,143 posts

+32
Good

Posted 21 September 2014 - 20:25

Solved.

if type in ('DVB-C','DVB-T'):

     result += '%.3f'%(((self.tpdata.get('frequency', 0) / 1000) +1) / 1000.0) +" Mhz. "

Attached Files


Enigma is getting old....

 

Spoiler

Re: %f ,%d phyton code #7 littlesat

  • PLi® Core member
  • 56,262 posts

+691
Excellent

Posted 22 September 2014 - 01:23

I suggest you only need to adjust the +1... See post #4


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


Re: %f ,%d phyton code #8 jpuigs

  • Senior Member
  • 1,143 posts

+32
Good

Posted 22 September 2014 - 23:35

Done.

result += '%.3f'%(((self.tpdata.get('frequency', 0) +500) / 1000) / 1000.0) + " Mhz. "

Thanks.


Enigma is getting old....

 

Spoiler

Re: %f ,%d phyton code #9 littlesat

  • PLi® Core member
  • 56,262 posts

+691
Excellent

Posted 23 September 2014 - 06:54

And now the en results of your code please... ;)

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


Re: %f ,%d phyton code #10 athoik

  • PLi® Core member
  • 8,458 posts

+327
Excellent

Posted 23 September 2014 - 14:20



result += '%.3f'%(((self.tpdata.get('frequency', 0) +500) / 1000) / 1000.0) + " Mhz. "

 

Better to use Mhz inside formating.

result += '%.3f Mhz. '%(((self.tpdata.get('frequency', 0) +500) / 1000) / 1000.0)


>>> '%.3f Mhz. '%(((350000000 +500) / 1000) / 1000.0)
'350.000 Mhz. '


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: %f ,%d phyton code #11 jpuigs

  • Senior Member
  • 1,143 posts

+32
Good

Posted 23 September 2014 - 15:58


Better to use Mhz inside formating.

result += '%.3f Mhz. '%(((self.tpdata.get('frequency', 0) +500) / 1000) / 1000.0)


>>> '%.3f Mhz. '%(((350000000 +500) / 1000) / 1000.0)
'350.000 Mhz. '

 

Thanks, I didn't know it.

I tried mine's, and as It worked, I thought it was correct.

 

 

And now the en results of your code please... ;)

 

What do you mean ? screenshot ?


Enigma is getting old....

 

Spoiler

Re: %f ,%d phyton code #12 jpuigs

  • Senior Member
  • 1,143 posts

+32
Good

Posted 25 September 2014 - 00:57

The final results.

 

Using Pli-HD Skin and some others (f.i. PD1-LOI-FullHD), when I'm browsing into Channel Lists, it may hapopen that you have several services with similar or equal names.

So, a simple way of knowing which service we are browsing is to have it's technical frequency details on screen.

I remember to have seen it on some other skins some time ago.

 

We have to include the python file Servicename2.py on /usr/lib/enigma2/phyton/Components/Converter/

I got it from 2boom and modified it to show some frequencies in a desired way as you've already read before.

 

Attached File  ServiceName2.py   22.67KB   11 downloads

 

 

Then, using skin file ( /usr/share/enigma2/PLi-HD/skin.xml ) I edit it and make channel List a bit smaller, to have enough space to include an info line.

 

I change on line 237 size, 690,510 to 690,450

<widget name="list" position="530,110" size="690,510" itemHeight="30" colorServiceDescription="yellow" transparent="1" serviceNumberFont="Regular;24" scrollbarMode="showOnDemand" serviceInfoFont="Regular;22" serviceNameFont="Regular;24" serviceItemHeight="30" foregroundColorServiceNotAvail="#656565" foregroundColorEventSelected="#ccc040" foregroundColorMarkedSelected="#902020" backgroundColorMarkedSelected="#656565" selectionPixmap="PLi-HD/buttons/sel.png" />

to:


<widget name="list" position="530,110" size="690,450" itemHeight="30" colorServiceDescription="yellow" transparent="1" serviceNumberFont="Regular;24" scrollbarMode="showOnDemand" serviceInfoFont="Regular;22" serviceNameFont="Regular;24" serviceItemHeight="30" foregroundColorServiceNotAvail="#656565" foregroundColorEventSelected="#ccc040" foregroundColorMarkedSelected="#902020" backgroundColorMarkedSelected="#656565" selectionPixmap="PLi-HD/buttons/sel.png" />

and after that I add the following line:

<widget borderWidth="2" source="ServiceEvent" foregroundColor="green" backgroundColor="secondBG" render="Label" position="550,590" size="620,26" transparent="1" noWrap="1" font="Regular; 24" zPosition="1">

      <convert type="ServiceName2">TpansponderInfo</convert>

    </widget>

And finally I get that desired green info line:

 

Attached File  PLI-HD-mod1.jpg   86.59KB   2 downloads        Attached File  PLI-HD-mod2.jpg   84.33KB   3 downloads

 

 

 

 


Enigma is getting old....

 

Spoiler

Re: %f ,%d phyton code #13 dax

  • Senior Member
  • 228 posts

0
Neutral

Posted 30 September 2014 - 12:56

Well done! Is it possible to show more info also for dvb-t channell? I mean

642.000 MHz 8k 64qam 2/3 1/4

instead of

642.000 MHz auto auto auto auto

Thanks



Re: %f ,%d phyton code #14 Robinson

  • Senior Member
  • 2,616 posts

+30
Good

Posted 30 September 2014 - 14:55

Could this be implemented in a standard PLi HD skin, please?


ET9000, OpenPLi 4.0, 13E, 19E

HD51, OpenPLi 6.2, 75E - 30W


Re: %f ,%d phyton code #15 littlesat

  • PLi® Core member
  • 56,262 posts

+691
Excellent

Posted 30 September 2014 - 16:57

Under the channel selector isn't a good idea.... possibly when a better place could be found it can be considered...


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


Re: %f ,%d phyton code #16 jpuigs

  • Senior Member
  • 1,143 posts

+32
Good

Posted 30 September 2014 - 19:47

Well done! Is it possible to show more info also for dvb-t channell? I mean

642.000 MHz 8k 64qam 2/3 1/4

instead of

642.000 MHz auto auto auto auto

Thanks

 

Well, I think it's not always possible.

It depends on "how" channels have been tuned and stored.

That info green line shows data stored on (db) channel lists, so if you have stored several services using "auto" options (which always work on DTT services) , you'll see "auto" values always.

Correct me if I'm wrong please.

 

 

 

Could this be implemented in a standard PLi HD skin, please?

 

If they want, it'd be a good idea.

 

 

Under the channel selector isn't a good idea.... possibly when a better place could be found it can be considered...

 

Why ?

I've reduced list size to have enough space to place it.

Where would you place it ?


Enigma is getting old....

 

Spoiler

Re: %f ,%d phyton code #17 Robinson

  • Senior Member
  • 2,616 posts

+30
Good

Posted 30 September 2014 - 20:02

By the way, is this the same info that is available under Menu - Show transponder info (when in channel list)?

Because my dream would be to somehow see more information (at least SID, and perhaps VPID, APID) without actually having to zap to the channel.


ET9000, OpenPLi 4.0, 13E, 19E

HD51, OpenPLi 6.2, 75E - 30W


Re: %f ,%d phyton code #18 jpuigs

  • Senior Member
  • 1,143 posts

+32
Good

Posted 30 September 2014 - 20:34

Yes, it's the same info. Info stored on database

The info you'd like to see, would be shown if it's stored on lamedb.

I think that PIds are not always stored.


Enigma is getting old....

 

Spoiler

Re: %f ,%d phyton code #19 dax

  • Senior Member
  • 228 posts

0
Neutral

Posted 30 September 2014 - 21:39

 

Well, I think it's not always possible.

It depends on "how" channels have been tuned and stored.

That info green line shows data stored on (db) channel lists, so if you have stored several services using "auto" options (which always work on DTT services) , you'll see "auto" values always.

Correct me if I'm wrong please.


 

 

Thanks for the answer!

Is it possible to remove "auto" mode? From wich files? My utopia :)

When we go to the main channel list (by typing down arrow) the widget show 0 Mhz. Could you delete?



 



Re: %f ,%d phyton code #20 dax

  • Senior Member
  • 228 posts

0
Neutral

Posted 30 September 2014 - 21:48

Thanks for the answer!

Is it possible to remove "auto" mode? From wich files? My utopia :)

When we go to the main channel list (by typing down arrow) the widget show 0 Mhz. Could you delete?



 

If i modify the lamebd file

eeee0000:23e5:217c
	t 641999999:0:5:5:3:2:4:4:2:0:0:0

doesn't work...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users