Пример #1
0
 def test_remove_from_empty_track(self):
     track = Track('00000000-0000-0000-0000-000000000000')
     track.linked_files.append(File('test1.flac'))
     update_metadata_images(track)
     remove_metadata_images(track, [track.linked_files[0]])
     self.assertEqual(set(), set(track.orig_metadata.images))
     self.assertTrue(track.orig_metadata.has_common_images)
Пример #2
0
 def test_remove_from_empty_cluster(self):
     cluster = Cluster('Test')
     cluster.files.append(File('test1.flac'))
     update_metadata_images(cluster)
     remove_metadata_images(cluster, [cluster.files[0]])
     self.assertEqual(set(), set(cluster.metadata.images))
     self.assertTrue(cluster.metadata.has_common_images)
Пример #3
0
 def _update_related_album(self, added_files=None, removed_files=None):
     if self.related_album:
         if added_files:
             add_metadata_images(self.related_album, added_files)
         if removed_files:
             remove_metadata_images(self.related_album, removed_files)
         self.related_album.update()
Пример #4
0
 def test_remove_from_empty_track(self):
     track = Track('00000000-0000-0000-0000-000000000000')
     track.linked_files.append(File('test1.flac'))
     update_metadata_images(track)
     remove_metadata_images(track, [track.linked_files[0]])
     self.assertEqual(set(), set(track.orig_metadata.images))
     self.assertTrue(track.orig_metadata.has_common_images)
Пример #5
0
 def test_remove_from_empty_cluster(self):
     cluster = Cluster('Test')
     cluster.files.append(File('test1.flac'))
     update_metadata_images(cluster)
     remove_metadata_images(cluster, [cluster.files[0]])
     self.assertEqual(set(), set(cluster.metadata.images))
     self.assertTrue(cluster.metadata.has_common_images)
Пример #6
0
 def test_remove_from_track_with_common_images(self):
     track = Track('00000000-0000-0000-0000-000000000000')
     track.linked_files = list(self.test_files[1:])
     update_metadata_images(track)
     track.linked_files.remove(self.test_files[1])
     remove_metadata_images(track, [self.test_files[1]])
     self.assertEqual(set(self.test_images[1:]), set(track.orig_metadata.images))
     self.assertTrue(track.orig_metadata.has_common_images)
Пример #7
0
 def test_remove_from_track_with_common_images(self):
     track = Track('00000000-0000-0000-0000-000000000000')
     track.linked_files = list(self.test_files[1:])
     update_metadata_images(track)
     track.linked_files.remove(self.test_files[1])
     remove_metadata_images(track, [self.test_files[1]])
     self.assertEqual(set(self.test_images[1:]), set(track.orig_metadata.images))
     self.assertTrue(track.orig_metadata.has_common_images)
Пример #8
0
 def test_remove_from_cluster_with_common_images(self):
     cluster = Cluster('Test')
     cluster.files = list(self.test_files[1:])
     update_metadata_images(cluster)
     cluster.files.remove(self.test_files[1])
     remove_metadata_images(cluster, [self.test_files[1]])
     self.assertEqual(set(self.test_images[1:]), set(cluster.metadata.images))
     self.assertTrue(cluster.metadata.has_common_images)
Пример #9
0
 def test_remove_from_cluster_with_common_images(self):
     cluster = Cluster('Test')
     cluster.files = list(self.test_files[1:])
     update_metadata_images(cluster)
     cluster.files.remove(self.test_files[1])
     remove_metadata_images(cluster, [self.test_files[1]])
     self.assertEqual(set(self.test_images[1:]), set(cluster.metadata.images))
     self.assertTrue(cluster.metadata.has_common_images)
Пример #10
0
 def test_remove_from_empty_album(self):
     album = Album('00000000-0000-0000-0000-000000000000')
     album.unmatched_files.files.append(File('test1.flac'))
     update_metadata_images(album)
     remove_metadata_images(album, [album.unmatched_files.files[0]])
     self.assertEqual(set(), set(album.metadata.images))
     self.assertEqual(set(), set(album.orig_metadata.images))
     self.assertTrue(album.metadata.has_common_images)
     self.assertTrue(album.orig_metadata.has_common_images)
Пример #11
0
 def test_remove_from_empty_album(self):
     album = Album('00000000-0000-0000-0000-000000000000')
     album.unmatched_files.files.append(File('test1.flac'))
     update_metadata_images(album)
     remove_metadata_images(album, [album.unmatched_files.files[0]])
     self.assertEqual(set(), set(album.metadata.images))
     self.assertEqual(set(), set(album.orig_metadata.images))
     self.assertTrue(album.metadata.has_common_images)
     self.assertTrue(album.orig_metadata.has_common_images)
