Merge pull request #3021 from beetbox/ignore-data-tracks

Allow ignoring of audio data tracks on import
This commit is contained in:
Filipe Fortes 2018-09-02 11:34:39 -04:00 committed by GitHub
commit ce03e5a2e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 1 deletions

View file

@ -281,7 +281,8 @@ def album_info(release):
continue
all_tracks = medium['track-list']
if 'data-track-list' in medium:
if ('data-track-list' in medium
and not config['match']['ignore_data_tracks']):
all_tracks += medium['data-track-list']
track_count = len(all_tracks)

View file

@ -129,6 +129,7 @@ match:
ignored: []
required: []
ignored_media: []
ignore_data_tracks: no
ignore_video_tracks: yes
track_length_grace: 10
track_length_max: 30

View file

@ -40,6 +40,8 @@ New features:
Fixes:
* A new importer option, :ref:`ignore_data_tracks`, lets you skip audio tracks
contained in data files :bug:`3021`
* Restore iTunes Store album art source, and remove the dependency on
python-itunes_, which had gone unmaintained and was not py3 compatible.
Thanks to :user:`ocelma` for creating python-itunes_ in the first place.

View file

@ -809,6 +809,17 @@ of audio, for example::
No formats are ignored by default.
.. _ignore_data_tracks:
ignore_data_tracks
~~~~~~~~~~~~~~~~~~~
By default, audio files contained in data tracks within a release are included
in the album's tracklist. If you do not want them to be included, set it to
``yes``.
Default: ``no``.
.. _ignore_video_tracks:
ignore_video_tracks

View file

@ -383,6 +383,18 @@ class MBAlbumInfoTest(_common.TestCase):
self.assertEqual(d.tracks[1].title, 'TITLE TWO')
self.assertEqual(d.tracks[2].title, 'TITLE AUDIO DATA')
def test_skip_audio_data_tracks_if_configured(self):
config['match']['ignore_data_tracks'] = True
tracks = [self._make_track('TITLE ONE', 'ID ONE', 100.0 * 1000.0),
self._make_track('TITLE TWO', 'ID TWO', 200.0 * 1000.0)]
data_tracks = [self._make_track('TITLE AUDIO DATA', 'ID DATA TRACK',
100.0 * 1000.0)]
release = self._make_release(tracks=tracks, data_tracks=data_tracks)
d = mb.album_info(release)
self.assertEqual(len(d.tracks), 2)
self.assertEqual(d.tracks[0].title, 'TITLE ONE')
self.assertEqual(d.tracks[1].title, 'TITLE TWO')
def test_skip_video_tracks_by_default(self):
tracks = [self._make_track('TITLE ONE', 'ID ONE', 100.0 * 1000.0),
self._make_track('TITLE VIDEO', 'ID VIDEO', 100.0 * 1000.0,