Package pyechonest :: Module song :: Class Song
[hide private]
[frames] | no frames]

Class Song

source code


A Song object

Attributes:

id (str): Echo Nest Song ID

title (str): Song Title

artist_name (str): Artist Name

artist_id (str): Artist ID

audio_summary (dict): An Audio Summary dict

song_hotttnesss (float): A float representing a song's hotttnesss

artist_hotttnesss (float): A float representing a song's parent artist's hotttnesss

artist_familiarity (float): A float representing a song's parent artist's familiarity

artist_location (dict): A dictionary of strings specifying a song's parent artist's location, lattitude and longitude

Create a song object like so:

>>> s = song.Song('SOPEXHZ12873FD2AC7')
Instance Methods [hide private]
 
__init__(self, id, buckets=None, **kwargs)
Song class
source code
 
__repr__(self)
repr(x)
source code
 
__str__(self)
str(x)
source code
 
get_audio_summary(self, cache=True)
Get an audio summary of a song containing mode, tempo, key, duration, time signature, loudness, danceability, energy, and analysis_url.
source code
 
get_song_hotttnesss(self, cache=True)
Get our numerical description of how hottt a song currently is
source code
 
get_artist_hotttnesss(self, cache=True)
Get our numerical description of how hottt a song's artist currently is
source code
 
get_artist_familiarity(self, cache=True)
Get our numerical estimation of how familiar a song's artist currently is to the world
source code
 
get_artist_location(self, cache=True)
Get the location of a song's artist.
source code
 
get_foreign_id(self, idspace='', cache=True)
Get the foreign id for this song for a specific id space
source code
 
get_tracks(self, catalog, cache=True)
Get the tracks for a song given a catalog.
source code
 
get_song_type(self, cache=True)
Get the types of a song.
source code

Inherited from proxies.SongProxy: get_attribute

Inherited from proxies.GenericProxy: post_attribute

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Properties [hide private]
  audio_summary
Get an audio summary of a song containing mode, tempo, key, duration, time signature, loudness, danceability, energy, and analysis_url.
  song_hotttnesss
Get our numerical description of how hottt a song currently is
  artist_hotttnesss
Get our numerical description of how hottt a song's artist currently is
  artist_familiarity
Get our numerical estimation of how familiar a song's artist currently is to the world
  artist_location
Get the location of a song's artist.
  song_type
Get the types of a song.

Inherited from object: __class__

Method Details [hide private]

__init__(self, id, buckets=None, **kwargs)
(Constructor)

source code 

Song class

Args:
id (str): a song ID
Kwargs:
buckets (list): A list of strings specifying which buckets to retrieve
Returns:
A Song object

Example:

>>> s = song.Song('SOPEXHZ12873FD2AC7', buckets=['song_hotttnesss', 'artist_hotttnesss'])
>>> s.song_hotttnesss
0.58602500000000002
>>> s.artist_hotttnesss
0.80329715999999995
>>>
Overrides: object.__init__

__repr__(self)
(Representation operator)

source code 
repr(x)
Overrides: object.__repr__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 
str(x)
Overrides: object.__str__
(inherited documentation)

get_audio_summary(self, cache=True)

source code 

Get an audio summary of a song containing mode, tempo, key, duration, time signature, loudness, danceability, energy, and analysis_url.

Args:

Kwargs:
cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True.
Returns:
A dictionary containing mode, tempo, key, duration, time signature, loudness, danceability, energy and analysis_url keys.
Example:
>>> s = song.Song('SOGNMKX12B0B806320')
>>> s.audio_summary
{u'analysis_url': u'https://echonest-analysis.s3.amazonaws.com:443/TR/TRCPUOG123E85891F2/3/full.json?Signature=wcML1ZKsl%2F2FU4k68euHJcF7Jbc%3D&Expires=1287518562&AWSAccessKeyId=AKIAIAFEHLM3KJ2XMHRA',
 u'danceability': 0.20964757782725996,
 u'duration': 472.63301999999999,
 u'energy': 0.64265230549809549,
 u'key': 0,
 u'loudness': -9.6820000000000004,
 u'mode': 1,
 u'tempo': 126.99299999999999,
 u'time_signature': 4}
>>>

get_song_hotttnesss(self, cache=True)

source code 

Get our numerical description of how hottt a song currently is

Args:

Kwargs:
cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True.
Returns:
A float representing hotttnesss.
Example:
>>> s = song.Song('SOLUHKP129F0698D49')
>>> s.get_song_hotttnesss()
0.57344379999999995
>>> s.song_hotttnesss
0.57344379999999995
>>>

get_artist_hotttnesss(self, cache=True)

source code 

Get our numerical description of how hottt a song's artist currently is

Args:

Kwargs:
cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True.
Returns:
A float representing hotttnesss.
Example:
>>> s = song.Song('SOOLGAZ127F3E1B87C')
>>> s.artist_hotttnesss
0.45645633000000002
>>> s.get_artist_hotttnesss()
0.45645633000000002
>>>

get_artist_familiarity(self, cache=True)

source code 

Get our numerical estimation of how familiar a song's artist currently is to the world

Args:
cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True.
Returns:
A float representing familiarity.
Example:
>>> s = song.Song('SOQKVPH12A58A7AF4D')
>>> s.get_artist_familiarity()
0.639626025843539
>>> s.artist_familiarity
0.639626025843539
>>>

