Jump to content


Photo

TSmedia enigma2 plugin 1.0


  • This topic is locked This topic is locked
2611 replies to this topic

Re: TSmedia enigma2 plugin 1.0 #2521 mfaraj57

  • Senior Member
  • 1,605 posts

+286
Excellent

Posted 21 September 2018 - 10:02

@samsamsam

still last point regarding history,i know you got more headache by developing the keyboard but think for it in future

now instead of adding more lists for search history which seem you do not like,may add this functionality to suggestion list.Lets say you type letter d then first the keyboard search for words started by letter d in search history and display them in top of suggestion list before provider suggestions,this is the way used by chrome google search.

if you do not like the idea just forget it.

regards


Edited by mfaraj57, 21 September 2018 - 10:03.


Re: TSmedia enigma2 plugin 1.0 #2522 samsamsam

  • Senior Member
  • 2,024 posts

+146
Excellent

Posted 21 September 2018 - 10:51

Hello @mfaraj57,
 
 
If you what to use python threading to make calculation or other staff that burden the processor then you should not do this because it will have effect as you described.
, because of GIL execution of your task will block execution of the python code from main enigma2 thread, so you will see spinner and so on.
 
If you want to make calculation or others time-consuming staff which burden the processo you have two possibilities:
1. Use separate process and made these calculation in separate process (second process np. python script should be executed with eConsoleApp)
2. Write module to python which will make all calculation in the C, if you need you can even create C thread (using pthread) which will not take GIL when not needed. 
 
Here you can found good article which described On the restrictions associated with GIL:
 

may be  the cause of abnormal behaviour by using GUI component through the thread but still need solution.
 
You should never use engiam2 components from different python threads because enigma2 components are not thread safety.
If you use twisted module then you can easy push some function from your thread to be executed in the context of the main thread.
 
To do this you can call reactor.callFromThread to delegate execution of function to main thread.
 
For example:
 
import threading
import urllib
import urllib.request
import time
from twisted.internet import reactor
 
def getTextLabel(url, callback):
    # becaouse of GIL you should not made a long 
    # blocking operation in this thread 
    
    # for example, this is OK
    # sleep will release GIL so main thread will not be blocked, sleep in this thread will not cause spinner
    time.sleep(100000) 
    
    # this is NOT OK, such code will cause spinner
    agg = 0
    for i in range(1000000):
        agg *= i
        for j in range(1000000):
            agg *= j
            for k in range(1000000):
                agg *= k
    
    # this is OK - connection will release GIL
    response = urllib.request.urlopen(url)
    
    html = response.read()
    
    # !!!!!!!!!!!!!!!!!!!!!!
    # you should NOT modify eLabel component from here
    # like that:
    # self["console"].setText(html)
    # you must delegate this task to main thread
    
    reactor.callFromThread(callback, html)
 
def setTextToLabel(html):
    # this will be executed from main thread
    # so you can modify for example eLabel component from here
    self["console"].setText(html)
 
def callInWorkThread(target, *args, **kwargs)
    thread = Thread = threading.Thread(target = target, name = target.Callable.__name__, args = args, kwargs = kwargs)
    thread = Thread.start()
    return thread
 
def SomeMethodOfYourScreen():
    # here we are in the main thread
    callInWorkThread(target = getTextLabel, 'http://python.org/', setTextToLabel)
 

Edited by samsamsam, 21 September 2018 - 10:54.


Re: TSmedia enigma2 plugin 1.0 #2523 samsamsam

  • Senior Member
  • 2,024 posts

+146
Excellent

Posted 21 September 2018 - 11:00

As I wrote I do not use twisted because it is not available in all Enigma2 distribution.

I use Timer component and callbacks Queue, to delegate function to the main thread.

 

This is poll technique which is less effective than reactor.callFromThread(...) but I made a choice to support users even with very old Enigma2 distributions were twisted module is not available.



Re: TSmedia enigma2 plugin 1.0 #2524 samsamsam

  • Senior Member
  • 2,024 posts

+146
Excellent

Posted 21 September 2018 - 11:06

@samsamsam

 

In the E2iPlayer to receive data from server (download source code of web pages) PyCurl can be used. With PyCurl data are download without global interpreter lock taken. 

 

Yes,i know Pycurl but never used it as said it is faster than requests and urllib but using external library with enigma still have some limitation,i do not know if curl library included with default eniigma python package or no but mostly no.

however i do not have problem with using curl because there is library for kodi script.module.pycurl and i can use it easily with TSmedia

https://github.com/a...t.module.pycurl

last time i read the code of your E2iPlayer i noticed you are using urllib2 in getpage funciton or class but not pycurl.

 

E2iPlayer can use both urllib2 or PyCurl. Depend on what you have in the system.

