Added a setting to control if video tracks are ignored

Users may want to keep tracking video tracks, for example if they rip
the audio part of the video tracks. Added a setting to allow this.
This commit is contained in:
Nicolas Guillaumin 2017-12-31 10:46:48 -08:00
parent 71b4d5c702
commit d325bceb1d
4 changed files with 28 additions and 2 deletions

View file

@ -294,7 +294,8 @@ def album_info(release):
continue
if ('video' in track['recording'] and
track['recording']['video'] == 'true'):
track['recording']['video'] == 'true' and
config['match']['ignore_video_tracks'].get(bool) is True):
continue
# Basic information from the recording.

View file

@ -126,5 +126,6 @@ match:
original_year: no
ignored: []
required: []
ignore_video_tracks: yes
track_length_grace: 10
track_length_max: 30

View file

@ -774,6 +774,17 @@ want to enforce to the ``required`` setting::
No tags are required by default.
.. _ignore_video_tracks:
ignore_video_tracks
~~~~~~~~~~~~~~~~~~~
By default, video tracks within a release will be ignored. If you want them to
be included (for example if you would like to track the audio-only versions of
the video tracks), set it to ``no``.
Default: ``yes``.
.. _path-format-config:
Path Format Configuration

View file

@ -358,7 +358,7 @@ class MBAlbumInfoTest(_common.TestCase):
self.assertEqual(d.tracks[0].title, 'TITLE ONE')
self.assertEqual(d.tracks[1].title, 'TITLE TWO')
def test_skip_video_track(self):
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,
False, True),
@ -369,6 +369,19 @@ class MBAlbumInfoTest(_common.TestCase):
self.assertEqual(d.tracks[0].title, 'TITLE ONE')
self.assertEqual(d.tracks[1].title, 'TITLE TWO')
def test_no_skip_video_tracks_if_configured(self):
config['match']['ignore_video_tracks'] = False
tracks = [self._make_track('TITLE ONE', 'ID ONE', 100.0 * 1000.0),
self._make_track('TITLE VIDEO', 'ID VIDEO', 100.0 * 1000.0,
False, True),
self._make_track('TITLE TWO', 'ID TWO', 200.0 * 1000.0)]
release = self._make_release(tracks=tracks)
d = mb.album_info(release)
self.assertEqual(len(d.tracks), 3)
self.assertEqual(d.tracks[0].title, 'TITLE ONE')
self.assertEqual(d.tracks[1].title, 'TITLE VIDEO')
self.assertEqual(d.tracks[2].title, 'TITLE TWO')
class ParseIDTest(_common.TestCase):
def test_parse_id_correct(self):