Пример #12
0
 def test_remove_from_album_with_common_images(self):
     album = Album('00000000-0000-0000-0000-000000000000')
     album.unmatched_files.files = list(self.test_files[1:])
     update_metadata_images(album)
     album.unmatched_files.files.remove(self.test_files[1])
     remove_metadata_images(album, [self.test_files[1]])
     self.assertEqual(set(self.test_images[1:]), set(album.metadata.images))
     self.assertEqual(set(self.test_images[1:]), set(album.orig_metadata.images))
     self.assertTrue(album.metadata.has_common_images)
     self.assertTrue(album.orig_metadata.has_common_images)
Пример #13
0
 def remove_file(self, file):
     if file not in self.linked_files:
         return
     self.linked_files.remove(file)
     self.num_linked_files -= 1
     file.copy_metadata(file.orig_metadata, preserve_deleted=False)
     file.metadata_images_changed.disconnect(self.update_orig_metadata_images)
     self.album._remove_file(self, file)
     remove_metadata_images(self, [file])
     self.update()
Пример #14
0
 def test_remove_from_album_with_common_images(self):
     album = Album('00000000-0000-0000-0000-000000000000')
     album.unmatched_files.files = list(self.test_files[1:])
     update_metadata_images(album)
     album.unmatched_files.files.remove(self.test_files[1])
     remove_metadata_images(album, [self.test_files[1]])
     self.assertEqual(set(self.test_images[1:]), set(album.metadata.images))
     self.assertEqual(set(self.test_images[1:]), set(album.orig_metadata.images))
     self.assertTrue(album.metadata.has_common_images)
     self.assertTrue(album.orig_metadata.has_common_images)
Пример #15
0
 def remove_file(self, file):
     self.metadata.length -= file.metadata.length
     self.files.remove(file)
     self.metadata['totaltracks'] = len(self.files)
     self.item.remove_file(file)
     if not self.special and self.get_num_files() == 0:
         self.tagger.remove_cluster(self)
     if self.can_show_coverart:
         file.metadata_images_changed.disconnect(self.update_metadata_images)
         remove_metadata_images(self, [file])
     self._update_related_album(removed_files=[file])
Пример #16
0
 def remove_file(self, file):
     if file not in self.linked_files:
         return
     self.linked_files.remove(file)
     self.num_linked_files -= 1
     file.copy_metadata(file.orig_metadata, preserve_deleted=False)
     file.metadata_images_changed.disconnect(
         self.update_orig_metadata_images)
     self.album._remove_file(self, file)
     remove_metadata_images(self, [file])
     self.update()
Пример #17
0
 def remove_file(self, file, new_album=True):
     if file not in self.files:
         return
     self.files.remove(file)
     self.num_linked_files -= 1
     file.metadata_images_changed.disconnect(self.update_metadata_images)
     file.copy_metadata(file.orig_metadata, preserve_deleted=False)
     self.album._remove_file(self, file, new_album=new_album)
     remove_metadata_images(self, [file])
     run_file_post_removal_from_track_processors(self, file)
     self.update()
     if self.item.isSelected():
         self.tagger.window.refresh_metadatabox()
Пример #18
0
 def remove_file(self, file, new_album=True):
     self.tagger.window.set_processing(True)
     self.metadata.length -= file.metadata.length
     self.files.remove(file)
     self.update(signal=False)
     self.item.remove_file(file)
     if self.can_show_coverart:
         file.metadata_images_changed.disconnect(
             self.update_metadata_images)
         remove_metadata_images(self, [file])
     if new_album:
         self._update_related_album(removed_files=[file])
     self.tagger.window.set_processing(False)
     if not self.special and self.get_num_files() == 0:
         self.tagger.remove_cluster(self)
Пример #19
0
 def _remove_file(self, track, file):
     self._files -= 1
     self.update(update_tracks=False)
     file.metadata_images_changed.disconnect(self.update_metadata_images)
     remove_metadata_images(self, [file])
Пример #20
0
 def _remove_file(self, track, file):
     self._files -= 1
     self.update(update_tracks=False)
     file.metadata_images_changed.disconnect(self.update_metadata_images)
     remove_metadata_images(self, [file])
Пример #21
0
 def _remove_file(self, track, file, new_album=True):
     self._files -= 1
     if new_album:
         self.update(update_tracks=False)
         remove_metadata_images(self, [file])