If you have valid PyCurl in the system and you enabled PyCurl in the E2iPlayer configuration then PyCurl will be used.

 

E2iPlayer will not use PyCurl which not allow to cancel DNS request. This depend how libcurl was build.

Anyway I prepared precompiled packages with PyCurl + libcurl + WolfSSL (light replacement of openssl):

http://www.iptvplaye...urlinstall.html

so user can simple install valid PyCurl.

 

They are installed to /iptvplayer_rootfs so they will do not overwrite system components.



Re: TSmedia enigma2 plugin 1.0 #2525 samsamsam

  • Senior Member
  • 2,024 posts

+146
Excellent

Posted 21 September 2018 - 11:14

@samsamsam

... more lists for search history which seem you do not like ...

 

I never said that I do not like this. There is no need to add more lists to implement this. 
The list of languages can be used to show search history as well.
 
If you do not press Language button then in this list search history phrases will be displayed, when you press  Language button  then languages will be shown and after language selection the content will be changed to search history and so on.
 
I never said I do not like this, simple I do not have time to implement this. Yesterday evening, I added a calculation for HD skin, so after update to last E2iPlayer version "2018.09.21.01" you can check how VK skin for full HD looks.
 
Regards,
SSS

Edited by samsamsam, 21 September 2018 - 11:16.


Re: TSmedia enigma2 plugin 1.0 #2526 samsamsam

  • Senior Member
  • 2,024 posts

+146
Excellent

Posted 21 September 2018 - 15:33


Lets say you type letter d then first the keyboard search for words started by letter d in search history and display them in top of suggestion list before provider suggestions,this is the way used by chrome google search.

 

 

​Such functionality can be implemented without any change in the E2iVirtualKeyBoard.

SugestionsProvider implementation is not part of the E2iVirtualKeyBoard.

E2iVirtualKeyBoard only interact with SugestionsProvider object but list of suggestions is prepared by SugestionsProvider, so if you wrote your own suggestion provider which will put phrases from the search history at the beginning of the list (if they start from the text which was put by the user) then you will got what you want.

 

So, there is no need any change in the E2iVirtualKeyBoard  to have such effect. 


Edited by samsamsam, 21 September 2018 - 15:34.


Re: TSmedia enigma2 plugin 1.0 #2527 mick80

  • Senior Member
  • 254 posts

+6
Neutral

Posted 21 September 2018 - 20:28

Hey mfaraj57, I've noticed that items bookmarked to favorites now get a gray "favorites" thumbnail when launched from inside the favorite section. Is there any way to turn this off? I'd rather have the addon's main icon to be displayed just like it happens when launching the addon from inside the desktop. At the very least it'd be nice to have the option in settings to choose one or the other.

Usually the image of the added item stored within the favorites.xml so should be displayed as screenshot down shows,but sometimes the item image is not available so the icon of the addon is displayed if installed if not installed the favorites icon displayed
However i have to check that because no problem with this in my system

fav.jpg
Yeah, I don't have any issues with that particular addon either. But check out the videomediaset addon you recently fixed for instance. I have bookmarked a bunch of items from videomediaset to favorites and until a couple of days ago I would see the addon's main icon when navigating inside those items from favorites. Now this is what I get instead.
1c4c2f565404ee63b601226111ed1831.jpg
Of course, if I launch the addon from the desktop, or its respective section for that matter, and navigate to the very same items, I'm normally seeing the addon's icon.
0f25615b746977c706d91342d9ca41f3.jpg

Re: TSmedia enigma2 plugin 1.0 #2528 mfaraj57

  • Senior Member
  • 1,605 posts

+286
Excellent

Posted 21 September 2018 - 20:48

yes ,understand that now,i will check and see why.



Re: TSmedia enigma2 plugin 1.0 #2529 mfaraj57

  • Senior Member
  • 1,605 posts

+286
Excellent

Posted 21 September 2018 - 21:06

I added some items to favorites and this what  i got

 

This is my favrities xml please compare picture item with yours ,expect your favorites2.xml in movie media/hdd/movies folder

