Add support for pregap tracks

This commit is contained in:
Rui Gonçalves 2015-06-02 21:07:57 +01:00
parent a91b337d3e
commit 93c8f834f0
4 changed files with 16 additions and 4 deletions

View file

@ -95,7 +95,11 @@ def apply_metadata(album_info, mapping):
item.title = track_info.title
if config['per_disc_numbering']:
item.track = track_info.medium_index or track_info.index
# We want to let the track number be zero, but if the medium index
# is not provided we need to fall back to the overall index.
item.track = track_info.medium_index
if item.track is None:
item.track = track_info.index
item.tracktotal = track_info.medium_total or len(album_info.tracks)
else:
item.track = track_info.index

View file

@ -215,7 +215,12 @@ def album_info(release):
for medium in release['medium-list']:
disctitle = medium.get('title')
format = medium.get('format')
for track in medium['track-list']:
all_tracks = medium['track-list']
if 'pregap' in medium:
all_tracks.insert(0, medium['pregap'])
for track in all_tracks:
# Basic information from the recording.
index += 1
ti = track_info(

View file

@ -18,7 +18,7 @@ New features:
and `min_width` options if no local imaging backend is available. :bug:`1460`
* The `move` command has a new `-p/--pretend` option, making the command show
how the items will be moved, without modifying the files on disk.
* The importer now supports matching of pregap tracks in releases.
Fixes:

View file

@ -233,7 +233,10 @@ A boolean controlling the track numbering style on multi-disc releases. By
default (``per_disc_numbering: no``), tracks are numbered per-release, so the
first track on the second disc has track number N+1 where N is the number of
tracks on the first disc. If this ``per_disc_numbering`` is enabled, then the
first track on each disc always has track number 1.
first track on each disc always has track number 1. This is true even when the
disc has pregap tracks, typically numbered 0 - in that case, the pregap track
of the first disc has track number 1 and every other track has its original
track number plus one.
If you enable ``per_disc_numbering``, you will likely want to change your
:ref:`path-format-config` also to include ``$disc`` before ``$track`` to make