コード例 #1
0
    def onClick(self, controlID):
        try:
            if controlID == self.CONTROL_LIST_450:
                listitem = self.control_list.getSelectedItem()
                l2 = listitem.getLabel2()
                if l2 == "browse":
                    dpath = TBN.get_cached_saga_thumb(
                        self.idset, self.thumb_type == "fanart")
                    heading = (__string__(20019),
                               __string__(20437))[self.thumb_type == "fanart"]
                    ipath = xbmc.translatePath(
                        get_browse_dialog(heading=heading, dlg_type=2))
                    if ipath and os.path.exists(ipath):
                        listitem = self.control_list.getListItem(0)
                        listitem.setThumbnailImage("DefaultVideoCover.png")
                        filecopy = "FileCopy(%s,%s)" % (ipath, dpath)
                        log.notice.LOG(
                            "%s, %s",
                            xbmc.executehttpapi(filecopy).replace("<li>", ""),
                            filecopy)
                        if os.path.exists(dpath):
                            if self.getControl(
                                    self.CONTROL_RADIOBUTTON).isSelected():
                                dpath = flip_fanart(dpath)
                            listitem.setThumbnailImage(
                                self.get_cached_thumb(dpath))
                            self.movieset_update = True
                elif l2 == "current":
                    listitem.select(True)
                    icon = TBN.get_cached_saga_thumb(
                        self.idset, self.thumb_type == "fanart")
                    if not os.path.exists(icon): icon = ""
                    ipath = icon.split("userdata")[-1].replace("\\",
                                                               "/").strip("/")
                    if icon and xbmcgui.Dialog().yesno(__string__(122),
                                                       __string__(125), ipath):
                        try:
                            os.remove(icon)
                            listitem.setThumbnailImage("DefaultVideoCover.png")
                        except:
                            log.error.exc_info(sys.exc_info(), self)
                    listitem.select(False)
                else:
                    listitem.select(not listitem.isSelected())

            elif controlID == self.CONTROL_BUTTON_CREATE:
                self.select_all = not self.select_all
                for listitem in self.listitems:
                    listitem.select(self.select_all)

            elif controlID == self.CONTROL_BUTTON_CANCEL:
                self._close_dialog()

            elif controlID == self.CONTROL_BUTTON_OK:
                self._download()

        except:
            log.error.exc_info(sys.exc_info(), self)
コード例 #2
0
ファイル: dialogs.py プロジェクト: mrbusta/passion-xbmc
    def onClick(self, controlID):
        try:
            if controlID == self.CONTROL_LIST_450:
                listitem = self.control_list.getSelectedItem()
                l2 = listitem.getLabel2()
                if l2 == "browse":
                    dpath = TBN.get_cached_saga_thumb(
                        self.idset, self.thumb_type == "fanart")
                    heading = (LangXBMC(20019),
                               LangXBMC(20437))[self.thumb_type == "fanart"]
                    ipath = xbmc.translatePath(
                        get_browse_dialog(heading=heading, dlg_type=2))
                    if ipath and path_exists(ipath):
                        listitem = self.control_list.getListItem(0)
                        listitem.setThumbnailImage("DefaultVideoCover.png")
                        OK = xbmcvfs.copy(ipath, dpath)
                        LOGGER.notice.LOG("%s, FileCopy(%s,%s)", repr(OK),
                                          ipath, dpath)
                        if path_exists(dpath):
                            if self.getControl(
                                    self.CONTROL_RADIOBUTTON).isSelected():
                                dpath = flip_fanart(
                                    dpath, ADDON.getSetting("flipquality"))
                            listitem.setThumbnailImage(
                                self.get_cached_thumb(dpath))
                            self.movieset_update = True
                elif l2 == "current":
                    listitem.select(True)
                    icon = TBN.get_cached_saga_thumb(
                        self.idset, self.thumb_type == "fanart")
                    if not path_exists(icon): icon = ""
                    ipath = icon.split("userdata")[-1].replace("\\",
                                                               "/").strip("/")
                    if icon and xbmcgui.Dialog().yesno(LangXBMC(122),
                                                       LangXBMC(125), ipath):
                        try:
                            os.remove(icon)
                            listitem.setThumbnailImage("DefaultVideoCover.png")
                        except:
                            LOGGER.error.print_exc()
                    listitem.select(False)
                else:
                    listitem.select(not listitem.isSelected())

            elif controlID == self.CONTROL_BUTTON_CREATE:
                self.select_all = not self.select_all
                for listitem in self.listitems:
                    listitem.select(self.select_all)

            elif controlID == self.CONTROL_BUTTON_CANCEL:
                self._close_dialog()

            elif controlID == self.CONTROL_BUTTON_OK:
                self._download()

        except:
            LOGGER.error.print_exc()
