why [for *** in ***] doesnt works?
#1
Hi ALL

The default.py is from plugin.video.youporngay
I use log funtion to debug playVideo function
but I fond for url in match: doesnt works

------------------------------------------------------
def playVideo(url):
log("match: insun")
req = urllib2.Request(url)
req.add_header('Cookie', 'age_verified=1; path=/; domain=.youporngay.com')
response = urllib2.urlopen(req)
link=response.read()
response.close()
match=re.compile('<a href="([^"]+)">MP4 - For Windows 7, Mac and iPad').findall(link)
for url in match:
log("match: insun2")
log("match: url: %s" % url)
#listitem = xbmcgui.ListItem(path=htmlp.unescape(url))

log("match: insun3")
return xbmcplugin.setResolvedUrl(thisPlugin, True, listitem)

the insun2 is missing in kodi.log
------------------------------------------
the log block:
16:57:51 T:5652 DEBUG: plugin.video.youporngay: match: insun
16:57:51 T:7408 DEBUG: DialogProgress::StartModal called
16:57:51 T:7408 DEBUG: ------ Window Init (DialogProgress.xml) ------
16:57:52 T:5652 DEBUG: plugin.video.youporngay: match: insun3
16:57:52 T:5652 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.NameError'>
Error Contents: global name 'listitem' is not defined
Traceback (most recent call last):
File "C:\Users\Insun\AppData\Roaming\Kodi\addons\plugin.video.youporngay\default.py", line 130, in <module>
playVideo(url)
File "C:\Users\Insun\AppData\Roaming\Kodi\addons\plugin.video.youporngay\default.py", line 76, in playVideo
return xbmcplugin.setResolvedUrl(thisPlugin, True, listitem)
NameError: global name 'listitem' is not defined
-->End of Python script error report<--
16:57:52 T:5652 INFO: Python script stopped
16:57:52 T:5652 DEBUG: Thread LanguageInvoker 5652 terminating
16:57:52 T:7408 DEBUG: ------ Window Init (DialogKaiToast.xml) ------
16:57:53 T:4344 INFO: CActiveAESink::OpenSink - initialize sink
16:57:53 T:4344 DEBUG: CActiveAESink::OpenSink - trying to open device DIRECTSOUND:default
16:57:53 T:7408 DEBUG: XFILE::CPluginDirectory::WaitOnScriptResult - plugin exited prematurely - terminating
16:57:53 T:4344 DEBUG: CAESinkDirectSound::Initialize: Using Window handle: 1705038
16:57:53 T:7408 ERROR: Playlist Player: skipping unplayable item: 0, path [plugin://plugin.video.youporngay/?url=http%3A%2F%2Fwww.youporngay.com%2Fwatch%2F8884229%2Fcelebrity-beater-marian-rivera%2F&mode=2]
16:57:53 T:4344 DEBUG: CAESinkDirectSound::Initialize: secondary buffer created
16:57:53 T:7408 DEBUG: Playlist Player: one or more items failed to play... aborting playback
16:57:53 T:7408 DEBUG: ------ Window Init (DialogOK.xml) ------
Reply
#2
listitem is undefined because you've commented out that line.
also i assume htmlp.unescape is a typo, should be html.unescape
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
(2015-05-14, 11:26)ronie Wrote: listitem is undefined because you've commented out that line.
also i assume htmlp.unescape is a typo, should be html.unescape

Thankyou

I fond match is [], so for url in match: doesnt work

what i should return in this function?
Reply
#4
if match returns an empty list, then your regex doesn't match any items on the page.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply

Logout Mark Read Team Forum Stats Members Help
why [for *** in ***] doesnt works?0