get_artist_location(self, cache=True)

source code 

Get the location of a song's artist.

Args:
cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True.
Returns:
An artist location object.
Example:
>>> s = song.Song('SOQKVPH12A58A7AF4D')
>>> s.artist_location
{u'latitude': 34.053489999999996, u'location': u'Los Angeles, CA', u'longitude': -118.24532000000001}
>>>

get_foreign_id(self, idspace='', cache=True)

source code 

Get the foreign id for this song for a specific id space

Args:

Kwargs:
idspace (str): A string indicating the idspace to fetch a foreign id for.
Returns:
A foreign ID string

Example:

>>> s = song.Song('SOYRVMR12AF729F8DC')
>>> s.get_foreign_id('CAGPXKK12BB06F9DE9')
>>>

get_tracks(self, catalog, cache=True)

source code 

Get the tracks for a song given a catalog.

Args:
catalog (str): a string representing the catalog whose track you want to retrieve.
Returns:
A list of Track dicts.
Example:
>>> s = song.Song('SOWDASQ12A6310F24F')
>>> s.get_tracks('7digital')[0]
{u'catalog': u'7digital',
 u'foreign_id': u'7digital:track:8445818',
 u'id': u'TRJGNNY12903CC625C',
 u'preview_url': u'http://previews.7digital.com/clips/34/8445818.clip.mp3',
 u'release_image': u'http://cdn.7static.com/static/img/sleeveart/00/007/628/0000762838_200.jpg'}
>>>

get_song_type(self, cache=True)

source code 

Get the types of a song.

Args:
cache (boolean): A boolean indicating whether or not the cached value should be used (if available). Defaults to True.
Returns:
A list of strings, each representing a song type: 'christmas', for example.
Example:
>>> s = song.Song('SOQKVPH12A58A7AF4D')
>>> s.song_type
[u'christmas']
>>>

Property Details [hide private]

audio_summary

Get an audio summary of a song containing mode, tempo, key, duration, time signature, loudness, danceability, energy, and analysis_url.

Args:

Kwargs:
cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True.
Returns:
A dictionary containing mode, tempo, key, duration, time signature, loudness, danceability, energy and analysis_url keys.
Example:
>>> s = song.Song('SOGNMKX12B0B806320')
>>> s.audio_summary
{u'analysis_url': u'https://echonest-analysis.s3.amazonaws.com:443/TR/TRCPUOG123E85891F2/3/full.json?Signature=wcML1ZKsl%2F2FU4k68euHJcF7Jbc%3D&Expires=1287518562&AWSAccessKeyId=AKIAIAFEHLM3KJ2XMHRA',
 u'danceability': 0.20964757782725996,
 u'duration': 472.63301999999999,
 u'energy': 0.64265230549809549,
 u'key': 0,
 u'loudness': -9.6820000000000004,
 u'mode': 1,
 u'tempo': 126.99299999999999,
 u'time_signature': 4}
>>>
Get Method:
get_audio_summary(self, cache=True) - Get an audio summary of a song containing mode, tempo, key, duration, time signature, loudness, danceability, energy, and analysis_url.

song_hotttnesss

Get our numerical description of how hottt a song currently is

Args:

Kwargs:
cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True.
Returns:
A float representing hotttnesss.
Example:
>>> s = song.Song('SOLUHKP129F0698D49')
>>> s.get_song_hotttnesss()
0.57344379999999995
>>> s.song_hotttnesss
0.57344379999999995
>>>
Get Method:
get_song_hotttnesss(self, cache=True) - Get our numerical description of how hottt a song currently is

artist_hotttnesss

Get our numerical description of how hottt a song's artist currently is

Args:

Kwargs:
cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True.
Returns:
A float representing hotttnesss.
Example:
>>> s = song.Song('SOOLGAZ127F3E1B87C')
>>> s.artist_hotttnesss
0.45645633000000002
>>> s.get_artist_hotttnesss()
0.45645633000000002
>>>
Get Method:
get_artist_hotttnesss(self, cache=True) - Get our numerical description of how hottt a song's artist currently is

artist_familiarity

Get our numerical estimation of how familiar a song's artist currently is to the world

Args:
cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True.
Returns:
A float representing familiarity.
Example:
>>> s = song.Song('SOQKVPH12A58A7AF4D')
>>> s.get_artist_familiarity()
0.639626025843539
>>> s.artist_familiarity
0.639626025843539
>>>
Get Method:
get_artist_familiarity(self, cache=True) - Get our numerical estimation of how familiar a song's artist currently is to the world

artist_location

Get the location of a song's artist.

Args:
cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True.
Returns:
An artist location object.
Example:
>>> s = song.Song('SOQKVPH12A58A7AF4D')
>>> s.artist_location
{u'latitude': 34.053489999999996, u'location': u'Los Angeles, CA', u'longitude': -118.24532000000001}
>>>
Get Method:
get_artist_location(self, cache=True) - Get the location of a song's artist.

song_type

Get the types of a song.

Args:
cache (boolean): A boolean indicating whether or not the cached value should be used (if available). Defaults to True.
Returns:
A list of strings, each representing a song type: 'christmas', for example.
Example:
>>> s = song.Song('SOQKVPH12A58A7AF4D')
>>> s.song_type
[u'christmas']
>>>
Get Method:
get_song_type(self, cache=True) - Get the types of a song.