コード例 #3
0
ファイル: manager.py プロジェクト: Quihico/passion-xbmc
 def setIconFanartImages( self, idSet, listitem ):
     try:
         fanart = TBN.get_cached_saga_thumb( idSet, True )
         fanart = ( "", fanart )[ path_exists( fanart ) ]
         listitem.setProperty( "fanart_image", fanart )
     except:
         LOGGER.error.exc_info( sys.exc_info(), self )
     try:
         icon = TBN.get_cached_saga_thumb( idSet )
         icon = ( "", icon )[ path_exists( icon ) ]
         listitem.setIconImage( icon )
     except:
         LOGGER.error.exc_info( sys.exc_info(), self )
コード例 #4
0
ファイル: manager.py プロジェクト: mrbusta/passion-xbmc
 def setIconFanartImages(self, idSet, listitem):
     try:
         fanart = TBN.get_cached_saga_thumb(idSet, True)
         fanart = ("", fanart)[path_exists(fanart)]
         listitem.setProperty("fanart_image", fanart)
     except:
         LOGGER.error.exc_info(sys.exc_info(), self)
     try:
         icon = TBN.get_cached_saga_thumb(idSet)
         icon = ("", icon)[path_exists(icon)]
         listitem.setIconImage(icon)
     except:
         LOGGER.error.exc_info(sys.exc_info(), self)
コード例 #5
0
ファイル: dialogs.py プロジェクト: Quihico/passion-xbmc
    def onInit( self ):
        try:
            # set controls label
            self.getControl( self.CONTROL_HEADING ).setLabel( self.heading )
            label = ( __language__( 32121 ), __language__( 32131 ) )[ self.thumb_type == "thumb" ]
            self.getControl( self.CONTROL_LABEL_PATH ).setLabel( label )#"Select one %s or more for extra%s"
            #self.getControl( self.CONTROL_RADIOBUTTON ).setLabel( __string__( 13206 ) )#"Overwrite"
            self.getControl( self.CONTROL_RADIOBUTTON ).setEnabled( self.thumb_type == "fanart" )
            self.getControl( self.CONTROL_BUTTON_CREATE ).setLabel( __string__( 188 ) )#"Select All"

            # get control list
            self.control_list = self.getControl( self.CONTROL_LIST_450 )
            self.control_list.reset()
            # add listitem current thumb or current fanart
            icon = TBN.get_cached_saga_thumb( self.idset, self.thumb_type == "fanart" )
            if not os.path.exists( icon ): icon = "DefaultVideoCover.png"
            else: icon = self.get_cached_thumb( icon )
            label = ( __string__( 20440 ), __string__( 20016 ) )[ self.thumb_type == "thumb" ]
            listitem = xbmcgui.ListItem( label, "current", "DefaultVideoCover.png", icon )
            self.control_list.addItem( listitem )
            # add listitems
            self.control_list.addItems( self.listitems )
            # add listitem browse
            self.control_list.addItem( xbmcgui.ListItem( __string__( 20153 ), "browse", "DefaultFolder.png" ) )

            # desable controls
            #self.getControl( self.CONTROL_LIST_451 ).setEnabled( 0 )
            try: self.getControl( self.CONTROL_LIST_451 ).setVisible( 0 )
            except: pass
        except:
            log.error.exc_info( sys.exc_info(), self )
