Skip to content

Commit

Permalink
Add support for the OriginalDate tag
Browse files Browse the repository at this point in the history
See https://picard.musicbrainz.org/docs/mappings/

This tag is useful when the user would like all releases of the same
album to be sorted next to each other.
  • Loading branch information
tremby committed Apr 20, 2017
1 parent f85d4d2 commit b365ac9
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/db/plugins/ProxyDatabasePlugin.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ static constexpr struct {
{ TAG_NAME, MPD_TAG_NAME },
{ TAG_GENRE, MPD_TAG_GENRE },
{ TAG_DATE, MPD_TAG_DATE },
#if LIBMPDCLIENT_CHECK_VERSION(2,12,0)
{ TAG_ORIGINAL_DATE, MPD_TAG_ORIGINAL_DATE },
#endif
{ TAG_COMPOSER, MPD_TAG_COMPOSER },
{ TAG_PERFORMER, MPD_TAG_PERFORMER },
{ TAG_COMMENT, MPD_TAG_COMMENT },
Expand Down
5 changes: 5 additions & 0 deletions src/output/plugins/HaikuOutputPlugin.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include "system/Error.hxx"
#include "Log.hxx"

#include <mpd/client.h>

#include <AppFileInfo.h>
#include <Application.h>
#include <Bitmap.h>
Expand Down Expand Up @@ -395,6 +397,9 @@ HaikuOutput::SendTag(const Tag &tag)
break;
case TAG_GENRE:
case TAG_DATE:
#if LIBMPDCLIENT_CHECK_VERSION(2,12,0)
case TAG_ORIGINAL_DATE:
#endif
case TAG_PERFORMER:
case TAG_COMMENT:
case TAG_DISC:
Expand Down
12 changes: 12 additions & 0 deletions src/tag/Id3Scan.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include "util/StringUtil.hxx"
#include "Log.hxx"

#include <mpd/client.h>

#include <id3tag.h>

#include <string>
Expand Down Expand Up @@ -55,6 +57,12 @@
#define ID3_FRAME_ALBUM_ARTIST "TPE2"
#endif

#if LIBMPDCLIENT_CHECK_VERSION(2,12,0)
#ifndef ID3_FRAME_ORIGINAL_RELEASE_DATE
#define ID3_FRAME_ORIGINAL_RELEASE_DATE "TDOR"
#endif
#endif

gcc_pure
static id3_utf8_t *
tag_id3_getstring(const struct id3_frame *frame, unsigned i)
Expand Down Expand Up @@ -317,6 +325,10 @@ scan_id3_tag(struct id3_tag *tag,
handler, handler_ctx);
tag_id3_import_text(tag, ID3_FRAME_YEAR, TAG_DATE,
handler, handler_ctx);
#if LIBMPDCLIENT_CHECK_VERSION(2,12,0)
tag_id3_import_text(tag, ID3_FRAME_ORIGINAL_RELEASE_DATE, TAG_ORIGINAL_DATE,
handler, handler_ctx);
#endif
tag_id3_import_text(tag, ID3_FRAME_GENRE, TAG_GENRE,
handler, handler_ctx);
tag_id3_import_text(tag, ID3_FRAME_COMPOSER, TAG_COMPOSER,
Expand Down
5 changes: 5 additions & 0 deletions src/tag/Names.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include "config.h"
#include "Type.h"

#include <mpd/client.h>

const char *const tag_item_names[TAG_NUM_OF_ITEM_TYPES] = {
[TAG_ARTIST] = "Artist",
[TAG_ARTIST_SORT] = "ArtistSort",
Expand All @@ -32,6 +34,9 @@ const char *const tag_item_names[TAG_NUM_OF_ITEM_TYPES] = {
[TAG_NAME] = "Name",
[TAG_GENRE] = "Genre",
[TAG_DATE] = "Date",
#if LIBMPDCLIENT_CHECK_VERSION(2,12,0)
[TAG_ORIGINAL_DATE] = "OriginalDate",
#endif
[TAG_COMPOSER] = "Composer",
[TAG_PERFORMER] = "Performer",
[TAG_COMMENT] = "Comment",
Expand Down
1 change: 1 addition & 0 deletions src/tag/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ enum TagType
TAG_NAME,
TAG_GENRE,
TAG_DATE,
TAG_ORIGINAL_DATE,
TAG_COMPOSER,
TAG_PERFORMER,
TAG_COMMENT,
Expand Down

0 comments on commit b365ac9

Please sign in to comment.