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