コード例 #6
0
ファイル: dialogs.py プロジェクト: Quihico/passion-xbmc
    def onClick( self, controlID ):
        try:
            if controlID == self.CONTROL_LIST_450:
                listitem = self.control_list.getSelectedItem()
                l2 = listitem.getLabel2()
                if l2 == "browse":
                    dpath = TBN.get_cached_saga_thumb( self.idset, self.thumb_type == "fanart" )
                    heading = ( __string__( 20019 ), __string__( 20437 ) )[ self.thumb_type == "fanart" ]
                    ipath = xbmc.translatePath( get_browse_dialog( heading=heading, dlg_type=2 ) )
                    if ipath and os.path.exists( ipath ):
                        listitem = self.control_list.getListItem( 0 )
                        listitem.setThumbnailImage( "DefaultVideoCover.png" )
                        filecopy = "FileCopy(%s,%s)" % ( ipath, dpath )
                        log.notice.LOG( "%s, %s", xbmc.executehttpapi( filecopy ).replace( "<li>", "" ), filecopy )
                        if os.path.exists( dpath ):
                            if self.getControl( self.CONTROL_RADIOBUTTON ).isSelected():
                                dpath = flip_fanart( dpath )
                            listitem.setThumbnailImage( self.get_cached_thumb( dpath ) )
                            self.movieset_update = True
                elif l2 == "current":
                    listitem.select( True )
                    icon = TBN.get_cached_saga_thumb( self.idset, self.thumb_type == "fanart" )
                    if not os.path.exists( icon ): icon = ""
                    ipath = icon.split( "userdata" )[ -1 ].replace( "\\", "/" ).strip( "/" )
                    if icon and xbmcgui.Dialog().yesno( __string__( 122 ), __string__( 125 ), ipath ):
                        try:
                            os.remove( icon )
                            listitem.setThumbnailImage( "DefaultVideoCover.png" )
                        except: log.error.exc_info( sys.exc_info(), self )
                    listitem.select( False )
                else:
                    listitem.select( not listitem.isSelected() )

            elif controlID == self.CONTROL_BUTTON_CREATE:
                self.select_all = not self.select_all
                for listitem in self.listitems:
                    listitem.select( self.select_all )

            elif controlID == self.CONTROL_BUTTON_CANCEL:
                self._close_dialog()

            elif controlID == self.CONTROL_BUTTON_OK:
                self._download()

        except:
            log.error.exc_info( sys.exc_info(), self )
コード例 #7
0
ファイル: dialogs.py プロジェクト: Quihico/passion-xbmc
    def onClick( self, controlID ):
        try:
            if controlID == self.CONTROL_LIST_450:
                listitem = self.control_list.getSelectedItem()
                l2 = listitem.getLabel2()
                if l2 == "browse":
                    dpath = TBN.get_cached_saga_thumb( self.idset, self.thumb_type == "fanart" )
                    heading = ( LangXBMC( 20019 ), LangXBMC( 20437 ) )[ self.thumb_type == "fanart" ]
                    ipath = xbmc.translatePath( get_browse_dialog( heading=heading, dlg_type=2 ) )
                    if ipath and path_exists( ipath ):
                        listitem = self.control_list.getListItem( 0 )
                        listitem.setThumbnailImage( "DefaultVideoCover.png" )
                        OK = xbmcvfs.copy( ipath, dpath )
                        LOGGER.notice.LOG( "%s, FileCopy(%s,%s)", repr( OK ), ipath, dpath )
                        if path_exists( dpath ):
                            if self.getControl( self.CONTROL_RADIOBUTTON ).isSelected():
                                dpath = flip_fanart( dpath, ADDON.getSetting( "flipquality" ) )
                            listitem.setThumbnailImage( self.get_cached_thumb( dpath ) )
                            self.movieset_update = True
                elif l2 == "current":
                    listitem.select( True )
                    icon = TBN.get_cached_saga_thumb( self.idset, self.thumb_type == "fanart" )
                    if not path_exists( icon ): icon = ""
                    ipath = icon.split( "userdata" )[ -1 ].replace( "\\", "/" ).strip( "/" )
                    if icon and xbmcgui.Dialog().yesno( LangXBMC( 122 ), LangXBMC( 125 ), ipath ):
                        try:
                            os.remove( icon )
                            listitem.setThumbnailImage( "DefaultVideoCover.png" )
                        except: LOGGER.error.print_exc()
                    listitem.select( False )
                else:
                    listitem.select( not listitem.isSelected() )

            elif controlID == self.CONTROL_BUTTON_CREATE:
                self.select_all = not self.select_all
                for listitem in self.listitems:
                    listitem.select( self.select_all )

            elif controlID == self.CONTROL_BUTTON_CANCEL:
                self._close_dialog()

            elif controlID == self.CONTROL_BUTTON_OK:
                self._download()

        except:
            LOGGER.error.print_exc()
