Skip to content

Movida Resource: Audio Track

rnaveiras edited this page Apr 12, 2012 · 19 revisions

Introduction

The Audio Track resource represents todo

This is how an Audio Track looks 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 a Rendition. Refer to the Movida Resource: Rendition page to find out how to access a Rendition. Inside a Rendition, one of the related link nodes identified by the rel attribute: Like here:

<?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'd 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 a good way to recover information about a specific subtitle.

$ 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

For create 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. That URL can be found in a link whose rel is 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 subtitle 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 suggests, you can update an audio track using PUT request to each subtitle 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 subtitle 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

Also you can 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"
Clone this wiki locally