def test_finds_multiple_songs(self):
     for _, album in albums_in_dir(self.base):
         n = re.search(r'album(.)song', album[0]).group(1)
         if n == '1':
             self.assertEqual(len(album), 2)
         else:
             self.assertEqual(len(album), 1)
示例#2
0
 def test_finds_multiple_songs(self):
     for _, album in albums_in_dir(self.base):
         n = re.search(r'album(.)song', album[0]).group(1)
         if n == '1':
             self.assertEqual(len(album), 2)
         else:
             self.assertEqual(len(album), 1)
示例#3
0
    def noimport_files(self, lib, paths):
        # Check the user-specified directories.
        for path in paths:
            if not os.path.exists(syspath(normpath(path))):
                raise ui.UserError(u'no such file or directory: {0}'.format(
                    displayable_path(path)))

        # Open the state file
        state = importer._open_state()

        # Create the 'taghistory' set if it doesn't exist
        if 'taghistory' not in state:
            state['taghistory'] = set()

        # For every path...
        for path in paths:
            added = 0
            # ...get the list of albums in that path...
            for dirs, paths_in_dir in importer.albums_in_dir(path):
                # ...check if they're not already in the 'taghistory' set
                if tuple(dirs) not in state['taghistory']:
                    # ...and add them...
                    state['taghistory'].add(tuple(map(normpath, dirs)))
                    added += 1

        # Save the state file
        importer._save_state(state)

        log.info(u'Added {0} paths to the skip list', added)
示例#4
0
    def noimport_files(self, lib, paths):
        # Check the user-specified directories.
        for path in paths:
            if not os.path.exists(syspath(normpath(path))):
                raise ui.UserError(u'no such file or directory: {0}'.format(
                    displayable_path(path)))

        # Open the state file
        state = importer._open_state()

        # Create the 'taghistory' set if it doesn't exist
        if 'taghistory' not in state:
            state['taghistory'] = set()

        # For every path...
        for path in paths:
            added = 0
            # ...get the list of albums in that path...
            for dirs, paths_in_dir in importer.albums_in_dir(path):
                # ...check if they're not already in the 'taghistory' set
                if tuple(dirs) not in state['taghistory']:
                    # ...and add them...
                    state['taghistory'].add(tuple(map(normpath, dirs)))
                    added += 1

        # Save the state file
        importer._save_state(state)

        log.info(u'Added {0} paths to the skip list', added)
示例#5
0
 def test_separates_contents(self):
     found = []
     for _, album in albums_in_dir(self.base):
         found.append(re.search(r'album(.)song', album[0]).group(1))
     self.assertTrue('1' in found)
     self.assertTrue('2' in found)
     self.assertTrue('3' in found)
     self.assertTrue('4' in found)
示例#6
0
 def test_separates_contents(self):
     found = []
     for _, album in albums_in_dir(self.base):
         found.append(re.search(r"album(.)song", album[0]).group(1))
     self.assertTrue("1" in found)
     self.assertTrue("2" in found)
     self.assertTrue("3" in found)
     self.assertTrue("4" in found)
 def test_separates_contents(self):
     found = []
     for _, album in albums_in_dir(self.base):
         found.append(re.search(r'album(.)song', album[0]).group(1))
     self.assertTrue('1' in found)
     self.assertTrue('2' in found)
     self.assertTrue('3' in found)
     self.assertTrue('4' in found)
 def test_coalesce_flattened_album_case_typo(self):
     albums = list(albums_in_dir(self.base))
     root, items = albums[2]
     self.assertEquals(root, self.dirs[6:8])
     self.assertEquals(len(items), 2)
 def test_coalesce_nested_album_single_subdir(self):
     albums = list(albums_in_dir(self.base))
     root, items = albums[1]
     self.assertEquals(root, self.dirs[3:5])
     self.assertEquals(len(items), 1)
示例#10
0
 def test_coalesce_nested_album_multiple_subdirs(self):
     albums = list(albums_in_dir(self.base))
     self.assertEquals(len(albums), 4)
     root, items = albums[0]
     self.assertEquals(root, self.dirs[0:3])
     self.assertEquals(len(items), 3)
示例#11
0
 def test_coalesce_nested_album_multiple_subdirs(self):
     albums = list(albums_in_dir(self.base))
     self.assertEquals(len(albums), 4)
     root, items = albums[0]
     self.assertEquals(root, self.dirs[0:3])
     self.assertEquals(len(items), 3)
示例#12
0
 def test_coalesce_nested_album_single_subdir(self):
     albums = list(albums_in_dir(self.base))
     root, items = albums[1]
     self.assertEquals(root, self.dirs[3:5])
     self.assertEquals(len(items), 1)
示例#13
0
 def test_finds_all_albums(self):
     albums = list(albums_in_dir(self.base))
     self.assertEqual(len(albums), 4)
示例#14
0
 def test_finds_all_albums(self):
     albums = list(albums_in_dir(self.base))
     self.assertEqual(len(albums), 4)
示例#15
0
 def test_single_disc_album(self):
     albums = list(albums_in_dir(self.base))
     root, items = albums[3]
     self.assertEquals(root, self.dirs[8:])
     self.assertEquals(len(items), 1)
示例#16
0
 def test_do_not_yield_empty_album(self):
     # Remove all the MP3s.
     for path in self.files:
         os.remove(path)
     albums = list(albums_in_dir(self.base))
     self.assertEquals(len(albums), 0)
示例#17
0
 def test_single_disc_album(self):
     albums = list(albums_in_dir(self.base))
     root, items = albums[3]
     self.assertEquals(root, self.dirs[8:])
     self.assertEquals(len(items), 1)
示例#18
0
 def test_coalesce_flattened_album_case_typo(self):
     albums = list(albums_in_dir(self.base))
     root, items = albums[2]
     self.assertEquals(root, self.dirs[6:8])
     self.assertEquals(len(items), 2)
示例#19
0
 def test_do_not_yield_empty_album(self):
     # Remove all the MP3s.
     for path in self.files:
         os.remove(path)
     albums = list(albums_in_dir(self.base))
     self.assertEquals(len(albums), 0)
示例#20
0
def fetch_albums_from_root_directory(root_path):
    results = [FolderResult(folder, match_album_from_list_of_paths(list_of_files)) for folder, list_of_files in
               list(albums_in_dir(root_path))]
    return results