コード例 #8
0
ファイル: manager.py プロジェクト: mrbusta/passion-xbmc
 def setIconFanartImages( self, idSet, listitem ):
     art = DATABASE.getArtForItem( idSet )
     if art:
         listitem.setIconImage( art[ "thumb" ] )
         listitem.setProperty( "fanart_image", art[ "fanart" ] )
         return
     try:
         fanart = TBN.get_cached_saga_thumb( idSet, True )
         fanart = ( "", fanart )[ path_exists( fanart ) ]
         listitem.setProperty( "fanart_image", fanart )
     except:
         LOGGER.error.print_exc()
     try:
         icon = TBN.get_cached_saga_thumb( idSet )
         icon = ( "", icon )[ path_exists( icon ) ]
         listitem.setIconImage( icon )
     except:
         LOGGER.error.print_exc()
コード例 #9
0
ファイル: dialogs.py プロジェクト: mrbusta/passion-xbmc
    def onInit(self):
        try:
            # set controls label
            self.getControl(self.CONTROL_HEADING).setLabel(self.heading)
            label = (Language(32121),
                     Language(32131))[self.thumb_type == "thumb"]
            self.getControl(self.CONTROL_LABEL_PATH).setLabel(
                label)  #"Select one %s or more for extra%s"
            #self.getControl( self.CONTROL_RADIOBUTTON ).setLabel( LangXBMC( 13206 ) )#"Overwrite"
            self.getControl(self.CONTROL_RADIOBUTTON).setEnabled(
                self.thumb_type == "fanart")
            self.getControl(self.CONTROL_BUTTON_CREATE).setLabel(
                LangXBMC(188))  #"Select All"

            # get control list
            self.control_list = self.getControl(self.CONTROL_LIST_450)
            self.control_list.reset()
            # add listitem current thumb or current fanart
            icon = TBN.get_cached_saga_thumb(self.idset,
                                             self.thumb_type == "fanart")
            if not path_exists(icon): icon = "DefaultVideoCover.png"
            else: icon = self.get_cached_thumb(icon)
            label = (LangXBMC(20440),
                     LangXBMC(20016))[self.thumb_type == "thumb"]
            listitem = xbmcgui.ListItem(label, "current",
                                        "DefaultVideoCover.png", icon)
            self.control_list.addItem(listitem)
            # add listitems
            self.control_list.addItems(self.listitems)
            # add listitem browse
            self.control_list.addItem(
                xbmcgui.ListItem(LangXBMC(20153), "browse",
                                 "DefaultFolder.png"))
            self.setFocus(self.control_list)

            # desable controls
            try:
                self.getControl(self.CONTROL_LIST_451).setEnabled(0)
            except:
                pass
            try:
                self.getControl(self.CONTROL_LIST_451).setVisible(0)
            except:
                pass
        except:
            LOGGER.error.print_exc()
コード例 #10
0
ファイル: dialogs.py プロジェクト: djidji88/passion-xbmc
    def onInit( self ):
        try:
            # set controls label
            self.getControl( self.CONTROL_HEADING ).setLabel( self.heading )
            label = ( Language( 32121 ), Language( 32131 ) )[ self.thumb_type == "thumb" ]
            self.getControl( self.CONTROL_LABEL_PATH ).setLabel( label )#"Select one %s or more for extra%s"
            #self.getControl( self.CONTROL_RADIOBUTTON ).setLabel( LangXBMC( 13206 ) )#"Overwrite"
            #print ( self.thumb_type == "fanart" ) and not self.art
            if self.art: self.getControl( self.CONTROL_RADIOBUTTON ).setVisible( 0 ) # hmmm! setEnabled not work on frodo!
            else: self.getControl( self.CONTROL_RADIOBUTTON ).setEnabled( self.thumb_type == "fanart" )
            
            self.getControl( self.CONTROL_BUTTON_CREATE ).setLabel( LangXBMC( 188 ) )#"Select All"

            # get control list
            self.control_list = self.getControl( self.CONTROL_LIST_450 )
            self.control_list.reset()
            
            # add listitem current thumb or current fanart
            if not self.art:
                icon = TBN.get_cached_saga_thumb( self.idset, self.thumb_type == "fanart" )
                if not path_exists( icon ): icon = "DefaultVideoCover.png"
                else: icon = self.get_cached_thumb( icon )
            else:
                icon = self.art[ self.thumb_type ]

            label = ( LangXBMC( 20440 ), LangXBMC( 20016 ) )[ self.thumb_type == "thumb" ]
            listitem = xbmcgui.ListItem( label, "current", "DefaultVideoCover.png", icon )
            self.control_list.addItem( listitem )

            # add listitems
            self.control_list.addItems( self.listitems )
            # add listitem browse
            self.control_list.addItem( xbmcgui.ListItem( LangXBMC( 20153 ), "browse", "DefaultFolder.png" ) )
            self.setFocus( self.control_list )

            # desable controls
            try: self.getControl( self.CONTROL_LIST_451 ).setEnabled( 0 )
            except: pass
            try: self.getControl( self.CONTROL_LIST_451 ).setVisible( 0 )
            except: pass
        except:
            LOGGER.error.print_exc()
