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 __preserve_playcount(self, progress): progress.start_module(lang(30701), self.PRESERVE_PLAYCOUNT_STEPS) try: if not self.episodeid: raise Exception(lang(30601)) progress.update(lang(30598)) # setting old playcount utilxbmc.set_episode_playcount(self.episodeid, self.playcount) except Exception, e: dialog.error(e.message)
def __preserve_playcount(self, progress): progress.start_module(lang(30701), self.PRESERVE_PLAYCOUNT_STEPS) try: if not self.episodeid: raise Exception(lang(30601)) progress.update(lang(30598)) # setting old playcount utilxbmc.set_episode_playcount(self.episodeid, self.playcount) except Exception as e: if debug.get(): log(debug.traceback.print_exc(), xbmc.LOGERROR) debug.exception_dialog(e) finally: progress.finish_module()
def __move(self, progress): progress.start_module(lang(30131), 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(30131), count): raise Exception(lang(30609)) log("Episode.__move: source=%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]) else: # single folder destination = os.path.join(self.destination, self.path.split(os.sep)[-2]) log("Episode.__move: destination=%s, self.alt_method=%s" % (destination, self.alt_method)) 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 as e: if debug.get(): log(debug.traceback.print_exc(), xbmc.LOGERROR) debug.exception_dialog(e) finally: progress.finish_module()