JamesLiAndroid / xbmc-addons-chinese

Automatically exported from code.google.com/p/xbmc-addons-chinese
0 stars 0 forks source link

Problem integrating keyboadChinese to Youtube 2.8 plugin in xbmc plugin #13

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi Taxigps,

I am trying to integrate the keyboadChinese into the latest youtube 2.8 (eden) 
using the method as explained in issue item #10 but not sucessful. Althought I 
can set zOrder=2 to place the "Youtube Loading directory" dialog window behind 
the keyboard, but the dialog window has taken focus and capture all keypad 
entries without passing on to the keyboardChinese. So the earlier simple fix 
does not work in this case.

I also observed one difference between the standard keyboard and 
keyboardChinese is that: the chinseKeyboard receives its key entry after xbmc 
process. This can be demostrated by press letter 's' where xbmc will bring up 
the 'exit' screen. This is not observed if standard keyboard is used. May be 
this is the reason why the "Youtube Loading directory" dialog window get 
launched and disrupt the keyboardChinese normal input.

Appreciate if you offer some solution how to integrate the keyboardChinse with 
the latest youtube plugin release. Thanks.

Original issue reported on code.google.com by en...@singnet.com.sg on 2 Jan 2012 at 2:23

GoogleCodeExporter commented 8 years ago
Hi, I had the same issue and settled down with a workaround. See detail in 
http://forum.xbmc.org/showthread.php?t=98194

Original comment by d744...@gmail.com on 3 Jan 2012 at 5:09

GoogleCodeExporter commented 8 years ago
Thanks, I actually also use a similar fix to work around like yours but hope 
taxigps can find a better solution than this.

I believe the reason for the pop-up is that the doModal function in 
KeyboardChinese does not 'hold' the xbmc system pop-up, triggered by the 
youtube isFolder=True in the selected item list. I believe the keyboardChinese 
function needs to release the focus as it requires to decode the pinyin entry 
by the user (This is only my guess).

However if the xbmc pop-up window does pass on the key entry not belongs to it 
(as in Dharma version), then the zorder=2 setting can still work.

Hope taxigps can find a solution.

Original comment by en...@singnet.com.sg on 7 Jan 2012 at 3:07

GoogleCodeExporter commented 8 years ago
See issue 10 as well.

Can't use youtube in China. So not test it.

Original comment by taxi...@sina.com on 20 Jan 2012 at 2:08

GoogleCodeExporter commented 8 years ago
ChineseKeyboard.py module:
onAction.action.getButtonCode() returns different keycode for Eden and Dharma; 
i.e.
Eden 0 ~ 9 => 61488 ~ 61497 whereas
Dharam 0 ~ 9 => 61536 ~ 61545
so keyboard button press 0 ~ 9  not working in Eden

Original comment by en...@singnet.com.sg on 22 Jan 2012 at 6:43

GoogleCodeExporter commented 8 years ago
Hi Taxigps:
Currently when user using keyboard to enter pinying, xbmc takes action on each 
key entry based on the action defined in system keyboard.xml keymapping. This 
interferes with the chinesekeyboad entry and slow down the whole response. e.g. 
when 's' is pressed, system popup the "exit/Power off System/ ..." menu. 
English keyboard does not have this problem.

Do you have any idea how to trap 'actionID' so that xbmc does not take action. 
I have been trying google around but cannot find any solution online.

Note: I have attached the file modified for the new getButtonCode for Eden for 
your reference.

Original comment by en...@singnet.com.sg on 22 Jan 2012 at 7:01

Attachments:

GoogleCodeExporter commented 8 years ago
fixed keycode error for eden at r192

Original comment by taxi...@sina.com on 25 Jan 2012 at 2:53

GoogleCodeExporter commented 8 years ago
I have released the ppstream 2.0.0 to add in the search function. For Dharma I 
am able to enable the chineseKeyboard; together with <zorder>2</zorder> added 
in DialogKeyboardChinese.xml for it to work properly.