コード例 #11
0
ファイル: dialogs.py プロジェクト: Quihico/passion-xbmc
    def _download( self ):
        DIALOG_PROGRESS = xbmcgui.DialogProgress()
        try:
            selected = [ l for l in self.listitems if l.isSelected() ]
            t_selected, t_movies = len( selected ), len( self.listitems )
            if selected and xbmcgui.Dialog().yesno( self.heading, __language__( 32122 ), __language__( 32123 ) % ( t_selected, t_movies ), __language__( 32124 ) ):
                is_cached_thumb = False
                if t_selected > 1:
                    # if multi download to user folder
                    heading = __language__( 32126 ) + ( __language__( 32127 ), __language__( 32128 ) )[ self.thumb_type == "thumb" ]
                    dpath = xbmc.translatePath( get_browse_dialog( heading=heading ) )
                    if not dpath and not os.path.exists( dpath ): return
                    overwrite = xbmcgui.Dialog().yesno( __language__( 32135 ), __language__( 32136 ) )
                else:
                    # otherwise, download to cached thumb
                    overwrite = True
                    is_cached_thumb = True
                    dpath = TBN.get_cached_saga_thumb( self.idset, self.thumb_type == "fanart" )
                    self.control_list.getListItem( 0 ).setThumbnailImage( "DefaultVideoCover.png" )
                def _pbhook( numblocks, blocksize, filesize, ratio=1.0 ):
                    try: pct = int( min( ( numblocks * blocksize * 100 ) / filesize, 100 ) * ratio )
                    except: pct = 100
                    DIALOG_PROGRESS.update( pct )
                    if DIALOG_PROGRESS.iscanceled():
                        raise IOError
                DIALOG_PROGRESS.create( self.heading )
                diff = 100.0 / t_selected
                percent = 0

                flipfanart = self.getControl( self.CONTROL_RADIOBUTTON ).isSelected()

                for count, listitem in enumerate( selected ):
                    self.control_list.selectItem( int( listitem.getProperty( "indexItem" ) ) )
                    url = listitem.getLabel2()
                    if is_cached_thumb: dest = "special://temp/" + os.path.basename( url )
                    else: dest = os.path.join( dpath, os.path.basename( url ) )
                    percent += diff
                    line1 = __language__( 32125 ) % ( count+1, t_selected, percent )
                    DIALOG_PROGRESS.update( 0, line1, url, dest )
                    if not overwrite and os.path.exists( dest ):
                        listitem.select( False )
                        continue
                    # download file
                    try: 
                        fp, h = urllib.urlretrieve( url, dest, lambda nb, bs, fs: _pbhook( nb, bs, fs ) )
                        if "denied.png" in h.get( "Content-Disposition", "" ): raise
                    except:
                        self.delete_files.add( dest )
                        log.error.LOG( dest )
                        dest = None
                        log.error.exc_info( sys.exc_info(), self )
                    listitem.select( False )
                    if DIALOG_PROGRESS.iscanceled():
                        break
                    #flip source
                    if dest and flipfanart:
                        dest = flip_fanart( dest )

                    if is_cached_thumb and dest:
                        self.delete_files.add( dest )
                        filecopy = "FileCopy(%s,%s)" % ( dest, dpath )
                        log.notice.LOG( "%s, %s", xbmc.executehttpapi( filecopy ).replace( "<li>", "" ), filecopy )
                        if os.path.exists( dpath ):
                            listitem = self.control_list.getListItem( 0 )
                            listitem.setThumbnailImage( self.get_cached_thumb( dpath ) )
                            self.movieset_update = True

                DIALOG_PROGRESS.update( 100 )
        except:
            log.error.exc_info( sys.exc_info(), self )
        _delete_files( self.delete_files )
        try: DIALOG_PROGRESS.close()
        except: pass
