def __delete(self, progress): progress.start_module(lang(30132), self.DELETE_STEPS) try: progress.update(lang(30516)) # deleting files source = os.path.dirname(self.path) remove_empty = setting('fm_movies_remove_empty') == 'true' if setting('fm_movies_structure') == '0': # multiple folders count = utilfile.count_manage_directory(self.alt_method, source) if not dialog.warning(lang(30132), count): raise Exception(lang(30609)) utilfile.delete_directory(self.alt_method, source) else: # single folder match = os.path.splitext(os.path.basename(self.path))[0] count = utilfile.count_manage_files(self.alt_method, source, match) log("Movie.__delete: match=%s" % match) if not dialog.warning(lang(30132), count): raise Exception(lang(30609)) utilfile.delete_files(self.alt_method, source, match, remove_empty) progress.update(lang(30513)) # updating library progress.update_library(self.path) self.movieid = None self.path = None except OSError: dialog.error(lang(30610)) except ValueError as err: ValueErrorHandler(err) except Exception as e: if debug.get(): log(debug.traceback.print_exc(), xbmc.LOGERROR) debug.exception_dialog(e) finally: progress.finish_module()
def __delete(self, progress): progress.start_module(lang(30133), self.DELETE_STEPS) try: progress.update(lang(30516)) # deleting files source = os.path.dirname(self.path) remove_empty = setting("fm_movie_remove_empty") == "true" if setting("fm_movies_structure") == "0": # multiple folders count = utilfile.count_manage_directory(self.alt_method, source) if not dialog.warning(lang(30133), count): raise Exception(lang(30609)) utilfile.delete_directory(self.alt_method, source) else: # single folder match = os.path.splitext(os.path.basename(self.path))[0] count = utilfile.count_manage_files(self.alt_method, source, match) log("Movie: delete match: %s" % match) if not dialog.warning(lang(30133), count): raise Exception(lang(30609)) utilfile.delete_files(self.alt_method, source, match, remove_empty) progress.update(lang(30513)) # updating library progress.update_library(self.path) self.movieid = None self.path = None except OSError: dialog.error(lang(30610)) except ValueError as err: ValueErrorHandler(err) except Exception, e: dialog.error(e.message)
def __move(self, progress): progress.start_module(lang(30132), self.MOVE_STEPS) try: progress.update(lang(30590)) # detecting library place lib_source = os.path.dirname(os.path.dirname(os.path.dirname(self.path))) if self.destination == lib_source: raise Exception(lang(30602)) progress.update(lang(30506)) # moving files source = os.path.dirname(self.path) match = os.path.splitext(os.path.basename(self.path))[0] count = utilfile.count_manage_files(self.alt_method, source, match) if not dialog.warning(lang(30132), count): raise Exception(lang(30609)) log("Episode: move source path: %s" % source) if setting('fm_episodes_structure') == '0': # multiple folders destination = os.path.join(self.destination, self.path.split(os.sep)[-3], self.path.split(os.sep)[-2]) log("Episode: move destination (multiple) |alt_method=%s|: %s" % (self.alt_method, destination)) else: # single folder destination = os.path.join(self.destination, self.path.split(os.sep)[-2]) log("Episode: move destination (single) |alt_method=%s|: %s" % (self.alt_method, destination)) utilfile.move_files(self.alt_method, source, destination, match, True) progress.update(lang(30513)) # updating library progress.update_library(self.path) self.path = os.path.join(destination, os.path.basename(self.path)) self.episodeid = utilxbmc.get_episodeid_by_path(self.path) if self.episodeid: # if still in lib source folders progress.update(lang(30514)) # setting watched utilxbmc.set_episode_playcount(self.episodeid, self.playcount+1) except OSError: dialog.error(lang(30610)) except ValueError as err: ValueErrorHandler(err) except Exception, e: dialog.error(e.message)
def __move(self, progress): progress.start_module(lang(30132), self.MOVE_STEPS) try: progress.update(lang(30590)) # detecting library place if setting("fm_movies_structure") == "0": lib_source = os.path.dirname(os.path.dirname(self.path)) else: lib_source = os.path.dirname(self.path) if self.destination == lib_source: raise Exception(lang(30607)) progress.update(lang(30506)) # moving files source = os.path.dirname(self.path) if setting("fm_movies_structure") == "0": # multiple folders count = utilfile.count_manage_directory(self.alt_method, source) if not dialog.warning(lang(30132), count): raise Exception(lang(30609)) log("Movie: move source (multiple): %s" % source) log("Movie: move destination (multiple): %s" % self.destination) utilfile.move_directory(self.alt_method, source, self.destination) self.path = os.path.join(self.destination, self.path.split(os.sep)[-2], os.path.basename(self.path)) log("Movie: Self path (lib/title/files.*): %s" % self.path) else: # single folder match = os.path.splitext(os.path.basename(self.path))[0] count = utilfile.count_manage_files(self.alt_method, source, match) if not dialog.warning(lang(30132), count): raise Exception(lang(30609)) log("Movie: move source (single): %s" % source) log("Movie: move destination (single): %s" % self.destination) utilfile.move_files(self.alt_method, source, self.destination, match) self.path = os.path.join(self.destination, os.path.basename(self.path)) log("Movie: Self path: %s" % self.path) progress.update(lang(30513)) # updating library progress.update_library(self.path) self.movieid = utilxbmc.get_movieid_by_path(self.path) if self.movieid: progress.update(lang(30514)) # setting watched utilxbmc.set_movie_playcount(self.movieid, self.playcount + 1) except OSError: dialog.error(lang(30610)) except ValueError as err: ValueErrorHandler(err) except Exception, e: dialog.error(e.message)
def __move(self, progress): progress.start_module(lang(30131), self.MOVE_STEPS) try: progress.update(lang(30590)) # detecting library place if setting('fm_movies_structure') == '0': lib_source = os.path.dirname(os.path.dirname(self.path)) else: lib_source = os.path.dirname(self.path) if self.destination == lib_source: raise Exception(lang(30607)) progress.update(lang(30506)) # moving files source = os.path.dirname(self.path) if setting('fm_movies_structure') == '0': # multiple folders count = utilfile.count_manage_directory(self.alt_method, source) if not dialog.warning(lang(30131), count): raise Exception(lang(30609)) utilfile.move_directory(self.alt_method, source, self.destination) self.path = os.path.join(self.destination, self.path.split(os.sep)[-2], os.path.basename(self.path)) else: # single folder match = os.path.splitext(os.path.basename(self.path))[0] count = utilfile.count_manage_files(self.alt_method, source, match) if not dialog.warning(lang(30131), count): raise Exception(lang(30609)) utilfile.move_files(self.alt_method, source, self.destination, match) self.path = os.path.join(self.destination, os.path.basename(self.path)) log("Movie.__move: source=%s, destination=%s, self.path=%s, alt_method=%s" % (source, self.destination, self.path, self.alt_method)) progress.update(lang(30513)) # updating library progress.update_library(self.path) self.movieid = utilxbmc.get_movieid_by_path(self.path) if self.movieid: progress.update(lang(30514)) # setting watched utilxbmc.set_movie_playcount(self.movieid, self.playcount+1) except OSError: dialog.error(lang(30610)) except ValueError as err: ValueErrorHandler(err) except Exception as e: if debug.get(): log(debug.traceback.print_exc(), xbmc.LOGERROR) debug.exception_dialog(e) finally: progress.finish_module()
def about_dialog(self): about = """ <h2 style="text-align: center;">Created By,</h2> <h4 style="text-align: center;">Javed Hussain</h4> <h4 style="text-align: center;">Neethu KT</h4> <h4 style="text-align: center;">Shahma P</h4> <h4 style="text-align: center;">Anu Krishna</h4> <h3 style="text-align: center;"> </h3> <h3 style="text-align: center;">IT 2015 - 2019</h3> <h3 style="text-align: center;"><a href="https://github.com/trailblazer42">Github</a></h3> """ dial = warning(1, about) dial.exec_()
def __delete(self, progress): progress.start_module(lang(30133), self.DELETE_STEPS) try: progress.update(lang(30516)) # deleting files source = os.path.dirname(self.path) remove_empty = setting('fm_episodes_remove_empty') == 'true' match = os.path.splitext(os.path.basename(self.path))[0] log("Episode: delete match: %s" % match) count = utilfile.count_manage_files(self.alt_method, source, match) if not dialog.warning(lang(30133), count): raise Exception(lang(30609)) utilfile.delete_files(self.alt_method, source, match, remove_empty) progress.update(lang(30513)) # updating library progress.update_library(self.path) self.episodeid = None self.path = None except OSError: dialog.error(lang(30610)) except ValueError as err: ValueErrorHandler(err) except Exception, e: dialog.error(e.message)
def warner(self): warn = warning(0, " ") warn.exec_()