musixmatch-master/musixmatch/subtitle.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 subtitle.
4 
5 >>> from musixmatch.subtitle import Subtitle
6 >>> import musixmatch.api
7 >>>
8 >>> try:
9 ... subtitle = Subtitle(subtitle_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 Subtitle(Item):
21  """
22  This class builds a :py:class:`dict` object representing a subtitle of a
23  track. It can get subtitle through the :py:class:`musixmatch.api.Method`
24  **track.subtitle.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 subtitle_data: an already well-formed :py:class:`dict` of track data
31  :raises: :py:class:`musixmatch.api.Error` if :py:class:`musixmatch.api.StatusCode` is not 200
32 
33  Once information are collected, the following keys are available:
34 
35  :keyword subtitle_body: the subtitle text
36  :keyword subtitle_id: the Musixmatch subtitle id
37  :keyword subtitle_language: the subtitle language
38  """
39  __api_method__ = track.subtitle.get
40