However I have to use English Keyboard for Eden version due to the earlier 
problem reported.

May be you can try to enable the chinesekeyboard under module "def 
searchPPS():" in Eden version to have a better understanding of the problem 
reported earlier.

Wonder if we should bring the issue to xbmc team to request for their 
assistance to offer a solution for the chinesekeyboard.

Original comment by en...@singnet.com.sg on 27 Jan 2012 at 5:49

GoogleCodeExporter commented 8 years ago
use xbmc.sleep(1500) to ensure ChineseKeyboard get focus. see r208

Original comment by taxi...@sina.com on 29 Jan 2012 at 6:59

GoogleCodeExporter commented 8 years ago
The sleep(1500) does get the chinesekeyboard in focus and able to enter english 
text; although it is no as responsive as when compared to Dharma version.
However once the chinese pinyin is enabled, the whole keyboard becomes very 
sluggish, sometimes appears to hang. Look like we still have to look at it. 

Original comment by en...@singnet.com.sg on 31 Jan 2012 at 12:18

GoogleCodeExporter commented 8 years ago
I believe the chinesekeyboard sluggish response when the hanzi pinyin is 
enabled is due to baidu http access slow response/error (see log file below). 
Still need to find out why Dharma seems to perform better when using hanzi 
pinyin
========================================================================