<root>
    <addon id = "videomediaset" section = "international">
        <media
            picture = "https://static2.mediasetplay.mediaset.it/Mediaset_Italia_Production_-_Main/37/568/ST000000000798-2-vertical-264x396.jpg"
            title = "101%-Pucci"
            url = "/usr/lib/enigma2/python/Plugins/Extensions/TSmedia/addons/international/videomediaset/default.py?series_id=http%3A%2F%2Fdata.entertainment.tv.theplatform.eu%2Fentertainment%2Fdata%2FProgram%2Fguid%2F2702976343%2FSE000000000442&amp;mode=programma"/>
    </addon>
    <addon id = "videomediaset" section = "international">
        <media
            picture = "https://static2.mediasetplay.mediaset.it/Mediaset_Italia_Production_-_Main/33/664/ST000000000786-2-vertical-264x396.jpg"
            title = "About-Love"
            url = "/usr/lib/enigma2/python/Plugins/Extensions/TSmedia/addons/international/videomediaset/default.py?series_id=http%3A%2F%2Fdata.entertainment.tv.theplatform.eu%2Fentertainment%2Fdata%2FProgram%2Fguid%2F2702976343%2FSE000000000433&amp;mode=programma"/>
    </addon>
    <addon id = "videomediaset" section = "international">
        <media
            picture = "https://static2.mediasetplay.mediaset.it/Mediaset_Italia_Production_-_Main/795/452/ST000000000463-1-vertical-264x396.jpg"
            title = "Accademia-del-benessere"
            url = "/usr/lib/enigma2/python/Plugins/Extensions/TSmedia/addons/international/videomediaset/default.py?series_id=http%3A%2F%2Fdata.entertainment.tv.theplatform.eu%2Fentertainment%2Fdata%2FProgram%2Fguid%2F2702976343%2FSE000000000188&amp;mode=programma"/>
    </addon>
    <addon id = "videomediaset" section = "international">
        <media
            picture = "https://static2.mediasetplay.mediaset.it/Mediaset_Italia_Production_-_Main/989/828/ST000000000378-3-vertical-264x396.jpg"
            title = "Adesso-Cinema!"
            url = "/usr/lib/enigma2/python/Plugins/Extensions/TSmedia/addons/international/videomediaset/default.py?series_id=http%3A%2F%2Fdata.entertainment.tv.theplatform.eu%2Fentertainment%2Fdata%2FProgram%2Fguid%2F2702976343%2FSE000000000136&amp;mode=programma"/>
    </addon>
</root>

screenshot.jpg



Re: TSmedia enigma2 plugin 1.0 #2530 mick80

  • Senior Member
  • 254 posts

+6
Neutral

Posted 21 September 2018 - 22:11

My bad, I should have made myself more clear. The issue only happens after I hit one of the bookmarked items from within the favorites section. Icons in favorites are okay. So, for example, I've bookmarked "Tutti i programmi", and once I open it, that's when I get the gray favorites icon instead of mediaset's icon (I've disabled thumbnails for the time being).

And the issue also affects other addons' items bookmarked to favorites, not just mediaset's. I think it started a couple days ago.

Re: TSmedia enigma2 plugin 1.0 #2531 mick80

  • Senior Member
  • 254 posts

+6
Neutral

Posted 22 September 2018 - 21:29

Don't worry about all that, mfaraj57. I've realized that nothing's really changed after all, except for the fact that you've replaced the favorites icon in the micons folder. The previous one with the TSmedia logo was a lot cooler, while this gray one is low quality and unimpressive, so it threw me off. Anyway, I've downloaded an old update and managed to find the original icon and replaced it myself.

Re: TSmedia enigma2 plugin 1.0 #2532 mfaraj57

  • Senior Member
  • 1,605 posts

+286
Excellent

Posted 22 September 2018 - 22:42

Just sent update and should solve the problem.
Yes oĺd icon is better but replaced for now with this because the old one is not accepted by vu plus boxes.
Will try to keep the old one when make it compatable with cu boxes

Re: TSmedia enigma2 plugin 1.0 #2533 mick80

  • Senior Member
  • 254 posts

+6
Neutral

Posted 23 September 2018 - 07:09

Okay, thanks for clearing it up.



Re: TSmedia enigma2 plugin 1.0 #2534 mfaraj57

  • Senior Member
  • 1,605 posts

+286
Excellent

Posted 23 September 2018 - 21:13

Hello @mfaraj57,


If you what to use python threading to make calculation or other staff that burden the processor then you should not do this because it will have effect as you described.
, because of GIL execution of your task will block execution of the python code from main enigma2 thread, so you will see spinner and so on.

If you want to make calculation or others time-consuming staff which burden the processo you have two possibilities:
1. Use separate process and made these calculation in separate process (second process np. python script should be executed with eConsoleApp)
2. Write module to python which will make all calculation in the C, if you need you can even create C thread (using pthread) which will not take GIL when not needed.

Here you can found good article which described On the restrictions associated with GIL:
https://opensource.c...e/17/4/grok-gil


may be the cause of abnormal behaviour by using GUI component through the thread but still need solution.


You should never use engiam2 components from different python threads because enigma2 components are not thread safety.
If you use twisted module then you can easy push some function from your thread to be executed in the context of the main thread.

To do this you can call reactor.callFromThread to delegate execution of function to main thread.

For example:


