def dispatcher(self, options): self.options = options if self.options.rootpath: self.options.rootpath = common.smart_utf8(unquote_plus( self.options.rootpath)).replace("\\\\", "\\").replace("\\\\", "\\").replace("\\'", "\'") common.log("VFSScanner.dispatcher", 'Adding path "%s"'%self.options.rootpath, xbmc.LOGNOTICE) self.scan = AddonScan() self.action = common.getstring(30244)#adding self.scan.create( common.getstring(30000) ) self.current_root_entry = 1 self.total_root_entries = 1 self.scan.update(0,0, common.getstring(30000)+" ["+common.getstring(30241)+"]",#MyPicture Database [preparing] common.getstring(30247))#please wait... self._countfiles(self.options.rootpath) self.total_root_entries = 1 self._addpath(self.options.rootpath, None, self.options.recursive, True) self.scan.close() elif self.options.database or self.options.refresh: paths = self.mpdb.get_all_root_folders() common.log("VFSScanner.dispatcher", "Database refresh started", xbmc.LOGNOTICE) self.action = common.getstring(30242)#Updating if paths: self.scan = AddonScan() self.scan.create( common.getstring(30000) ) self.current_root_entry = 0 self.total_root_entries = 0 self.scan.update(0,0, common.getstring(30000)+" ["+common.getstring(30241)+"]",#MyPicture Database [preparing] common.getstring(30247))#please wait... for path,recursive,update,exclude in paths: if exclude==0: self.total_root_entries += 1 self._countfiles(path,False) for path,recursive,update,exclude in paths: if exclude==0: try: self.current_root_entry += 1 self._addpath(path, None, recursive, update) except: print_exc() self.scan.close() # Set default translation for tag types self.mpdb.default_tagtypes_translation() self.mpdb.cleanup_keywords() # delete all entries with "sha is null" self.picsdeleted += self.mpdb.del_pics_wo_sha(self.scan_is_cancelled) common.log("VFSScanner.dispatcher", common.getstring(30248)%(self.picsscanned,self.picsadded,self.picsdeleted,self.picsupdated), xbmc.LOGNOTICE) common.show_notification(common.getstring(30000), common.getstring(30248)%(self.picsscanned,self.picsadded,self.picsdeleted,self.picsupdated) )
def dispatcher(self, options): self.options = options if self.options.rootpath: self.options.rootpath = common.smart_utf8(unquote_plus( self.options.rootpath)).replace("\\\\", "\\").replace("\\\\", "\\").replace("\\'", "\'") common.log("VFSScanner.dispatcher", 'Adding path "%s"'%self.options.rootpath, xbmc.LOGNOTICE) self.scan = AddonScan() self.action = common.getstring(30244)#adding self.scan.create( common.getstring(30000) ) self.current_root_entry = 1 self.total_root_entries = 1 self.scan.update(0,0, common.getstring(30000)+" ["+common.getstring(30241)+"]",#MyPicture Database [preparing] common.getstring(30247))#please wait... self._countfiles(self.options.rootpath) self.total_root_entries = 1 self._addpath(self.options.rootpath, None, self.options.recursive, True) self.scan.close() elif self.options.database or self.options.refresh: paths = self.mpdb.get_all_root_folders() common.log("VFSScanner.dispatcher", "Database refresh started", xbmc.LOGNOTICE) self.action = common.getstring(30242)#Updating if paths: self.scan = AddonScan() self.scan.create( common.getstring(30000) ) self.current_root_entry = 0 self.total_root_entries = 0 self.scan.update(0,0, common.getstring(30000)+" ["+common.getstring(30241)+"]",#MyPicture Database [preparing] common.getstring(30247))#please wait... for path,recursive,update,exclude in paths: if exclude==0: self.total_root_entries += 1 self._countfiles(path,False) for path,recursive,update,exclude in paths: if exclude==0: try: self.current_root_entry += 1 self._addpath(path, None, recursive, update) except: print_exc() self.scan.close() # Set default translation for tag types self.mpdb.default_tagtypes_translation() self.mpdb.cleanup_keywords() # delete all entries with "sha is null" self.picsdeleted += self.mpdb.del_pics_wo_sha(self.scan_is_cancelled) common.show_notification(common.getstring(30000), common.getstring(30248)%(self.picsscanned,self.picsadded,self.picsdeleted,self.picsupdated) )