def __preserve_playcount(self, progress):
     progress.start_module(lang(30701), self.PRESERVE_PLAYCOUNT_STEPS)
     try:
         if not self.movieid:
             raise Exception(lang(30604))
         progress.update(lang(30598))  # setting old playcount
         utilxbmc.set_movie_playcount(self.movieid, self.playcount)
     except Exception, e:
         dialog.error(e.message)
Example #2
0
 def __preserve_playcount(self, progress):
     progress.start_module(lang(30701), self.PRESERVE_PLAYCOUNT_STEPS)
     try:
         if not self.movieid:
             raise Exception(lang(30604))
         progress.update(lang(30598)) # setting old playcount
         utilxbmc.set_movie_playcount(self.movieid, 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(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)
Example #4
0
 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()