-
Notifications
You must be signed in to change notification settings - Fork 6
Movida Resource: Audio Track
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>
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>
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>
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>
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>
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"