示例#1
0
 def test(self):
     self.assertEqual(util.is_hidden_path("/a/.b/c.mp3"), True)
     self.assertEqual(util.is_hidden_path("/a/b/c.mp3"), False)
     self.assertEqual(util.is_hidden_path("/a/.b/.c.mp3"), True)
     self.assertEqual(util.is_hidden_path("/a/b/.c.mp3"), True)
     self.assertEqual(util.is_hidden_path("c.mp3"), False)
     self.assertEqual(util.is_hidden_path(".c.mp3"), True)
     self.assertEqual(util.is_hidden_path("/a/./c.mp3"), False)
     self.assertEqual(util.is_hidden_path("/a/./.c.mp3"), True)
     self.assertEqual(util.is_hidden_path("/a/../c.mp3"), False)
     self.assertEqual(util.is_hidden_path("/a/../.c.mp3"), True)
示例#2
0
 def test(self):
     self.assertEqual(util.is_hidden_path('/a/.b/c.mp3'), True)
     self.assertEqual(util.is_hidden_path('/a/b/c.mp3'), False)
     self.assertEqual(util.is_hidden_path('/a/.b/.c.mp3'), True)
     self.assertEqual(util.is_hidden_path('/a/b/.c.mp3'), True)
     self.assertEqual(util.is_hidden_path('c.mp3'), False)
     self.assertEqual(util.is_hidden_path('.c.mp3'), True)
     self.assertEqual(util.is_hidden_path('/a/./c.mp3'), False)
     self.assertEqual(util.is_hidden_path('/a/./.c.mp3'), True)
     self.assertEqual(util.is_hidden_path('/a/../c.mp3'), False)
     self.assertEqual(util.is_hidden_path('/a/../.c.mp3'), True)
示例#3
0
 def test(self):
     self.assertEqual(util.is_hidden_path('/a/.b/c.mp3'), True)
     self.assertEqual(util.is_hidden_path('/a/b/c.mp3'), False)
     self.assertEqual(util.is_hidden_path('/a/.b/.c.mp3'), True)
     self.assertEqual(util.is_hidden_path('/a/b/.c.mp3'), True)
     self.assertEqual(util.is_hidden_path('c.mp3'), False)
     self.assertEqual(util.is_hidden_path('.c.mp3'), True)
     self.assertEqual(util.is_hidden_path('/a/./c.mp3'), False)
     self.assertEqual(util.is_hidden_path('/a/./.c.mp3'), True)
     self.assertEqual(util.is_hidden_path('/a/../c.mp3'), False)
     self.assertEqual(util.is_hidden_path('/a/../.c.mp3'), True)
示例#4
0
文件: tagger.py 项目: SRITANU/picard
 def add_files(self, filenames, target=None):
     """Add files to the tagger."""
     ignoreregex = None
     pattern = config.setting['ignore_regex']
     if pattern:
         ignoreregex = re.compile(pattern)
     ignore_hidden = not config.persist["show_hidden_files"]
     new_files = []
     for filename in filenames:
         filename = os.path.normpath(os.path.realpath(filename))
         if ignore_hidden and is_hidden_path(filename):
             log.debug("File ignored (hidden): %s" % (filename))
             continue
         if ignoreregex is not None and ignoreregex.search(filename):
             log.info("File ignored (matching %s): %s" % (pattern, filename))
             continue
         if filename not in self.files:
             file = open_file(filename)
             if file:
                 self.files[filename] = file
                 new_files.append(file)
     if new_files:
         log.debug("Adding files %r", new_files)
         new_files.sort(key=lambda x: x.filename)
         if target is None or target is self.unmatched_files:
             self.unmatched_files.add_files(new_files)
             target = None
         for file in new_files:
             file.load(partial(self._file_loaded, target=target))
示例#5
0
 def add_files(self, filenames, target=None):
     """Add files to the tagger."""
     ignoreregex = None
     pattern = config.setting['ignore_regex']
     if pattern:
         ignoreregex = re.compile(pattern)
     ignore_hidden = not config.persist["show_hidden_files"]
     new_files = []
     for filename in filenames:
         filename = os.path.normpath(os.path.realpath(filename))
         if ignore_hidden and is_hidden_path(filename):
             log.debug("File ignored (hidden): %s" % (filename))
             continue
         if ignoreregex is not None and ignoreregex.search(filename):
             log.info("File ignored (matching %s): %s" % (pattern, filename))
             continue
         if filename not in self.files:
             file = open_file(filename)
             if file:
                 self.files[filename] = file
                 new_files.append(file)
     if new_files:
         log.debug("Adding files %r", new_files)
         new_files.sort(key=lambda x: x.filename)
         if target is None or target is self.unmatched_files:
             self.unmatched_files.add_files(new_files)
             target = None
         for file in new_files:
             file.load(partial(self._file_loaded, target=target))