Skip to content

Movida Resource: Audio Track

Luismi Cavalle edited this page Nov 6, 2013 · 19 revisions

Introduction

The Audio Track resource represents an audio track within a Movida Resource: Rendition. For instance, a specific rendition could have multiple audio tracks (Original Version, Dubbed Version and Original Version in Dolby Digital). It is assumed that Audio tracks are contained within a Movida Resource: Rendition and are not separate audio files, although this could change in the future.

This is how an Audio Track looks like through the API:

<?xml version='1.0' encoding='utf-8' ?>
 <audio-track>
   <id type="integer">16</id>
   <language>eng</language>
   <original-version type="boolean">true</original-version>
   <encoding>WMA9</encoding>
   <mix-type>Dolby Digital</mix-type>
   <channels>5.1</channels>
   <link href="http://movida.example.com/api/audio_tracks/16" rel="self"/>
 </audio-track>

GET a list for all audio tracks for a rendition

Audio Track are accessed via the Rendition they belong to, as in the example below, through the link identified by the rel="audio_tracks" attribute. Refer to the Movida Resource: Rendition page to find out how to access a Rendition.

<?xml version='1.0' encoding='utf-8' ?>
<rendition>
 <!-- ... -->
 <link rel="audio_tracks" href="http://movida.example.com/api/renditions/39/audio_tracks"/>
 <!-- ... -->
</rendition>

If we follow that link, we can fetch the list of all audio tracks for that rendition.

$ curl --digest -u roboot_user:password https://movida.example.com/api/renditions/39/audio_tracks
<?xml version="1.0" encoding="UTF-8"?>
<audio-tracks type="array">
  <audio-track>
    <id type="integer">16</id>
    <language>eng</language>
    <original-version type="boolean">true</original-version>
    <encoding>WMA9</encoding>
    <mix-type>Dolby Digital</mix-type>
    <channels>5.1</channels>
    <link href="http://www.example.com/api/audio_tracks/16" rel="self"/>
  </audio-track>
  <audio-track>
    <id type="integer">17</id>
    <language>eng</language>
    <original-version type="boolean">true</original-version>
    <encoding>WMA9</encoding>
    <mix-type>Dolby Digital</mix-type>
    <channels>5.1</channels>
    <link href="http://www.example.com/api/audio_tracks/17" rel="self"/>
  </audio-track>
</audio-tracks>

Get a specific audio track

This how you recover information about a specific audio track.

$ curl --digest -u roboot_user:password https://movida.example.com/api/audio_tracks/17
<?xml version="1.0" encoding="UTF-8"?>
<audio-track>
  <id type="integer">17</id>
  <language>eng</language>
  <original-version type="boolean">true</original-version>
  <encoding>WMA9</encoding>
  <mix-type>Dolby Digital</mix-type>
  <channels>5.1</channels>
  <link href="http://www.example.com/api/audio_tracks/17" rel="self"/>
</audio-track>

Creating audio tracks for a rendition

To create an audio track, you just need to POST a proper XML Audio Track representation (similar to the ones you get when fetching an audio track) to the proper URL. As explained above, that URL is in the link node whose 'rel' attribute equals 'audio_tracks'.

For example, this POST would create an audio track (we’ll use curl’s @ option, which reads data to be posted from a file):

cat audio_track.xml
<audio-track>
  <language>eng</language>
  <original-version type="boolean">true</original-version>
  <encoding>WMA9</encoding>
  <mix-type>Dolby Digital</mix-type>
  <channels>5.1</channels>
</audio-track>
$ curl --digest -u robot_user:password -H "Content-Type: application/xml" -X POST -d @audio_track.xml "https://movida.example.com/api/renditions/39/audio_tracks"

Movida will return the full XML of the audio track just created:

<?xml version="1.0" encoding="UTF-8"?>
<audio-track>
  <id type="integer">17</id>
  <language>eng</language>
  <original-version type="boolean">true</original-version>
  <encoding>WMA9</encoding>
  <mix-type>Dolby Digital</mix-type>
  <channels>5.1</channels>
  <link href="http://www.example.com/api/audio_tracks/17" rel="self"/>
</audio-track>

Updating an audio track

As our Introduction and Conventions page suggests, you can update an audio track issuing a PUT request to a given audio track URI:

cat audio_track_update.xml
<audio-track>
  <language>spa</language>
  <original-version>false</original-version>
  <channels>Stereo</channels>
</audio-track>
curl --digest -u robot_user:password -H "Content-Type: application/xml" -X PUT -d @audio_track_update.xml "https://movida.example.com/api/audio_tracks/17"

As always Movida will return the full XML of the audio track just updated:

<?xml version="1.0" encoding="UTF-8"?>
<audio-track>
  <id type="integer">17</id>
  <language>spa</language>
  <original-version type="boolean">false</original-version>
  <encoding>WMA9</encoding>
  <mix-type>Dolby Digital</mix-type>
  <channels>Stereo</channels>
  <link href="http://www.example.com/api/audio_tracks/17" rel="self"/>
</audio-track>

Deleting an audio track

You can also delete an audio track using DELETE request to each audio track URI:

curl --digest -u robot_user:password -X DELETE "https://movida.example.com/api/audio_tracks/17"

Valid Attributes

The 'language' attribute is validated and mandatory. List of possible languages as per ISO ISO 639-2/T codes by name. See http://en.wikipedia.org/wiki/List_of_ISO_639-2_codes.

Clone this wiki locally