Mercurial > hg > pmhd
annotate musixmatch-master/build/lib/musixmatch/subtitle.py @ 13:844d341cf643 tip
Back up before ISMIR
author | Yading Song <yading.song@eecs.qmul.ac.uk> |
---|---|
date | Thu, 31 Oct 2013 13:17:06 +0000 |
parents | 8c29444cb5fd |
children |
rev | line source |
---|---|
yading@7 | 1 """ |
yading@7 | 2 This module contains higher level classes to query Musixmatch API and build |
yading@7 | 3 simple dictionary-like objects representing a track subtitle. |
yading@7 | 4 |
yading@7 | 5 >>> from musixmatch.subtitle import Subtitle |
yading@7 | 6 >>> import musixmatch.api |
yading@7 | 7 >>> |
yading@7 | 8 >>> try: |
yading@7 | 9 ... subtitle = Subtitle(subtitle_id=292) |
yading@7 | 10 ... except musixmatch.api.Error, e: |
yading@7 | 11 ... pass |
yading@7 | 12 """ |
yading@7 | 13 import musixmatch |
yading@7 | 14 __license__ = musixmatch.__license__ |
yading@7 | 15 __author__ = musixmatch.__author__ |
yading@7 | 16 |
yading@7 | 17 from musixmatch.base import Item |
yading@7 | 18 from musixmatch.ws import track |
yading@7 | 19 |
yading@7 | 20 class Subtitle(Item): |
yading@7 | 21 """ |
yading@7 | 22 This class builds a :py:class:`dict` object representing a subtitle of a |
yading@7 | 23 track. It can get subtitle through the :py:class:`musixmatch.api.Method` |
yading@7 | 24 **track.subtitle.get** or from an already well-formed :py:class:`dict`. |
yading@7 | 25 Create a Track object based on a given keyword argument: |
yading@7 | 26 |
yading@7 | 27 :param track_id: musiXmatch track ID |
yading@7 | 28 :param musicbrainz_id: Musicbrainz track ID |
yading@7 | 29 :param track_echonest_id: Echonest track ID |
yading@7 | 30 :param subtitle_data: an already well-formed :py:class:`dict` of track data |
yading@7 | 31 :raises: :py:class:`musixmatch.api.Error` if :py:class:`musixmatch.api.StatusCode` is not 200 |
yading@7 | 32 |
yading@7 | 33 Once information are collected, the following keys are available: |
yading@7 | 34 |
yading@7 | 35 :keyword subtitle_body: the subtitle text |
yading@7 | 36 :keyword subtitle_id: the Musixmatch subtitle id |
yading@7 | 37 :keyword subtitle_language: the subtitle language |
yading@7 | 38 """ |
yading@7 | 39 __api_method__ = track.subtitle.get |
yading@7 | 40 |