Merge pull request #2975 from zsinskri/2972-from-scratch-keep-immutable

from_scratch option: keep immutable fields (#2972)
This commit is contained in:
Adrian Sampson 2018-07-02 15:38:57 -04:00 committed by GitHub
commit 5606717499
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 1 deletions

View file

@ -564,7 +564,7 @@ class Item(LibModel):
def clear(self):
"""Set all key/value pairs to None."""
for key in self._media_fields:
for key in self._media_tag_fields:
setattr(self, key, None)
def get_album(self):

View file

@ -26,6 +26,9 @@ Fixes:
* Display the artist credit when matching albums if the :ref:`artist_credit`
configuration option is set.
:bug:`2953`
* With the :ref:`from_scratch` configuration option set, only writable fields
are cleared. Beets now no longer ignores the format your music is saved in.
:bug:`2972`
* LastGenre: Allow to set the configuration option ``prefer_specific``
without setting ``canonical``.
:bug:`2973`

View file

@ -644,6 +644,21 @@ class ImportTest(_common.TestCase, ImportHelper):
self.importer.run()
self.assertEqual(self.lib.items().get().genre, u'')
def test_apply_from_scratch_keeps_format(self):
config['import']['from_scratch'] = True
self.importer.add_choice(importer.action.APPLY)
self.importer.run()
self.assertEqual(self.lib.items().get().format, u'MP3')
def test_apply_from_scratch_keeps_bitrate(self):
config['import']['from_scratch'] = True
bitrate = 80000
self.importer.add_choice(importer.action.APPLY)
self.importer.run()
self.assertEqual(self.lib.items().get().bitrate, bitrate)
def test_apply_with_move_deletes_import(self):
config['import']['move'] = True