def doModal(self):
		ret = self.gatherDialog.create('GSoC 2012', 'Initializing extractors...', "")

		episodes = list()
		movies = list()
		musicVideos = list()
		videoFiles = list()

		try:
			self.steps = len(self.extractionSteps)
			files = set()
			if "episodes" in self.extractionSteps:
				def episodeProgress(percentage):
					self.gatherDialog.update(percentage / self.steps, "Extracting episodes", "", "")
				episodes = extraction.extractEpisodes(files, episodeProgress, self.gatherDialog.iscanceled)

			if "movies" in self.extractionSteps:
				def movieProgress(percentage):
					self.gatherDialog.update((100 + percentage) / self.steps, "Extracting movies", "", "")
				movies = extraction.extractMovies(files, movieProgress, self.gatherDialog.iscanceled)

			if "musicvideos" in self.extractionSteps:
				def musicVideosProgress(percentage):
					self.gatherDialog.update((100 + percentage) / self.steps, "Extracting music videos", "", "")
				musicVideos = extraction.extractMusicVideos(files, musicVideosProgress, self.gatherDialog.iscanceled)

			sources = [s for s in getSources() if s["file"] in self.extractionSteps]
			nbrSources = len(sources)

			for i in range(nbrSources):
				source = sources[i]
				source["tick"] = 0
				source["percentage"] = 0

				def unscrapedIsCanceled():
					source["tick"] = source["tick"] + 1 if source["tick"] < 5 else 0
					s = string.join(['.' for s in range(source["tick"])])
					offset = 200 + i * nbrSources

					self.gatherDialog.update((offset + source["percentage"]) / self.steps, "Extracting unscraped videos " + s, source["label"], "")

					return self.gatherDialog.iscanceled()

				def midProgress(i):
					source["percentage"] = i / nbrSources
					unscrapedIsCanceled()

				extraction.extractVideoFilesFromDirectory(files, videoFiles, source["file"], unscrapedIsCanceled, midProgress)

		except:
			raise
		finally:
			self.gatherDialog.close()

		self.sm.switchTo(SubmitState(episodes, movies, musicVideos, videoFiles))
    def doModal(self):
        self.gatherDialog.create('GSoC 2012', 'Initializing extractors...', "")

        episodes = list()
        movies = list()
        musicVideos = list()
        videoFiles = list()

        try:
            self.steps = len(self.extractionSteps)
            files = set()
            if "episodes" in self.extractionSteps:
                def episodeProgress(percentage):
                    self.gatherDialog.update(percentage / self.steps, "Extracting episodes", "", "")
                episodes = extraction.extractEpisodes(files, episodeProgress, self.gatherDialog.iscanceled)

            if "movies" in self.extractionSteps:
                def movieProgress(percentage):
                    self.gatherDialog.update((100 + percentage) / self.steps, "Extracting movies", "", "")
                movies = extraction.extractMovies(files, movieProgress, self.gatherDialog.iscanceled)

            if "musicvideos" in self.extractionSteps:
                def musicVideosProgress(percentage):
                    self.gatherDialog.update((100 + percentage) / self.steps, "Extracting music videos", "", "")
                musicVideos = extraction.extractMusicVideos(files, musicVideosProgress, self.gatherDialog.iscanceled)

            sources = [s for s in getSources() if s["file"] in self.extractionSteps]
            nbrSources = len(sources)

            for i in range(nbrSources):
                source = sources[i]
                source["tick"] = 0
                source["percentage"] = 0

                def unscrapedIsCanceled():
                    source["tick"] = source["tick"] + 1 if source["tick"] < 5 else 0
                    s = string.join(['.' for s in range(source["tick"])])
                    offset = 200 + i * nbrSources

                    self.gatherDialog.update((offset + source["percentage"]) / self.steps, "Extracting unscraped videos " + s, source["label"], "")

                    return self.gatherDialog.iscanceled()

                def midProgress(i):
                    source["percentage"] = i / nbrSources
                    unscrapedIsCanceled()

                extraction.extractVideoFilesFromDirectory(files, videoFiles, source["file"], unscrapedIsCanceled, midProgress)

        except:
            raise
        finally:
            self.gatherDialog.close()

        self.sm.switchTo(SubmitState(episodes, movies, musicVideos, videoFiles))
	def __init__(self):
		self.strActionInfo = xbmcgui.ControlLabel(0, 0, 300, 200, 'Push BACK to cancel', 'font13', '0xFFFFFFFF')
		self.addControl(self.strActionInfo)

		self.choiceButton = list()
		self.choiceID = list()

		self.gather = xbmcgui.ControlButton(800, 50, 200, 100, "Next!")
		self.addControl(self.gather)

		self.addChoice("Submit scraped movies", "movies")
		self.addChoice("Submit scraped episodes", "episodes")
		self.addChoice("Submit scraped music videos", "musicvideos")

		for source in getSources():
			self.addChoice(u'Submit unscraped videos from "' + source["label"] + u'"', source["file"])

		self.setFocus(self.choiceButton[0])
		self.gather.controlLeft(self.choiceButton[0])
    def __init__(self):
        self.strActionInfo = xbmcgui.ControlLabel(0, 0, 300, 200, 'Push BACK to cancel', 'font13', '0xFFFFFFFF')
        self.addControl(self.strActionInfo)

        self.choiceButton = list()
        self.choiceID = list()

        self.gather = xbmcgui.ControlButton(800, 50, 200, 100, "Next!")
        self.addControl(self.gather)

        self.addChoice("Submit scraped movies", "movies")
        self.addChoice("Submit scraped episodes", "episodes")
        self.addChoice("Submit scraped music videos", "musicvideos")

        for source in getSources():
            self.addChoice(u'Submit unscraped videos from "' + source["label"] + u'"', source["file"])

        self.setFocus(self.choiceButton[0])
        self.gather.controlLeft(self.choiceButton[0])