def getRevisions(self, numberOfEntries):
     #
     # Get XML feed...
     #
     httpCommunicator = HTTPCommunicator()
     xmlText          = httpCommunicator.get( "http://redmine.exotica.org.uk/projects/xbmc4xbox/repository/xbmc4xbox/revisions.atom" )
     xmlDom           = minidom.parseString( xmlText )
     
     for node in xmlDom.getElementsByTagName("entry") :                    
         #
         # Init
         #
         developer   = ""
         pubDate     = ""
         title       = ""
         description = ""
         
         #
         # Parse entry details...
         #
         for childNode in node.childNodes:
             if childNode.nodeName == "author" :
                 for node in childNode.childNodes :
                     if node.nodeName == "name" :
                         developer = node.firstChild.data
             elif childNode.nodeName == "updated" :
                 pubDate = childNode.firstChild.data
             elif childNode.nodeName == "title" :
                 title = childNode.firstChild.data
             elif childNode.nodeName == "content" and childNode.firstChild :
                 description = self.html2text(childNode.firstChild.data)            
         
         # Title
         title = title.replace("\n", " ")
         title = title.replace("Revision ", "")
         title = title.replace(" (xbmc4xbox)", "")
         
         # Date
         datetime_elements = time.strptime(pubDate, "%Y-%m-%dT%H:%M:%SZ")
         revisionDate = "%02u-%02u-%04u" % ( datetime_elements[2], datetime_elements[1], datetime_elements[0] )
         
         # Description
         description = title[ title.find(":") + 1 : ] + '\n' + description 
             
         #
         # Create list item...
         #
         listitem = xbmcgui.ListItem( title, description, iconImage = "DefaultProgram.png" )
         listitem.setInfo( type = "Video", infoLabels = { "Title" : "%s [[COLOR=FFe2ff43]%s[/COLOR]]" % ( title, developer ), "Date" : revisionDate })
         url = "%s?action=revision-info&title=%s&date-time=%s&developer=%s&description=%s" % ( sys.argv[0], urllib.quote_plus(title), urllib.quote_plus(pubDate), urllib.quote_plus(developer), urllib.quote_plus(description) )
         xbmcplugin.addDirectoryItem( handle = int(sys.argv[ 1 ]), url = url, listitem=listitem, isFolder=False)
 
     #    
     # End of directory...
     #
     xbmcplugin.addSortMethod ( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_DATE )
     xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
예제 #2
0
    def getPictures( self ) :        
        #
        # Get HTML page...
        #
        httpCommunicator = HTTPCommunicator()
        htmlSource = httpCommunicator.get( "http://comics.com%s?DateAfter=2000-01-01&Order=d.DateStrip+DESC&PerPage=%u&Page=%u" % \
                                           ( self.comic_url, self.entries_per_page, self.current_page ) )

        #
        # Parse HTML page...
        #
        soupStrainer  = SoupStrainer( "div", { "class" : "SRCH_StripList" } )
        beautifulSoup = BeautifulSoup( htmlSource, soupStrainer )
        
        divs_STR_StripFrame = beautifulSoup.findAll( "div", { "class" : "STR_StripFrame" } )
        for div_STR_StripFrame in divs_STR_StripFrame :
            #
            # Title (date)
            #
            div_STR_Day = div_STR_StripFrame.find( "div", { "class" : "STR_Day" } )
            title       = div_STR_Day.string
           
            #
            # Thumbnail & full image...
            #
            div_STR_Comic  = div_STR_StripFrame.find( "div", { "class" : "STR_Comic" } )            
            full_image_url = div_STR_Comic.find( "a", { "class" : "STR_StripImage" } ).img[ "src" ]
            thumbnail_url  = full_image_url.replace( ".full.", ".thumb." )
            
                                    
            # Add directory entry...
            listitem = xbmcgui.ListItem( title, iconImage="DefaultPicture.png", thumbnailImage = thumbnail_url )
            xbmcplugin.addDirectoryItem( handle=int(sys.argv[ 1 ]), url = full_image_url, listitem=listitem, isFolder=False)

        #
        # Next page entry...
        #
        listitem      = xbmcgui.ListItem (xbmc.getLocalizedString(30401), iconImage = "DefaultFolder.png", thumbnailImage = os.path.join(self.IMAGES_PATH, 'next-page.png'))
        next_page_url = "%s?action=list&comic_name=%s&comic_url=%s&page=%u" % ( sys.argv[0], urllib.quote_plus( self.comic_name), urllib.quote_plus( self.comic_url ), self.current_page + 1 )
        xbmcplugin.addDirectoryItem( handle = int(sys.argv[1]), url = next_page_url, listitem = listitem, isFolder = True)
        
        #    
        # Disable sorting...
        #
        xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
        
        #
        # Label (top-right)...
        #
        xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=( "%s (%s)" % ( self.comic_name, ( xbmc.getLocalizedString(30402) % self.current_page ) ) ) )
        
        #
        # End of directory...
        #
        xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
    def getPictures( self ) :        
        #
        # Get HTML page...
        #
        httpCommunicator = HTTPCommunicator()
        htmlSource = httpCommunicator.get( self.lol_url + str(self.entries_per_page))

        #
        # Parse HTML page...
        #
        pictures = BeautifulStoneSoup(htmlSource).findAll('picture')
        for picture in pictures:
            #
            # Title (date)
            #
            title       = picture.title.string
           
            #
            # Thumbnail & full image...
            #

            full_image_url = picture.lolimageurl.string
            thumbnail_url  = picture.thumbnailimageurl.string
            
                                    
            # Add directory entry...
            listitem = xbmcgui.ListItem( title, iconImage="DefaultPicture.png", thumbnailImage = thumbnail_url )
            xbmcplugin.addDirectoryItem( handle=int(sys.argv[ 1 ]), url = full_image_url, listitem=listitem, isFolder=False)

        #
        # Next page entry...
        #
        next_button_text = __language__(30403) % (self.entries_per_page, self.lol_name)
        listitem      = xbmcgui.ListItem (next_button_text, iconImage = "DefaultFolder.png", thumbnailImage = os.path.join(self.IMAGES_PATH, 'next-page.png'))
        next_page_url = "%s?action=list&lol_name=%s&lol_url=%s" % ( sys.argv[0], urllib.quote_plus( self.lol_name), urllib.quote_plus( self.lol_url ) )
        #next_page_url = self.lol_url
        xbmcplugin.addDirectoryItem( handle = int(sys.argv[1]), url = next_page_url, listitem = listitem, isFolder = True)
        
        #    
        # Disable sorting...
        #
        xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
        
        #
        # Label (top-right)...
        #
        trlabel = "%s (%s)" % ( self.lol_name, (__language__(30402) % self.current_page))
        xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=( trlabel ) )
        
        #
        # End of directory...
        #
        xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
