-
Notifications
You must be signed in to change notification settings - Fork 1
3.3 Reading Springfield data
Data in the Springfield filesystem is stored in xml and is called fsxml
Paths to the data are defined as follow:
/[PARENT NODE]/[ID NODE]/[PARENT NODE]/[ID NODE]/...
As you can see a path holds PARENT NODES and ID NODES
As example path to request all videos from the user rbb in the domain espace
/domain/espace/user/rbb/video
This will provide you with a list of videos, see the following xml example
<fsxml>
<properties>
<depth>10</depth>
<start>0</start>
<limit>-1</limit>
<totalResultsAvailable>488</totalResultsAvailable>
<totalResultsReturned>488</totalResultsReturned>
</properties>
<video id="1">
<properties>
...
</properties>
</video>
<video id="2">
...
</video>
...
</fsxml>
To request a specific id node the following path requests video with id 1 from the user rbb in the domain espace
/domain/espace/user/rbb/video/1
This will provide you with the video information of video 1, see the following example
<fsxml>
<video id="1">
<properties>
<original_id>9e</original_id>
<language>uk</language>
<screenshot>http://images3.noterik.com/domain/espace/user/rbb/video/1/shots/1/h/0/m/0/sec5.jpg</screenshot>
</properties>
<rawvideo id="1">
<properties>
<audiocodec>MP4A</audiocodec>
...
</properties>
</rawvideo>
...
</video>
</fsxml>
Parent nodes always only hold one or more id node, id nodes can hold either other parent nodes but besides that will always contain properties. Properties contain actual data.
To request only the properties of a specific id node the following path requests properties from a video* with id 1 from the user rbb in the domain espace
/domain/espace/user/rbb/video/1/properties
This will give the following xml
<fsxml>
<video id="1">
<properties>
<original_id>9e</original_id>
<language>uk</language>
<screenshot>http://images3.noterik.com/domain/espace/user/rbb/video/1/shots/1/h/0/m/0/sec5.jpg</screenshot>
</properties>
<rawvideo id="1"/>
<rawvideo id="2"/>
<rawvideo id="3"/>
<rawvideo id="4"/>
<rawvideo id="5"/>
<screens id="1"/>
</video>
</fsxml>
Sometimes data is referred from another path instead of included. This can be convenient when you want to reuse for example some video in a presentation. To get all the data from the refered node this has to be requested seperately from the refer id path.
In the following example you can see how the presentation holds a video playlist containing two referred videos for two different languages
<fsxml>
<presentation id="1">
<properties>
...
</properties>
<category id="1">
...
</category>
...
<videoplaylist id="1">
<properties/>
<video id="1" referid="/domain/espace/user/rbb/video/1">
<properties>
<original_id>9e</original_id>
<language>uk</language>
<screenshot>http://images3.noterik.com/domain/espace/user/rbb/video/1/shots/1/h/0/m/0/sec5.jpg</screenshot>
</properties>
</video>
<video id="2" referid="/domain/espace/user/rbb/video/2">
<properties>
<srt_de>http://images3.noterik.com/domain/espace/user/rbb/video/2/subtitles_de.vtt</srt_de>
<original_id>9</original_id>
<srt>de</srt>
<language>de</language>
<screenshot>http://images3.noterik.com/domain/espace/user/rbb/video/2/shots/1/h/0/m/0/sec5.jpg</screenshot>
</properties>
</video>
</videoplaylist>
</presentation>
</fsxml>
To request a list of ID NODES
List<FsNode> videos = Fs.getNodes("/domain/espace/user/rbb/video",1);
The second parameter is the depth a depth of 1 will only provide you with the current level of videos, not their properties or childs. This is much faster in requesting the data.
To request a single ID NODE
FsNode video = Fs.getNode("/domain/espace/user/rbb/video/1");
To get the refer id from an ID NODE
//get video node from video playlist
FsNode videoPlaylistVideo = Fs.getNode("/domain/espace/user/rbb/presentation/1/videoplaylist/1/video/1");
//get refer from FsNode
String refer = videoPlaylistVideo.getReferid();
//get Actual video data
FsNode video = Fs.getNode(refer);