コード例 #12
0
    def _download(self):
        DIALOG_PROGRESS = xbmcgui.DialogProgress()
        try:
            selected = [l for l in self.listitems if l.isSelected()]
            t_selected, t_movies = len(selected), len(self.listitems)
            if selected and xbmcgui.Dialog().yesno(
                    self.heading, __language__(32122),
                    __language__(32123) %
                (t_selected, t_movies), __language__(32124)):
                is_cached_thumb = False
                if t_selected > 1:
                    # if multi download to user folder
                    heading = __language__(32126) + (
                        __language__(32127),
                        __language__(32128))[self.thumb_type == "thumb"]
                    dpath = xbmc.translatePath(
                        get_browse_dialog(heading=heading))
                    if not dpath and not os.path.exists(dpath): return
                    overwrite = xbmcgui.Dialog().yesno(__language__(32135),
                                                       __language__(32136))
                else:
                    # otherwise, download to cached thumb
                    overwrite = True
                    is_cached_thumb = True
                    dpath = TBN.get_cached_saga_thumb(
                        self.idset, self.thumb_type == "fanart")
                    self.control_list.getListItem(0).setThumbnailImage(
                        "DefaultVideoCover.png")

                def _pbhook(numblocks, blocksize, filesize, ratio=1.0):
                    try:
                        pct = int(
                            min((numblocks * blocksize * 100) / filesize, 100)
                            * ratio)
                    except:
                        pct = 100
                    DIALOG_PROGRESS.update(pct)
                    if DIALOG_PROGRESS.iscanceled():
                        raise IOError

                DIALOG_PROGRESS.create(self.heading)
                diff = 100.0 / t_selected
                percent = 0

                flipfanart = self.getControl(
                    self.CONTROL_RADIOBUTTON).isSelected()

                for count, listitem in enumerate(selected):
                    self.control_list.selectItem(
                        int(listitem.getProperty("indexItem")))
                    url = listitem.getLabel2()
                    if is_cached_thumb:
                        dest = "special://temp/" + os.path.basename(url)
                    else:
                        dest = os.path.join(dpath, os.path.basename(url))
                    percent += diff
                    line1 = __language__(32125) % (count + 1, t_selected,
                                                   percent)
                    DIALOG_PROGRESS.update(0, line1, url, dest)
                    if not overwrite and os.path.exists(dest):
                        listitem.select(False)
                        continue
                    # download file
                    try:
                        fp, h = urllib.urlretrieve(
                            url, dest, lambda nb, bs, fs: _pbhook(nb, bs, fs))
                        if "denied.png" in h.get("Content-Disposition", ""):
                            raise
                    except:
                        self.delete_files.add(dest)
                        log.error.LOG(dest)
                        dest = None
                        log.error.exc_info(sys.exc_info(), self)
                    listitem.select(False)
                    if DIALOG_PROGRESS.iscanceled():
                        break
                    #flip source
                    if dest and flipfanart:
                        dest = flip_fanart(dest)

                    if is_cached_thumb and dest:
                        self.delete_files.add(dest)
                        filecopy = "FileCopy(%s,%s)" % (dest, dpath)
                        log.notice.LOG(
                            "%s, %s",
                            xbmc.executehttpapi(filecopy).replace("<li>", ""),
                            filecopy)
                        if os.path.exists(dpath):
                            listitem = self.control_list.getListItem(0)
                            listitem.setThumbnailImage(
                                self.get_cached_thumb(dpath))
                            self.movieset_update = True

                DIALOG_PROGRESS.update(100)
        except:
            log.error.exc_info(sys.exc_info(), self)
        _delete_files(self.delete_files)
        try:
            DIALOG_PROGRESS.close()
        except:
            pass
