Adding styles to discogs plugin

This commit is contained in:
Peter Koondial 2019-05-05 11:11:27 +02:00
parent 4d55e6dfbb
commit 8fcff5ddc7
4 changed files with 14 additions and 2 deletions

View file

@ -155,6 +155,7 @@ def apply_metadata(album_info, mapping):
'script',
'language',
'country',
'style',
'albumstatus',
'albumdisambig',
'releasegroupdisambig',

View file

@ -131,6 +131,7 @@ match:
track_index: 1.0
track_length: 2.0
track_id: 5.0
style: 5.0
preferred:
countries: []
media: []

View file

@ -436,6 +436,7 @@ class Item(LibModel):
'albumartist_sort': types.STRING,
'albumartist_credit': types.STRING,
'genre': types.STRING,
'style': types.STRING,
'lyricist': types.STRING,
'composer': types.STRING,
'composer_sort': types.STRING,
@ -495,7 +496,7 @@ class Item(LibModel):
}
_search_fields = ('artist', 'title', 'comments',
'album', 'albumartist', 'genre')
'album', 'albumartist')
_types = {
'data_source': types.STRING,
@ -915,6 +916,7 @@ class Album(LibModel):
'albumartist_credit': types.STRING,
'album': types.STRING,
'genre': types.STRING,
'style': types.STRING,
'year': types.PaddedInt(4),
'month': types.PaddedInt(2),
'day': types.PaddedInt(2),

View file

@ -302,6 +302,13 @@ class DiscogsPlugin(BeetsPlugin):
mediums = [t.medium for t in tracks]
country = result.data.get('country')
data_url = result.data.get('uri')
style = result.data.get('styles')
if style is None:
self._log.info('Style not Found')
elif len(style) == 0:
return style
else:
style = ' - '.join(sorted(style))
# Extract information for the optional AlbumInfo fields that are
# contained on nested discogs fields.
@ -339,7 +346,8 @@ class DiscogsPlugin(BeetsPlugin):
day=None, label=label, mediums=len(set(mediums)),
artist_sort=None, releasegroup_id=master_id,
catalognum=catalogno, script=None, language=None,
country=country, albumstatus=None, media=media,
country=country, style=style,
albumstatus=None, media=media,
albumdisambig=None, artist_credit=None,
original_year=original_year, original_month=None,
original_day=None, data_source='Discogs',