import threadingimport urllibimport urllib.requestimport timefrom twisted.internet import reactor def getTextLabel(url, callback):    # becaouse of GIL you should not made a long     # blocking operation in this thread         # for example, this is OK    # sleep will release GIL so main thread will not be blocked, sleep in this thread will not cause spinner    time.sleep(100000)         # this is NOT OK, such code will cause spinner    agg = 0    for i in range(1000000):        agg *= i        for j in range(1000000):            agg *= j            for k in range(1000000):                agg *= k        # this is OK - connection will release GIL    response = urllib.request.urlopen(url)        html = response.read()        # !!!!!!!!!!!!!!!!!!!!!!    # you should NOT modify eLabel component from here    # like that:    # self["console"].setText(html)    # you must delegate this task to main thread        reactor.callFromThread(callback, html) def setTextToLabel(html):    # this will be executed from main thread    # so you can modify for example eLabel component from here    self["console"].setText(html) def callInWorkThread(target, *args, **kwargs)    thread = Thread = threading.Thread(target = target, name = target.Callable.__name__, args = args, kwargs = kwargs)    thread = Thread.start()    return thread def SomeMethodOfYourScreen():    # here we are in the main thread    callInWorkThread(target = getTextLabel, 'http://python.org/', setTextToLabel) 
Thanks samsamsam
The informations and ideas looks interesting,hope get some time to apply and see.
I do not want to go deep before examining the code but using twisted has problems with some secure links as i put thread in this forum in the past but i do not have the link now.
Econsoleapp is very slow with time consuming processes.
However i am using threading now to process the host module and to get the data without problem,i bypassed the behavior problem mentioned above by showing gui component by using etimer from the opened thread.

Edited by mfaraj57, 23 September 2018 - 21:14.


Re: TSmedia enigma2 plugin 1.0 #2535 mfaraj57

  • Senior Member
  • 1,605 posts

+286
Excellent

Posted 23 September 2018 - 21:25

@samsamsam
... more lists for search history which seem you do not like ...

 
I never said that I do not like this. There is no need to add more lists to implement this. 
The list of languages can be used to show search history as well.
 
If you do not press Language button then in this list search history phrases will be displayed, when you press  Language button  then languages will be shown and after language selection the content will be changed to search history and so on.
 
I never said I do not like this, simple I do not have time to implement this. Yesterday evening, I added a calculation for HD skin, so after update to last E2iPlayer version "2018.09.21.01" you can check how VK skin for full HD looks.
 
Regards,
SSS
Just tested the keyboard with fhd skin and it is ok now.
But some some shortcuts needed like space,when you set focus to text field and you want to put space after the marker position you have to move to the space bar in the bottom of the keyboard then go again to set focus in text field to type your text.In the current enigma keyboard usually 0 rc button assigned by default to space and the small arrows for forward and backword delete.
Also language if you want to switch between languages you have search for your language in long list and when you want to change the language you have to go again to long list,so switch between installed only needed.
Also noticed i selected italian language then cancelled when the keyboard asked me to install but every time i opened the keyboard asked me if you want to install italian language.

Re: TSmedia enigma2 plugin 1.0 #2536 mick80

  • Senior Member
  • 254 posts

+6
Neutral

Posted 24 September 2018 - 13:37

Just sent update and should solve the problem.

Yeah, fix for favorites section works great. Now it's exactly like launching addons from their respective section or desktop.



Re: TSmedia enigma2 plugin 1.0 #2537 wortellica

  • Senior Member
  • 1,370 posts

+33
Good

Posted 24 September 2018 - 22:01

Where can i find the latest Tsmedia plugin for OpenPLi ?

Re: TSmedia enigma2 plugin 1.0 #2538 mfaraj57

  • Senior Member
  • 1,605 posts

+286
Excellent

Posted 25 September 2018 - 14:16

Where can i find the latest Tsmedia plugin for OpenPLi ?

Use putty or any other telnet client and put this command

wget http://tunisia-dreambox.info/TSmedia/software_official/installer.sh -O - | /bin/sh

Edited by mfaraj57, 25 September 2018 - 14:17.


Re: TSmedia enigma2 plugin 1.0 #2539 mick80

  • Senior Member
  • 254 posts

+6
Neutral

Posted 27 September 2018 - 07:57

Hey mfaraj57, there's something wrong with the virtual keyboard in TStube. SMS-style typing method is not enabled and mute button, which you have recently mapped to clear out the search bar again, doesn't work. Keyboard works fine in all other addons.



Re: TSmedia enigma2 plugin 1.0 #2540 mick80

  • Senior Member
  • 254 posts

+6
Neutral

Posted 28 September 2018 - 12:30

Keyboard in TStube fixed with latest updates. Thanks mfaraj.




3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users