Exemplo n.º 1
0
    def _check_excluded_files(self, filename):
        for ext in common.getaddon_setting("picsexcl").lower().split("|"):
            if ext in filename.lower() and len(ext) > 0:
                common.log(
                    "VFSScanner._check_excluded_files",
                    'Picture "%s" excluded due to exclude condition "%s"' %
                    (filename, common.getaddon_setting("picsexcl")))
                return False

        return True
    def _check_excluded_files(self, filename):
        for ext in common.getaddon_setting("picsexcl").lower().split("|"):
            if ext in filename.lower() and len(ext)>0:
                common.log("VFSScanner._check_excluded_files", 'Picture "%s" excluded due to exclude condition "%s"'%(filename , common.getaddon_setting("picsexcl")) )
                return False

        return True
Exemplo n.º 3
0
 def close(self):
     if common.getaddon_setting('popupScan') == 'true':
         if self.dialog is None:
             self.addonscan.close()
         else:
             #self.dialog.clearProperty( "DialogAddonScan.IsAlive" )
             self.dialog.close()
Exemplo n.º 4
0
 def create(self, line1="", line2=""):
     if common.getaddon_setting('popupScan') == 'true':
         try:
             self.dialog = xbmcgui.DialogProgressBG()
             self.dialog.create(line1, line2)
             #self.dialog.setProperty( "DialogAddonScan.IsAlive", "true" )
         except:
             self.dialog = None
             self.addonscan = AddonScanOrg()
             self.addonscan.create(line1, line2)
Exemplo n.º 5
0
    def __init__(self):

        self.exclude_folders = []
        self.all_extensions = []
        self.picture_extensions = []
        self.video_extensions = []
        self.lists_separator = "||"

        self.scan_is_cancelled = False

        self.picsdeleted = 0
        self.picsupdated = 0
        self.picsadded = 0
        self.picsscanned = 0
        self.current_root_entry = 0
        self.total_root_entries = 0
        self.totalfiles = 0
        self.mpdb = MypicsDB.MyPictureDB()

        for path, _, _, exclude in self.mpdb.get_all_root_folders():
            if exclude:
                common.log(
                    "", 'Exclude path "%s" found ' %
                    common.smart_unicode(path[:len(path) - 1]))
                self.exclude_folders.append(
                    common.smart_unicode(path[:len(path) - 1]))

        for ext in common.getaddon_setting("picsext").split("|"):
            self.picture_extensions.append("." + ext.replace(".", "").upper())

        for ext in common.getaddon_setting("vidsext").split("|"):
            self.video_extensions.append("." + ext.replace(".", "").upper())

        self.use_videos = common.getaddon_setting("usevids")

        self.all_extensions.extend(self.picture_extensions)
        self.all_extensions.extend(self.video_extensions)

        self.filescanner = Scanner()
    def __init__(self):

        self.exclude_folders    = []
        self.all_extensions     = []
        self.picture_extensions = []
        self.video_extensions   = []
        self.lists_separator = "||"
        
        self.scan_is_cancelled = False
        
        self.picsdeleted = 0
        self.picsupdated = 0
        self.picsadded   = 0
        self.picsscanned = 0
        self.current_root_entry = 0
        self.total_root_entries = 0
        self.totalfiles  = 0
        self.mpdb = MypicsDB.MyPictureDB()
         
        for path,_,_,exclude in self.mpdb.get_all_root_folders():
            if exclude:
                common.log("", 'Exclude path "%s" found '%common.smart_unicode(path[:len(path)-1]))
                self.exclude_folders.append(common.smart_unicode(path[:len(path)-1]))

        for ext in common.getaddon_setting("picsext").split("|"):
            self.picture_extensions.append("." + ext.replace(".","").upper())

        for ext in common.getaddon_setting("vidsext").split("|"):
            self.video_extensions.append("." + ext.replace(".","").upper())

        self.use_videos = common.getaddon_setting("usevids")

        self.all_extensions.extend(self.picture_extensions)
        self.all_extensions.extend(self.video_extensions)

        self.filescanner = Scanner()
Exemplo n.º 7
0
 def update(self, percent1=0, percent2=0, line1="", line2=""):
     if common.getaddon_setting('popupScan') == 'true':
         if self.dialog is None:
             self.addonscan.update(percent1, percent2, line1, line2)
         else:
             self.dialog.update(percent1, line1, line2)
Exemplo n.º 8
0
 def iscanceled(self):
     if common.getaddon_setting('popupScan') == 'true':
         if self.dialog is None:
             return self.addonscan.iscanceled()
         else:
             return self.dialog.isFinished()
Exemplo n.º 9
0
    def dispatcher(self, options):

        try:
            if common.getaddon_setting('scanning') == 'false':
                common.setaddon_setting("scanning", "true")
                self.options = options

                common.log("VFSScanner.dispatcher", "dispatcher started",
                           xbmc.LOGINFO)

                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.LOGINFO)
                    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.LOGINFO)
                    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.LOGINFO)

                if common.getaddon_setting('popupEndOfScan') == 'true':
                    common.show_notification(
                        common.getstring(30000),
                        common.getstring(30248) %
                        (self.picsscanned, self.picsadded, self.picsdeleted,
                         self.picsupdated))

                common.setaddon_setting("scanning", "false")

            else:
                common.log("VFSScanner.dispatcher",
                           "dispatcher already running", xbmc.LOGINFO)

        except Exception as msg:
            common.log("Main.add_directory", "%s - %s" % (Exception, str(msg)),
                       xbmc.LOGERROR)
            common.setaddon_setting("scanning", "false")