コード例 #13
0
ファイル: dialogs.py プロジェクト: mrbusta/passion-xbmc
    def _download( self ):
        try:
            selected = [ l for l in self.listitems if l.isSelected() ]
            t_selected, t_movies = len( selected ), len( self.listitems )
            if selected and xbmcgui.Dialog().yesno( self.heading, Language( 32122 ), Language( 32123 ) % ( t_selected, t_movies ), Language( 32124 ) ):
                is_cached_thumb = False
                if t_selected > 1:
                    # if multi download to user folder
                    heading = Language( 32126 ) + ( Language( 32127 ), Language( 32128 ) )[ self.thumb_type == "thumb" ]
                    dpath = xbmc.translatePath( get_browse_dialog( heading=heading ) )
                    if not dpath and not path_exists( dpath ): return
                    overwrite = xbmcgui.Dialog().yesno( Language( 32135 ), Language( 32136 ) )
                else:
                    # otherwise, download to cached thumb
                    overwrite = True
                    is_cached_thumb = True
                    dpath = TBN.get_cached_saga_thumb( self.idset, self.thumb_type == "fanart" )
                    self.control_list.getListItem( 0 ).setThumbnailImage( "DefaultVideoCover.png" )
                def _pbhook( numblocks, blocksize, filesize, ratio=1.0 ):
                    try: pct = int( min( ( numblocks * blocksize * 100 ) / filesize, 100 ) * ratio )
                    except: pct = 100
                    DIALOG_PROGRESS.update( pct )
                    if DIALOG_PROGRESS.iscanceled():
                        raise IOError
                DIALOG_PROGRESS.create( self.heading )
                diff = 100.0 / t_selected
                percent = 0

                flipfanart = self.getControl( self.CONTROL_RADIOBUTTON ).isSelected()

                for count, listitem in enumerate( selected ):
                    self.control_list.selectItem( int( listitem.getProperty( "indexItem" ) ) )
                    url = listitem.getLabel2()
                    if is_cached_thumb: dest = TEMP_DIR + os.path.basename( url )
                    else: dest = _unicode( os.path.join( dpath, os.path.basename( url ) ) )
                    percent += diff
                    if not overwrite:
                        if self.art.get( self.thumb_type ) or path_exists( dest ):
                            listitem.select( False )
                            continue
                    # Frodo
                    if self.art and count == 0:
                        DATABASE.setArtForItem( self.idset, "set", self.thumb_type, url )
                        listitem.select( False )
                        if t_selected == 1: break

                    line1 = Language( 32125 ) % ( count+1, t_selected, percent )
                    DIALOG_PROGRESS.update( 0, line1, url, dest )
                    # Eden or for extra: download file
                    try:
                        fp, h = urllib.urlretrieve( url, dest, lambda nb, bs, fs: _pbhook( nb, bs, fs ) )
                        if "denied.png" in h.get( "Content-Disposition", "" ): raise
                    except:
                        self.delete_files.add( dest )
                        LOGGER.error.LOG( dest )
                        dest = None
                        LOGGER.error.print_exc()
                    listitem.select( False )
                    if DIALOG_PROGRESS.iscanceled():
                        break
                    #flip source
                    if dest and flipfanart:
                        dest = flip_fanart( dest, ADDON.getSetting( "flipquality" ) )

                    if is_cached_thumb and dest:
                        self.delete_files.add( dest )
                        OK = xbmcvfs.copy( dest, dpath )
                        LOGGER.notice.LOG( "%s, FileCopy(%s,%s)", repr( OK ), dest, dpath )
                        #filecopy = "FileCopy(%s,%s)" % ( dest, dpath )
                        #LOGGER.notice.LOG( "%s, %s", xbmc.executehttpapi( filecopy ).replace( "<li>", "" ), filecopy )
                        if path_exists( dpath ):
                            listitem = self.control_list.getListItem( 0 )
                            listitem.setThumbnailImage( self.get_cached_thumb( dpath ) )
                            self.movieset_update = True

                #DIALOG_PROGRESS.update( 100 )
            _delete_files( self.delete_files )
        except:
            LOGGER.error.print_exc()

        if xbmc.getCondVisibility( "Window.IsVisible(progressdialog)" ):
            xbmc.executebuiltin( "Dialog.Close(progressdialog)" )