def startProcess(self, movies, total): updated = 0 resume = self.getResume() if HIDE_MOVIES: util.notification(util.l("Started_updating_movies_ratings")) else: progress = util.dialogProgress() for count, movie in enumerate(movies): if util.abortRequested() or (not(HIDE_MOVIES) and progress.iscanceled()): self.writeResume(count) break if count >= resume: if not(HIDE_MOVIES): progress.update((count * 100) // total, "%s %s" % (util.l("Searching_for"), movie["label"])) updated += self.updateMovie(movie) else: util.deleteF("resume_movies") util.writeDate("movies") text = "%s: %s %s %s %s!" % (util.l("Movies_ratings_summary"), updated, util.l("of"), total, util.l("were_updated")) util.log(text) if HIDE_MOVIES: util.notification(text) else: progress.close() util.dialogOk(util.l("Completed"), text)
def startProcess(self, movies, length): stats = {"added": 0, "updated": 0, "removed": 0} for count, movie in enumerate(movies): if util.abortRequested() or (not(HIDE_TOP250) and self.progress.iscanceled()): break result = self.checkMovie(movie) if result != None: stats[result] += 1 if not(HIDE_TOP250): self.progress.update((count * 100) // length, "%s %s" % (l("Searching_for"), movie["label"])) else: util.writeDate("top250") self.createMissingCSV() if OPEN_MISSING: util.openFile("missingTop250.csv") stats["missing"] = len(self.top250) util.log("Movies IMDb Top250 summary: updated: %(updated)s, added: %(added)s, removed: %(removed)s, missing: %(missing)s" % stats) if HIDE_TOP250: util.notification("%s %s" % (l("Completed"), l("Top250"))) else: util.dialogOk(l("Completed"), l("Movies_IMDb_Top250_summary"), "%s %s" % (stats["updated"], l("were_updated")), "%s %s %s %s" % (stats["added"], l("were_added_and"), stats["removed"], l("were_removed!")))
def start(self, hidden=False): if hidden: global HIDE_MOVIES HIDE_MOVIES = True movies = util.getMoviesWith('imdbnumber', 'votes', 'rating') total = len(movies) if total > 0: self.startProcess(movies, total) else: util.dialogOk(util.l("Info"), util.l("The_video_library_is_empty_or_the_IMDb_id_doesn't_exist!")) return HIDE_MOVIES
def startProcess(self, movies, length): stats = {"added": 0, "updated": 0, "removed": 0} for count, movie in enumerate(movies): if util.abortRequested() or (not (HIDE_TOP250) and self.progress.iscanceled()): break result = self.checkMovie(movie) if result != None: stats[result] += 1 if not (HIDE_TOP250): self.progress.update( (count * 100) // length, "%s %s" % (l("Searching_for"), movie["label"])) else: util.writeDate("top250") self.createMissingCSV() if OPEN_MISSING: util.openFile("missingTop250.csv") stats["missing"] = len(self.top250) util.log( "Movies IMDb Top250 summary: updated: %(updated)s, added: %(added)s, removed: %(removed)s, missing: %(missing)s" % stats) if HIDE_TOP250: util.notification("%s %s" % (l("Completed"), l("Top250"))) else: util.dialogOk( l("Completed"), l("Movies_IMDb_Top250_summary"), "%s %s" % (stats["updated"], l("were_updated")), "%s %s %s %s" % (stats["added"], l("were_added_and"), stats["removed"], l("were_removed!")))
def startProcess(self, movies, total): global FORM_MPAA updated = 0 if HIDE_MPAA: util.notification(l("Started_updating_movies_ratings")) else: progress = util.dialogProgress() website = "altersfreigaben.de" if LANG_MPAA == "de": if not CHANGED_PREFIX: FORM_MPAA = "germany:" if LANG_MPAA == "us": if not CHANGED_PREFIX: FORM_MPAA = "Rated" if LANG_MPAA == "au": if not CHANGED_PREFIX: FORM_MPAA = "australia:" if LANG_MPAA == "nl": if not CHANGED_PREFIX: FORM_MPAA = "Rated" httphandler = httplib.HTTPConnection(website) for count, movie in enumerate(movies): if util.abortRequested() or (not(HIDE_MPAA) and progress.iscanceled()): break if not(HIDE_MPAA): progress.update((count * 100) // total, "%s %s" % (l("Searching_for"), movie["label"])) updated += self.updateMovie(movie, httphandler, LANG_MPAA) else: util.writeDate("mpaa") text = "%s: %s %s %s %s!" % (l("Movies_ratings_summary"), updated, l("of"), total, l("were_updated")) util.log(text) if HIDE_MPAA: util.notification(text) else: progress.close() util.dialogOk(l("Completed"), text)
def start(self, hidden=False): if FIRST_RUN: global LANG_MPAA langs = ["us", "de", "nl", "au"] LANG_MPAA = langs[util.dialogSelect(l("Choose_your_MPAA_system"), langs)] util.setting("mpaaLang", LANG_MPAA) util.settingBool("firstMpaaRun", False) if hidden: global HIDE_MPAA HIDE_MPAA = True movies = util.getMoviesWith('imdbnumber', 'mpaa') total = len(movies) if total > 0: self.startProcess(movies, total) else: util.dialogOk(l("Info"), l("The_video_library_is_empty_or_the_IMDb_id_doesn't_exist!")) return HIDE_MPAA
def start(self, hidden=False): if hidden: global HIDE_TOP250 HIDE_TOP250 = True if HIDE_TOP250: util.notification(l("Importing_current_IMDb_Top250")) else: self.progress = util.dialogProgress() self.progress.update(0, l("Importing_current_IMDb_Top250")) self.top250 = self.getTop250() self.notMissing = set() if self.top250 == {}: util.dialogOk(l("Top250"), l("There_was_a_problem_with_the_IMDb_site!")) else: movies = util.getMoviesWith('imdbnumber', 'top250') length = len(movies) if length > 0: self.startProcess(movies, length) else: util.dialogOk(l("Info"), l("The_video_library_is_empty_or_the_IMDb_id_doesn't_exist!")) if not(HIDE_TOP250): self.progress.close() return HIDE_TOP250
def start(self, hidden=False): if hidden: global HIDE_TOP250 HIDE_TOP250 = True if HIDE_TOP250: util.notification(l("Importing_current_IMDb_Top250")) else: self.progress = util.dialogProgress() self.progress.update(0, l("Importing_current_IMDb_Top250")) self.top250 = self.getTop250() self.notMissing = set() if self.top250 == {}: util.dialogOk(l("Top250"), l("There_was_a_problem_with_the_IMDb_site!")) else: movies = util.getMoviesWith('imdbnumber', 'top250') length = len(movies) if length > 0: self.startProcess(movies, length) else: util.dialogOk( l("Info"), l("The_video_library_is_empty_or_the_IMDb_id_doesn't_exist!" )) if not (HIDE_TOP250): self.progress.close() return HIDE_TOP250
def getResume(self): wantResume = False if ENABLE_RESUME: try: resume = int(util.readF("resume_movies")) if resume > 0: wantResume = util.dialogYN(util.l("The_previous_scraping_was_interrupted!"), util.l("Do_you_want_to_resume?")) except (IOError, ValueError): resume = 0 if not(wantResume) or not(ENABLE_RESUME): util.deleteF("resume_movies") resume = 0 return resume
def start(self, hidden=False): if FIRST_RUN: global LANG_MPAA langs = ["us", "de", "nl", "au"] LANG_MPAA = langs[util.dialogSelect(l("Choose_your_MPAA_system"), langs)] util.setting("mpaaLang", LANG_MPAA) util.settingBool("firstMpaaRun", False) if hidden: global HIDE_MPAA HIDE_MPAA = True movies = util.getMoviesWith('imdbnumber', 'mpaa') total = len(movies) if total > 0: self.startProcess(movies, total) else: util.dialogOk( l("Info"), l("The_video_library_is_empty_or_the_IMDb_id_doesn't_exist!")) return HIDE_MPAA
def startProcess(self, movies, total): global FORM_MPAA updated = 0 if HIDE_MPAA: util.notification(l("Started_updating_movies_ratings")) else: progress = util.dialogProgress() website = "altersfreigaben.de" if LANG_MPAA == "de": if not CHANGED_PREFIX: FORM_MPAA = "germany:" if LANG_MPAA == "us": if not CHANGED_PREFIX: FORM_MPAA = "Rated" if LANG_MPAA == "au": if not CHANGED_PREFIX: FORM_MPAA = "australia:" if LANG_MPAA == "nl": if not CHANGED_PREFIX: FORM_MPAA = "Rated" httphandler = httplib.HTTPConnection(website) for count, movie in enumerate(movies): if util.abortRequested() or (not (HIDE_MPAA) and progress.iscanceled()): break if not (HIDE_MPAA): progress.update((count * 100) // total, "%s %s" % (l("Searching_for"), movie["label"])) updated += self.updateMovie(movie, httphandler, LANG_MPAA) else: util.writeDate("mpaa") text = "%s: %s %s %s %s!" % (l("Movies_ratings_summary"), updated, l("of"), total, l("were_updated")) util.log(text) if HIDE_MPAA: util.notification(text) else: progress.close() util.dialogOk(l("Completed"), text)