musixmatch-master/musixmatch/lyrics.py
Go to the documentation of this file.
1 """
2 This module contains higher level classes to query Musixmatch API and build
3 simple dictionary-like objects representing a track lyrics.
4 
5 >>> from musixmatch.lyrics import Lyrics
6 >>> import musixmatch.api
7 >>>
8 >>> try:
9 ... lyrics = Lyrics(lyrics_id=292)
10 ... except musixmatch.api.Error, e:
11 ... pass
12 """
13 import musixmatch
14 __license__ = musixmatch.__license__
15 __author__ = musixmatch.__author__
16 
17 from musixmatch.base import Item
18 from musixmatch.ws import track
19 
20 class Lyrics(Item):
21  """
22  This class builds a :py:class:`dict` object representing a the lyrics of a
23  track. It can get lyrics through the :py:class:`musixmatch.api.Method`
24  **track.lyrics.get** or from an already well-formed :py:class:`dict`.
25  Create a Track object based on a given keyword argument:
26 
27  :param track_id: musiXmatch track ID
28  :param musicbrainz_id: Musicbrainz track ID
29  :param track_echonest_id: Echonest track ID
30  :param lyrics_data: an already well-formed :py:class:`dict` of track data
31  :raises: :py:class:`musixmatch.api.Error` if :py:class:`musixmatch.api.ResponseStatusCode` is not 200
32 
33  Once information are collected, the following keys are available:
34 
35  :keyword lyrics_body: the lyrics text
36  :keyword lyrics_id: the Musixmatch lyrics id
37  :keyword lyrics_language: the lyrics language
38  :keyword lyrics_copyright: the lyrics copyright statement
39  :keyword pixel_tracking_url: the pixel tracking url
40  :keyword script_tracking_url: the script tracking url
41  """
42  __api_method__ = track.lyrics.get
43