сега кодът как да го структурирам в def play
ето какво направих
и ето каква грешка ми дава
ето какво направих
Код:
def PLAY(name,url,iconimage):
link = 'http://192.168.0.116/watch_video.php?v=' + url #Конструираме адреса за достъп до видеото
nl = 0
match = re.compile('src='(.+?)' type="video/mp4" data-res="(.+?)" />').findall(data)
req = urllib2.Request(url)
req.add_header('User-Agent', UA)
response = urllib2.urlopen(req)
#print 'request page url:' + url
data=response.read()
response.close()
nl = nl + 1
li = xbmcgui.ListItem(iconImage=iconimage, thumbnailImage=iconimage, path=nl)
li.setInfo('video', { 'title': name })
try:
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcgui.ListItem(int(sys.argv[1]), True, li))
except:
xbmc.executebuiltin("Notification('Грешка','Видеото липсва на сървъра!')")
Код:
EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.IndentationError'>
Error Contents: ('unexpected indent', ('C:\\Users\\SonyVaio\\AppData\\Roaming\\Kodi\\addons\\plugin.video.vplaybg\\default.py', 90, 2, '\t\tmatch = re.compile(\'src=\'(.+?)\' type="video/mp4" data-res="(.+?)" />\').findall(data)\n'))
IndentationError: ('unexpected indent', ('C:\\Users\\SonyVaio\\AppData\\Roaming\\Kodi\\addons\\plugin.video.vplaybg\\default.py', 90, 2, '\t\tmatch = re.compile(\'src=\'(.+?)\' type="video/mp4" data-res="(.+?)" />\').findall(data)\n'))
-->End of Python script error report<--
22:17:48.788 T:6516 ERROR: XFILE::CDirectory::GetDirectory - Error getting plugin://plugin.video.vplaybg/