예제 #4
0
    def getComics(self):
        #
        # Get list (XML)...
        #
        httpCommunicator = HTTPCommunicator()
        dom              = minidom.parseString( httpCommunicator.get( "http://comics.com/xml/homepage_scroller/" ) )

        for comic in dom.getElementsByTagName("Comic") :
            #
            # Init
            #
            comic_name  = ""
            comic_url   = ""
            comic_thumb = ""
            
            #
            # Parse entry details...
            #
            for childNode in comic.childNodes:
                if childNode.nodeName == "Name" :
                    comic_name  = childNode.firstChild.data
                elif childNode.nodeName == "URL" :
                    comic_url   = childNode.firstChild.data
                elif childNode.nodeName == "FilePath_Thumb" :
                    comic_thumb = childNode.firstChild.data

                # Comic strip view (list)...
                plugin_url = "%s?action=list&comic_name=%s&comic_url=%s" % ( sys.argv[0], urllib.quote_plus( comic_name ), urllib.quote_plus( comic_url ) )
            
            #
            #  Add list item...
            # 
            listitem = xbmcgui.ListItem (comic_name, iconImage = "DefaultPicture.png", thumbnailImage = comic_thumb)
            listitem.setInfo( "pictures", { "title" : "comic_name" } )
            ok = xbmcplugin.addDirectoryItem( handle = int(sys.argv[1]), url = plugin_url, listitem = listitem, isFolder = True)

        #
        # End of list...
        #

        # Sort by label...
        xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_LABEL )
            
        # End of list...
        xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )        
예제 #5
0
    def getPictures(self):
        #
        # Get HTML page...
        #
        httpCommunicator = HTTPCommunicator()
        htmlSource = httpCommunicator.get(self.lol_url +
                                          str(self.entries_per_page))

        #
        # Parse HTML page...
        #
        pictures = BeautifulStoneSoup(htmlSource).findAll('picture')
        for picture in pictures:
            #
            # Title (date)
            #
            title = picture.title.string

            #
            # Thumbnail & full image...
            #

            full_image_url = picture.lolimageurl.string
            thumbnail_url = picture.thumbnailimageurl.string

            # Add directory entry...
            listitem = xbmcgui.ListItem(title,
                                        iconImage="DefaultPicture.png",
                                        thumbnailImage=thumbnail_url)
            xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),
                                        url=full_image_url,
                                        listitem=listitem,
                                        isFolder=False)

        #
        # Next page entry...
        #
        listitem = xbmcgui.ListItem(xbmc.getLocalizedString(30403) %
                                    (self.entries_per_page, self.lol_name),
                                    iconImage="DefaultFolder.png",
                                    thumbnailImage=os.path.join(
                                        self.IMAGES_PATH, 'next-page.png'))
        next_page_url = "%s?action=list&lol_name=%s&lol_url=%s" % (
            sys.argv[0], urllib.quote_plus(
                self.lol_name), urllib.quote_plus(self.lol_url))
        #next_page_url = self.lol_url
        xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),
                                    url=next_page_url,
                                    listitem=listitem,
                                    isFolder=True)

        #
        # Disable sorting...
        #
        xbmcplugin.addSortMethod(handle=int(sys.argv[1]),
                                 sortMethod=xbmcplugin.SORT_METHOD_NONE)

        #
        # Label (top-right)...
        #
        xbmcplugin.setPluginCategory(
            handle=int(sys.argv[1]),
            category=("%s (%s)" %
                      (self.lol_name,
                       (xbmc.getLocalizedString(30402) % self.current_page))))

        #
        # End of directory...
        #
        xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True)