18:23:58 T:3964  NOTICE: 
http://olime.baidu.com/py?py=b&rn=0&pn=20&ol=1&prd=shurufa.baidu.com&t=132861023
8
18:25:00 T:3964   ERROR: Exception in python script's onAction
18:25:00 T:3964   ERROR: Traceback (most recent call last):
18:25:00 T:3964   ERROR:   File 
"C:\Users\cmeng\AppData\Roaming\XBMC\addons\script.module.keyboard.chinese\lib\C
hineseKeyboard.py", line 126, in onAction
18:25:00 T:3964   ERROR: self.getChineseWord(s)
18:25:00 T:3964   ERROR:   File 
"C:\Users\cmeng\AppData\Roaming\XBMC\addons\script.module.keyboard.chinese\lib\C
hineseKeyboard.py", line 162, in getChineseWord
18:25:00 T:3964   ERROR: self.words=self.getwords(py)
18:25:00 T:3964   ERROR:   File 
"C:\Users\cmeng\AppData\Roaming\XBMC\addons\script.module.keyboard.chinese\lib\C
hineseKeyboard.py", line 223, in getwords
18:25:00 T:3964   ERROR: response = urllib2.urlopen(req)
18:25:00 T:3964   ERROR:   File "C:\Program Files 
(x86)\XBMC\system\python\Lib\urllib2.py", line 126, in urlopen
18:25:00 T:3964   ERROR: return _opener.open(url, data, timeout)
18:25:00 T:3964   ERROR:   File "C:\Program Files 
(x86)\XBMC\system\python\Lib\urllib2.py", line 397, in open
18:25:00 T:3964   ERROR: response = meth(req, response)
18:25:00 T:3964   ERROR:   File "C:\Program Files 
(x86)\XBMC\system\python\Lib\urllib2.py", line 510, in http_response
18:25:00 T:3964   ERROR: 'http', request, response, code, msg, hdrs)
18:25:00 T:3964   ERROR:   File "C:\Program Files 
(x86)\XBMC\system\python\Lib\urllib2.py", line 435, in error
18:25:00 T:3964   ERROR: return self._call_chain(*args)
18:25:00 T:3964   ERROR:   File "C:\Program Files 
(x86)\XBMC\system\python\Lib\urllib2.py", line 369, in _call_chain
18:25:00 T:3964   ERROR: result = func(*args)
18:25:00 T:3964   ERROR:   File "C:\Program Files 
(x86)\XBMC\system\python\Lib\urllib2.py", line 518, in http_error_default
18:25:00 T:3964   ERROR: raise HTTPError(req.get_full_url(), code, msg, hdrs, 
fp)
18:25:00 T:3964   ERROR: urllib2
18:25:00 T:3964   ERROR: .
18:25:00 T:3964   ERROR: HTTPError
18:25:00 T:3964   ERROR: :
18:25:00 T:3964   ERROR: HTTP Error 502: Bad Gateway 51001
18:25:00 T:3964  NOTICE: 
http://olime.baidu.com/py?py=bu&rn=0&pn=20&ol=1&prd=shurufa.baidu.com&t=13286103
00
18:25:01 T:3964  NOTICE: 
[[["\u4e0d",2],["\u90e8",2],["\u6b65",2],["\u5e03",2],["\u0062\u0075\u0067",2],[
"\u8865",2],["\u6355",2],["\u535c",2],["\u7c3f",2],["\u57e0",2],["\u6b69",2],["\
u949a",2],["\u6016",2],["\u535f",2],["\u54fa",2],["\u5425",2],["\u900b",2],["\u5
7d7",2],["\u91ad",2],["\u94b8",2]],"bu"]

Original comment by en...@singnet.com.sg on 7 Feb 2012 at 10:43

GoogleCodeExporter commented 8 years ago
I retry again on both Dharma and Eden. It looks like both versions behave the 
same whenever accessing to the olime.baidu has no reply i.e. sluggish response.

However one strange thing is that: when both XBMC Dharma/Eden is facing problem 
with ChineseKeyboard entry, continue getting error from Baidu olime; I paste 
the olime url link to an actual Mozilla Firefox browser, the baidu olime 
consistently gives me fast response and within < 1 second without fail. So what 
is the http parameter sent by Mozilla Firefox that make Baidu olime happy and 
serve with instant reply. Something need to investigate further.

Original comment by en...@singnet.com.sg on 9 Feb 2012 at 8:17

GoogleCodeExporter commented 8 years ago
Found that by including the cookie (extract from Mozilla Firefox using 
wireshark) in the http header helps to improve the success rate and speed in 
response from baidu olime, working very well even at this busiest hour of the 
night. The cookie seems to change when using IE9, but remains the same with 
Firefox even across sessions. No sure if the cookie change with date, so need 
to investigate further. Can be a solution if cookie stay constant. will check 
again tommorrow night.

==========================================================================
req.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0) 
Gecko/20100101 Firefox/10.0')
req.add_header('Cookie', 'BAIDUID=9056ED272CC1696BE2896EC96A43B806:FG=1')

Original comment by en...@singnet.com.sg on 9 Feb 2012 at 1:55

GoogleCodeExporter commented 8 years ago
Hi Taxigps,
Just released the keyboardchinese v1.2.0. Temporary hardcorded the cookie as 
Firefox indicates the cookie only expires in 2042. The cookie is a must to 
avoid forcibly close by remote baidu host. Still unable to find out how/where 
Mozilla gets the cookie to use.

Please help to test in China if there is problem with the hard coded cookie.

============================================= 
Cookie: BAIDUID=9056ED272CC1696BE2896EC96A43B806:FG=1   Expires: Friday, February 
07, 2042 8:40:47 PM

Original comment by en...@singnet.com.sg on 10 Feb 2012 at 3:02

GoogleCodeExporter commented 8 years ago
Patch to allow Chinese text input for youtube plugin search on XBMC EDEN. To 
install:
navigate to System=>Settings=>Add-ons=>Install from zip file
Browse to and select the downloaded file i.e. script.module.parsedom.zip

Note: You also need to install script.module.keyboard.chinese-1.1.1-eden.zip 
from the following link: 
http://code.google.com/p/xbmc-addons-chinese/downloads/list

Original comment by en...@singnet.com.sg on 23 Feb 2012 at 1:05

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by taxi...@sina.com on 18 Jun 2012 at 1:58