Add deezer.rst doc, remove unused options

This commit is contained in:
Rahul Ahuja 2019-09-01 18:33:27 -07:00
parent 804397bb12
commit 2cf55ee893
2 changed files with 45 additions and 25 deletions

View file

@ -38,19 +38,7 @@ class DeezerPlugin(BeetsPlugin):
def __init__(self):
super(DeezerPlugin, self).__init__()
self.config.add(
{
'mode': 'list',
'tiebreak': 'popularity',
'show_failures': False,
'artist_field': 'albumartist',
'album_field': 'album',
'track_field': 'title',
'region_filter': None,
'regex': [],
'source_weight': 0.5,
}
)
self.config.add({'source_weight': 0.5})
def _get_deezer_id(self, url_type, id_):
"""Parse a Deezer ID from its URL if necessary.
@ -103,9 +91,9 @@ class DeezerPlugin(BeetsPlugin):
u"by Deezer API: '{}'".format(release_date)
)
tracks_data = requests.get(
self.album_url + deezer_id + '/tracks'
).json()['data']
tracks_data = requests.get(self.album_url + deezer_id + '/tracks').json()[
'data'
]
tracks = []
medium_totals = collections.defaultdict(int)
for i, track_data in enumerate(tracks_data):
@ -255,9 +243,7 @@ class DeezerPlugin(BeetsPlugin):
query_filters = {'album': album}
if not va_likely:
query_filters['artist'] = artist
response_data = self._search_deezer(
query_type='album', filters=query_filters
)
response_data = self._search_deezer(query_type='album', filters=query_filters)
if response_data is None:
return []
return [
@ -326,9 +312,7 @@ class DeezerPlugin(BeetsPlugin):
if no search results are returned.
:rtype: dict or None
"""
query = self._construct_search_query(
keywords=keywords, filters=filters
)
query = self._construct_search_query(keywords=keywords, filters=filters)
if not query:
return None
self._log.debug(u"Searching Deezer for '{}'".format(query))
@ -336,7 +320,5 @@ class DeezerPlugin(BeetsPlugin):
self.search_url + query_type, params={'q': query}
).json()
num_results = len(response_data['data'])
self._log.debug(
u"Found {} results from Deezer for '{}'", num_results, query
)
self._log.debug(u"Found {} results from Deezer for '{}'", num_results, query)
return response_data if num_results > 0 else None

38
docs/plugins/deezer.rst Normal file
View file

@ -0,0 +1,38 @@
Spotify Plugin
==============
The ``deezer`` plugin provides metadata matches for the importer using the
`Deezer_` `Album`_ and `Track`_ APIs.
.. _Deezer: https://www.deezer.com
.. _Album: https://developers.deezer.com/api/album
.. _Track: https://developers.deezer.com/api/track
Why Use This Plugin?
--------------------
* You're a Beets user.
* You want to autotag music with metadata from the Deezer API.
Basic Usage
-----------
First, enable the ``deezer`` plugin (see :ref:`using-plugins`).
You can enter the URL for an album or song on Deezer at the ``enter Id``
prompt during import::
Enter search, enter Id, aBort, eDit, edit Candidates, plaY? i
Enter release ID: https://www.deezer.com/en/album/572261
Configuration
-------------
Put these options in config.yaml under the ``deezer:`` section:
- **source_weight**: Penalty applied to Spotify matches during import. Set to
0.0 to disable.
Default: ``0.5``.
Here's an example::
deezer:
source_weight: 0.7