Working notification
#1
Hi,
I'm new in xbmc/kodi plugin development.
So this is my problem: I try to write a plugin for a movie page (mozicsillag.cc) to display movie details from that page. When the plugin start the images and ControlButtons appears, but the "Working..." notification don't disappear, and I cannot use navigation or click Controlbuttons. When I hit Esc, it stop, but Kodi freeze for a few second, but after everything work until I want to open a new window. I think the two thing are connected, but the log didn't help much.

Here is the log:
Code:
18:50:09 T:5912  NOTICE: Previous line repeats 2 times.
18:50:09 T:5912  NOTICE: Thread LanguageInvoker start, auto delete: false
18:50:09 T:5912  NOTICE: -->Python Interpreter Initialized<--
18:50:11 T:12136  NOTICE: Thread JobWorker start, auto delete: true
18:50:26 T:10460   ERROR: XFILE::CDirectory::GetDirectory - Error getting plugin://plugin.video.mozicsillag/
18:50:27 T:10460   ERROR: CGUIMediaWindow::GetDirectory(plugin://plugin.video.mozicsillag/) failed
18:50:27 T:8760  NOTICE: Thread BackgroundLoader start, auto delete: false
18:50:33 T:11308   ERROR: CPythonInvoker(2, C:\Users\Péter\AppData\Roaming\Kodi\addons\plugin.video.mozicsillag\addon.py): script didn't stop in 5 seconds - let's kill it
18:50:35 T:5912   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.SystemExit'>
                                            Error Contents: <NULL>
                                            Traceback (most recent call last):
                                              File "C:\Users\P굥r\AppData\Roaming\Kodi\addons\plugin.video.mozicsillag\addon.py", line 67, in onControl
                                                mw=FilmAblak(murl)
                                              File "C:\Users\P굥r\AppData\Roaming\Kodi\addons\plugin.video.mozicsillag\addon.py", line 12, in __init__
                                                html_content2 = urllib2.urlopen(link2).read()
                                              File "C:\Program Files (x86)\Kodi\system\python\Lib\urllib2.py", line 127, in urlopen
                                                return _opener.open(url, data, timeout)
                                              File "C:\Program Files (x86)\Kodi\system\python\Lib\urllib2.py", line 389, in open
                                                req = Request(fullurl, data)
                                              File "C:\Program Files (x86)\Kodi\system\python\Lib\urllib2.py", line 211, in __init__
                                                for key, value in headers.items():
                                            SystemExit
                                            -->End of Python script error report<--

And the full code:
Code:
from bs4 import BeautifulSoup
import urllib2
import xbmcgui
import xbmc

base_url = sys.argv[0]
addon_handle = int(sys.argv[1])

class FilmAblak(xbmcgui.WindowDialog):
    def __init__(self,link2):
        html_content2 = urllib2.urlopen(link2).read()
        k = BeautifulSoup(html_content2) # making soap
        fcim = d.find("h1").text.strip()
        #pic_link = "http://mozicsillag.cc/" + d.select("#picture").select("a")['href']
        #descr = d.select("#description").select("p").select("span").select("span").text
        self.addControl(xbmcgui.ControlLabel(200,50,400,50,fcim,font="font20"))
        #self.addControl(xbmcgui.ControlImage(50,150,280,410,pic_link))

class FoAblak(xbmcgui.Window):
    def __init__(self):
        xbmcgui.Window.__init__(self)
        self.controlList = []
        self.mlinks = []
        self.maxi=5
        link="http://www.mozicsillag.cc"
        html_content = urllib2.urlopen(link).read()
        d = BeautifulSoup(html_content) # making soap
        i=0
        j=0
        for ml in d.select("#movie_list"):
            for a in ml.select("a"):
                klink=a.img['src']
                mlink="http://mozicsillag.cc/" + a['href']
                image="http://mozicsillag.cc/" + klink
                cim= a.find("div",class_="title").text.strip()
                self.addControl(xbmcgui.ControlImage((i*150)+10,(j*255)+10,140,205, image))
                elem=xbmcgui.ControlButton((i*150)+10,(j*255)+210,140,30, cim, font='font12')
                self.addControl(elem)
                self.controlList.append(elem)
                self.mlinks.append(mlink)
                i += 1
                if i>self.maxi:
                    i=0
                    j+=1
                    
        for elem in self.controlList:
            i=self.controlList.index(elem)
            if (i-(self.maxi+1))>=0:
                elem.controlUp(self.controlList[i-(self.maxi+1)])
            if (i+(self.maxi+1))<len(self.controlList):
                elem.controlDown(self.controlList[i+(self.maxi+1)])
            if (i-1)>=0:
                elem.controlLeft(self.controlList[i-1])
            if (i+1)<len(self.controlList):
                elem.controlRight(self.controlList[i+1])
                
        self.setFocus(self.controlList[0])
    
    def onControl(self, event):
        for element in self.controlList:
            if element == event:
                i=self.controlList.index(element)
                dialog = xbmcgui.Dialog()
                dialog.notification('Movie Link', self.mlinks[i])
                murl=self.mlinks[i]
                mw=FilmAblak(murl)
                mw.doModal()
                del mw
                

w = FoAblak()
w.doModal()
del w

And a picture (yeah its not look good, but I just start Smile ):
Image

Thanks for helping.
Reply
#2
hello szeretnek erdeklodni hogy az xbmc -re leteyik e valami plugin , magyar filmekhez? mert mar egy jo idelye keresem. koszi.
Reply

Logout Mark Read Team Forum Stats Members Help
Working notification0