Beispiel #1
0
    def download_subtitles(self, pos):
        if self.sublist:
            item = self.sublist[pos]
            ok = xbmcgui.Dialog().yesno("BoxeeSubs", _(242),
                                        (_(243) % (item["release"], )), "",
                                        _(260), _(259))
            if not ok:
                self.getControl(STATUS_LABEL).setLabel(_(645))
                return
            else:
                local_path = xbmc.translatePath("special://home/subtitles")
                dp = xbmcgui.DialogProgress()
                dp.create(__scriptname__, _(633),
                          os.path.basename(self.file_path))
                sub_filename = os.path.basename(self.file_path)
                sub_filename = sub_filename[
                    0:sub_filename.rfind(".")] + "." + item["lang"] + ".srt"
                item["plugin"].downloadFile(
                    item["link"], os.path.join(local_path, sub_filename))
                dp.close()
                xbmc.Player().setSubtitles(
                    os.path.join(local_path, sub_filename))
                xbmc.showNotification(652, '', '')
                self.getControl(STATUS_LABEL).setLabel(_(652))

            self.getControl(STATUS_LABEL).setLabel(_(649))
            self.exit_script()
Beispiel #2
0
    def download_subtitles(self, pos):
	if self.sublist:
	    item = self.sublist[pos]
	    ok = xbmcgui.Dialog().yesno( "BoxeeSubs", _( 242 ), ( _( 243 ) % ( item["release"], ) ), "", _( 260 ), _( 259 ) )
            if not ok:
                self.getControl( STATUS_LABEL ).setLabel( _( 645 ) )
                return
            else:
		local_path = xbmc.translatePath("special://home/subtitles")
		dp = xbmcgui.DialogProgress()
		dp.create( __scriptname__, _( 633 ), os.path.basename( self.file_path ) )
		sub_filename = os.path.basename( self.file_path )
		sub_filename = sub_filename[0:sub_filename.rfind(".")] + "." + item["lang"] + ".srt"
		item["plugin"].downloadFile(item["link"], os.path.join( local_path, sub_filename ))
		dp.close()
		xbmc.Player().setSubtitles( os.path.join( local_path, sub_filename ) )
		xbmc.showNotification( 652, '', '' )
		self.getControl( STATUS_LABEL ).setLabel( _( 652 ) )
		
            self.getControl( STATUS_LABEL ).setLabel( _( 649 ) )
            self.exit_script()
Beispiel #3
0
                un.extract( zip_filename, local_path )
                LOG( LOG_INFO, _( 644 ) % ( local_path ) )
                self.getControl( STATUS_LABEL ).setLabel( _( 651 ) )
                if xbmc.Player().isPlayingVideo():
                    for item in files:
                        if ( item.find( subtitle_format ) > 0 ):
                            xbmc.Player().setSubtitles( os.path.join( local_path, item ) )
                            subtitle_set = True
        except Exception, e:
            error = _( 634 ) % ( str ( e ) )
            LOG( LOG_ERROR, error )
            
        self.getControl( STATUS_LABEL ).setLabel( _( 652 ) )
        if subtitle_set:
            os.remove( zip_filename )
            xbmc.showNotification( 652, '', '' )
            self.exit_script()


    def exit_script( self, restart=False ):
        self.connThread.join()
        self.close()

    def onClick( self, controlId ):
        if ( self.controlId == SUBTITLES_LIST ):
            self.download_subtitles( self.getControl( SUBTITLES_LIST ).getSelectedPosition() )

    def onFocus( self, controlId ):
        self.controlId = controlId

    def onAction( self, action ):