def onClick(self, controlID): """ Notice: onClick not onControl Notice: it gives the ID of the control not the control object """ print controlID if controlID == 11: self.argOneContent = "" self.argOne_GetTitle = self.show_keyboard( "", self.Language.getLocalizedString(516)) label = self.Language.getLocalizedString(516) label_colored = "[COLOR=%s]%s[/COLOR]" % ("ff555555", self.argOne_GetTitle) self.getControl(controlID).setLabel(label, label2=label_colored) self.argOneContent = self.argOne_GetTitle if controlID == 12: if self.scrapList.getSelectedPosition() == 0: self.argTwoContent = "" self.argTwo_GetTitle = self.show_keyboard( "", self.Language.getLocalizedString(515)) label = self.Language.getLocalizedString(515) label_colored = "[COLOR=%s]%s[/COLOR]" % ("ff555555", self.argTwo_GetTitle) self.getControl(controlID).setLabel(label, label2=label_colored) self.argTwoContent = self.argTwo_GetTitle if self.scrapList.getSelectedPosition() == 1: self.argTwoContent = "" self.argTwo_GetTitle = xbmcgui.Dialog().browse( 1, self.Language.getLocalizedString(517), 'files', '.xml') label = self.Language.getLocalizedString(517) label_colored = "[COLOR=%s]%s[/COLOR]" % ("ff555555", self.argTwo_GetTitle) self.getControl(controlID).setLabel(label, label2=label_colored) self.argTwoContent = self.argTwo_GetTitle if controlID == 13: if self.scrapList.getSelectedPosition() == 0: self.argThreeContent = "" self.argThree_GetTitle = self.show_keyboard( "", self.Language.getLocalizedString(517)) label = self.Language.getLocalizedString(515) label_colored = "[COLOR=%s]%s[/COLOR]" % ( "ff555555", self.argThree_GetTitle) self.getControl(controlID).setLabel(label, label2=label_colored) self.argThreeContent = self.argThree_GetTitle if self.scrapList.getSelectedPosition() == 1: self.argThreeContent = "" self.argThree_GetTitle = xbmcgui.Dialog().browse( 0, self.Language.getLocalizedString(518), 'files') label = self.Language.getLocalizedString(518) label_colored = "[COLOR=%s]%s[/COLOR]" % ( "ff555555", self.argThree_GetTitle) self.getControl(controlID).setLabel(label, label2=label_colored) self.argThreeContent = self.argThree_GetTitle if controlID == 40: if self.scrapList.getSelectedPosition() == 0: xbmc.executebuiltin("Skin.SetString(arg1,1)") xbmc.executebuiltin("Skin.SetString(arg2,1)") xbmc.executebuiltin("Skin.SetString(arg3,0)") self.argOneTitle.setLabel( self.Language.getLocalizedString(516)) self.argTwoTitle.setLabel( self.Language.getLocalizedString(515)) if self.scrapList.getSelectedPosition() == 1: xbmc.executebuiltin("Skin.SetString(arg1,1)") xbmc.executebuiltin("Skin.SetString(arg2,1)") xbmc.executebuiltin("Skin.SetString(arg3,1)") self.argOneTitle.setLabel( self.Language.getLocalizedString(516)) self.argTwoTitle.setLabel( self.Language.getLocalizedString(515)) self.argThreeTitle.setLabel( self.Language.getLocalizedString(517)) if controlID == 28: #Init DBtools DBtools = MyBooksDB() #Recup de l'id du scraper scrapID = self.scrapList.getSelectedPosition() print "l'id de la source est %s" % (scrapID) pDialog = xbmcgui.DialogProgress() pDialog.create(self.Language.getLocalizedString(54), self.Language.getLocalizedString(55)) pDialog.update(0) if scrapID == 0: sourceTitle = self.argOneContent userID = self.argTwoContent sourceID = DBtools.addSource(sourceTitle, 1, userID) from LibFly import LibFlyBooks LibFlyBooksArray = LibFlyBooks(userID, scrapID + 1) BooksArray = LibFlyBooksArray.getBooks() DBtools.addBooks(BooksArray, sourceID) if scrapID == 1: sourceTitle = self.argOneContent xmlPath = self.argTwoContent imgPath = self.argThreeContent sourceID = DBtools.addSource(sourceTitle, 2, xmlPath, imgPath) from XMLscraper import XmlBooks XmlBooksArray = XmlBooks(xmlPath, imgPath, sourceID) BooksArray = XmlBooksArray.getBooks() DBtools.addBooks(BooksArray, sourceID) pDialog.update(100) pDialog.close() self.close()
from LibFly import LibFlyBooks LibFlyBooksArray = LibFlyBooks(userID, scrapID) BooksArray = LibFlyBooksArray.getBooks() DBtools.addBooks(BooksArray, sourceID) if scrapID == 2: sourceTitle = sourceInfo[1] xmlPath = sourceInfo[3] xmlImgPath = sourceInfo[4] DBtools = MyBooksDB() sourceID = DBtools.addSource(sourceTitle, 2, xmlPath, xmlImgPath) from XMLscraper import XmlBooks XmlBooksArray = XmlBooks(xmlPath, xmlImgPath, sourceID) BooksArray = XmlBooksArray.getBooks() DBtools.addBooks(BooksArray, sourceID) #Export if mode == 8: print "-- MODE 8 -- EXPORT LIB" print "Source modifiee: " + str(idSource) #Init DBtools DBtools = MyBooksDB() sourceInfo = DBtools.getSourcesById(idSource) xbmcDialog = xbmcgui.Dialog() exportBool = True
from LibFly import LibFlyBooks LibFlyBooksArray = LibFlyBooks(userID,scrapID) BooksArray = LibFlyBooksArray.getBooks() DBtools.addBooks(BooksArray,sourceID) if scrapID == 2 : sourceTitle = sourceInfo[1] xmlPath = sourceInfo[3] xmlImgPath = sourceInfo[4] DBtools = MyBooksDB() sourceID = DBtools.addSource(sourceTitle, 2, xmlPath, xmlImgPath) from XMLscraper import XmlBooks XmlBooksArray = XmlBooks(xmlPath,xmlImgPath,sourceID) BooksArray = XmlBooksArray.getBooks() DBtools.addBooks(BooksArray,sourceID) #Export if mode == 8 : print "-- MODE 8 -- EXPORT LIB" print "Source modifiee: " + str(idSource) #Init DBtools DBtools = MyBooksDB() sourceInfo = DBtools.getSourcesById(idSource) xbmcDialog = xbmcgui.Dialog()
def onClick(self, controlID): """ Notice: onClick not onControl Notice: it gives the ID of the control not the control object """ print controlID if controlID == 11 : self.argOneContent = "" self.argOne_GetTitle = self.show_keyboard ("", self.Language.getLocalizedString(516)) label = self.Language.getLocalizedString(516) label_colored = "[COLOR=%s]%s[/COLOR]" % ( "ff555555", self.argOne_GetTitle ) self.getControl( controlID ).setLabel( label , label2=label_colored ) self.argOneContent = self.argOne_GetTitle if controlID == 12 : if self.scrapList.getSelectedPosition() == 0 : self.argTwoContent = "" self.argTwo_GetTitle = self.show_keyboard ("", self.Language.getLocalizedString(515)) label = self.Language.getLocalizedString(515) label_colored = "[COLOR=%s]%s[/COLOR]" % ( "ff555555", self.argTwo_GetTitle ) self.getControl( controlID ).setLabel( label , label2=label_colored ) self.argTwoContent = self.argTwo_GetTitle if self.scrapList.getSelectedPosition() == 1 : self.argTwoContent = "" self.argTwo_GetTitle = xbmcgui.Dialog().browse( 1 , self.Language.getLocalizedString(517) , 'files' , '.xml') label = self.Language.getLocalizedString(517) label_colored = "[COLOR=%s]%s[/COLOR]" % ( "ff555555", self.argTwo_GetTitle ) self.getControl( controlID ).setLabel( label , label2=label_colored ) self.argTwoContent = self.argTwo_GetTitle if controlID == 13 : if self.scrapList.getSelectedPosition() == 0 : self.argThreeContent = "" self.argThree_GetTitle = self.show_keyboard ("", self.Language.getLocalizedString(517)) label = self.Language.getLocalizedString(515) label_colored = "[COLOR=%s]%s[/COLOR]" % ( "ff555555", self.argThree_GetTitle ) self.getControl( controlID ).setLabel( label , label2=label_colored ) self.argThreeContent = self.argThree_GetTitle if self.scrapList.getSelectedPosition() == 1 : self.argThreeContent = "" self.argThree_GetTitle = xbmcgui.Dialog().browse( 0 , self.Language.getLocalizedString(518) , 'files' ) label = self.Language.getLocalizedString(518) label_colored = "[COLOR=%s]%s[/COLOR]" % ( "ff555555", self.argThree_GetTitle ) self.getControl( controlID ).setLabel( label , label2=label_colored ) self.argThreeContent = self.argThree_GetTitle if controlID == 40 : if self.scrapList.getSelectedPosition() == 0 : xbmc.executebuiltin( "Skin.SetString(arg1,1)" ) xbmc.executebuiltin( "Skin.SetString(arg2,1)" ) xbmc.executebuiltin( "Skin.SetString(arg3,0)" ) self.argOneTitle.setLabel( self.Language.getLocalizedString(516) ) self.argTwoTitle.setLabel( self.Language.getLocalizedString(515) ) if self.scrapList.getSelectedPosition() == 1 : xbmc.executebuiltin( "Skin.SetString(arg1,1)" ) xbmc.executebuiltin( "Skin.SetString(arg2,1)" ) xbmc.executebuiltin( "Skin.SetString(arg3,1)" ) self.argOneTitle.setLabel( self.Language.getLocalizedString(516) ) self.argTwoTitle.setLabel( self.Language.getLocalizedString(515) ) self.argThreeTitle.setLabel( self.Language.getLocalizedString(517) ) if controlID == 28 : #Init DBtools DBtools = MyBooksDB() #Recup de l'id du scraper scrapID = self.scrapList.getSelectedPosition() print "l'id de la source est %s"% (scrapID) pDialog = xbmcgui.DialogProgress() pDialog.create(self.Language.getLocalizedString(54),self.Language.getLocalizedString(55)) pDialog.update(0) if scrapID == 0 : sourceTitle = self.argOneContent userID = self.argTwoContent sourceID = DBtools.addSource(sourceTitle, 1, userID) from LibFly import LibFlyBooks LibFlyBooksArray = LibFlyBooks(userID,scrapID+1) BooksArray = LibFlyBooksArray.getBooks() DBtools.addBooks(BooksArray,sourceID) if scrapID == 1 : sourceTitle = self.argOneContent xmlPath = self.argTwoContent imgPath = self.argThreeContent sourceID = DBtools.addSource(sourceTitle, 2, xmlPath, imgPath) from XMLscraper import XmlBooks XmlBooksArray = XmlBooks(xmlPath,imgPath, sourceID) BooksArray = XmlBooksArray.getBooks() DBtools.addBooks(BooksArray,sourceID) pDialog.update(100) pDialog.close() self.close()