From 3e624ea884a2a7bd0308e85f6ee35ee16b263480 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Fri, 8 Feb 2013 13:45:31 -0800 Subject: [PATCH] original_date config option (GC-441) --- beets/autotag/__init__.py | 20 +++++++++++++++----- beets/config_default.yaml | 1 + docs/changelog.rst | 12 ++++++++++++ docs/reference/config.rst | 11 +++++++++++ 4 files changed, 39 insertions(+), 5 deletions(-) diff --git a/beets/autotag/__init__.py b/beets/autotag/__init__.py index 98431d1e9..3e2290104 100644 --- a/beets/autotag/__init__.py +++ b/beets/autotag/__init__.py @@ -178,11 +178,21 @@ def apply_metadata(album_info, mapping): item.albumartist_credit = album_info.artist_credit # Release date. - for key in ('year', 'month', 'day', - 'original_year', 'original_month', 'original_day'): - value = getattr(album_info, key) - if value: - setattr(item, key, value) + for prefix in '', 'original_': + if config['original_date'] and not prefix: + # Ignore specific release date. + continue + + for suffix in 'year', 'month', 'day': + key = prefix + suffix + value = getattr(album_info, key) + if value: + setattr(item, key, value) + if config['original_date']: + # If we're using original release date for both + # fields, set item.year = info.original_year, + # etc. + setattr(item, suffix, value) # Title. item.title = track_info.title diff --git a/beets/config_default.yaml b/beets/config_default.yaml index 1520cfe54..a466a63ef 100644 --- a/beets/config_default.yaml +++ b/beets/config_default.yaml @@ -38,6 +38,7 @@ timeout: 5.0 per_disc_numbering: no verbose: no terminal_encoding: utf8 +original_date: no ui: terminal_width: 80 diff --git a/docs/changelog.rst b/docs/changelog.rst index 716cd4b48..9b73214e5 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -4,6 +4,14 @@ Changelog 1.1b2 (in development) ---------------------- +This version introduces one **change to the default behavior** that you should +be aware of. Previously, when importing new albums matched in MusicBrainz, the +date fields (``year``, ``month``, and ``day``) would be set to the release date +of the *original* version of the album, as opposed to the specific date of the +release selected. Now, these fields reflect the specific release and +``original_year``, etc., reflect the earlier release date. If you want the old +behavior, just set :ref:`original_date` to true in your config file. + New configuration options: * :ref:`default_action` lets you determine the default (just-hit-return) option @@ -13,6 +21,10 @@ New configuration options: * :ref:`max_rec` lets you define a maximum recommendation for albums with missing/extra tracks or differing track lengths/numbers. Thanks again to Tai Lee. +* :ref:`original_date` determines whether, when importing new albums, the + ``year``, ``month``, and ``day`` fields should reflect the specific (e.g., + reissue) release date or the original release date. Note that the original + release date is always available as ``original_year``, etc. * :ref:`clutter` controls which files should be ignored when cleaning up empty directories. Thanks to Steinþór Pálsson. * :doc:`/plugins/lastgenre`: A new configuration option lets you choose to diff --git a/docs/reference/config.rst b/docs/reference/config.rst index 6b89a514b..9417692de 100644 --- a/docs/reference/config.rst +++ b/docs/reference/config.rst @@ -149,6 +149,17 @@ Format to use when listing *albums* with :ref:`list-cmd` and other commands. Defaults to ``$albumartist - $album``. The ``-f`` command-line option overrides this setting. +.. _original_date: + +original_date +~~~~~~~~~~~~~ + +Either ``yes`` or ``no``, indicating whether matched albums should have their +``year``, ``month``, and ``day`` fields set to the release date of the +*original* version of an album rather than the selected version of the release. +That is, if this option is turned on, then ``year`` will always equal +``original_year`` and so on. Default: ``no``. + .. _per_disc_numbering: per_disc_numbering