Basic getters functions

We provide "wrappers" to access the fields inside the HDF5 song files. The list of fields inside each song file can be found here or in the FAQ.
We focus on the python wrapper. There are 3 steps to access a field, as for any file-like object:

  1. open the song file
  2. read field(s)
  3. close song file

Using python file:, it becomes (to get the title of the song, for instance):

  1. h5 = hdf5_getters.open_h5_file_read(path)
  2. title = hdf5_getters.get_title(h5)
  3. h5.close()

in iPython, it gives:

In [5]: h5 = hdf5_getters.open_h5_file_read('TRAXLZU12903D05F94.h5')
In [6]: hdf5_getters.get_artist_name(h5)
Out[6]: 'Rick Astley'
In [7]: h5.close()

In Matlab, the getters are in a class, so the calls are slightly different:

>> h5 = HDF5_Song_File_Reader('TRAXLZU12903D05F94.h5');
>> h5.get_artist_name()
ans =
Rick Astley
>> clear h5;

Back to python, if you want to know all the getters that are in, do:

In [16]: filter(lambda x: x[:3] == 'get',hdf5_getters.__dict__.keys())

Note that there is a special getter, 'get_num_songs()'. If you have a regular song file, the answer should always be one. Song files can actually hold the data for many songs, see 'song / aggregate /summary files' in the FAQ for details. You can ignore that fact for the moment, simply remember that 'num_songs' is not an attribute of the track or the artist.