Importer metadata source is set as a field

TrackInfo and AlbumInfo were already keeping track of this,
so just had to add it as an actual field to Item and Album

See #1311
This commit is contained in:
Tom Jaspers 2015-02-10 18:17:37 +01:00
parent 54abd1a510
commit 228e5c0432
4 changed files with 12 additions and 1 deletions

View file

@ -42,6 +42,8 @@ def apply_item_metadata(item, track_info):
item.mb_trackid = track_info.track_id
if track_info.artist_id:
item.mb_artistid = track_info.artist_id
if track_info.data_source:
item.data_source = track_info.data_source
# At the moment, the other metadata is left intact (including album
# and track number). Perhaps these should be emptied?
@ -125,7 +127,8 @@ def apply_metadata(album_info, mapping):
'language',
'country',
'albumstatus',
'albumdisambig'):
'albumdisambig',
'data_source',):
value = getattr(album_info, field)
if value is not None:
item[field] = value

View file

@ -137,6 +137,8 @@ class TrackInfo(object):
- ``artist_sort``: name of the track artist for sorting
- ``disctitle``: name of the individual medium (subtitle)
- ``artist_credit``: Recording-specific artist name
- ``data_source``: The original data source (MusicBrainz, Discogs, etc.)
- ``data_url``: The data source release URL.
Only ``title`` and ``track_id`` are required. The rest of the fields
may be None. The indices ``index``, ``medium``, and ``medium_index``

View file

@ -161,6 +161,7 @@ def track_info(recording, index=None, medium=None, medium_index=None,
medium=medium,
medium_index=medium_index,
medium_total=medium_total,
data_source='MusicBrainz',
data_url=track_url(recording['id']),
)

View file

@ -388,6 +388,8 @@ class Item(LibModel):
'channels': types.INTEGER,
'mtime': DateType(),
'added': DateType(),
'data_source': types.STRING,
}
_search_fields = ('artist', 'title', 'comments',
@ -790,6 +792,8 @@ class Album(LibModel):
'original_year': types.PaddedInt(4),
'original_month': types.PaddedInt(2),
'original_day': types.PaddedInt(2),
'data_source': types.STRING,
}
_search_fields = ('album', 'albumartist', 'genre')
@ -832,6 +836,7 @@ class Album(LibModel):
'original_year',
'original_month',
'original_day',
'data_source',
]
"""List of keys that are set on an album's items.
"""