4. API¶
PiDeck has a simple API to allow control of the system via scripts or other third party devices.
Where the API returns any data it will always in in JSON format.
4.1. Clips¶
Return an array of clips currently on the PiDeck
Note
The first object in the array is always the splash screen, this can’t be removed and is hidden on the GUI and HyperDeck interfaces.
curl 'http://<PiDeck.local>/clips'
StartAt - Time in seconds where the clip should start.
EndAt - Time in seconds where the clip should stop.
Duration - Total Duration of the clip.
ClipName - The nice display name of the clip.
Filename - Filename of the clip in the /CLIPS/ partition.
Loop - Boolean value defining if this clip loops.
Example results.
[
{
"ClipName": "splashscreen",
"Duration": 0,
"EndAt": 30,
"Filename": "/var/www/images/splashscreen.svg",
"Loop": true,
"StartAt": 0
},
{
"ClipName": "Count Down",
"Duration": 30,
"EndAt": 15,
"Filename": "yt5s.com-Countdown Clock 30 Seconds.mp4",
"Loop": true,
"StartAt": 0
},
{
"ClipName": "Install Walk Through",
"Duration": 203,
"EndAt": 203,
"Filename": "Install Walk Through.m4v",
"Loop": false,
"StartAt": 78
},
{
"ClipName": "countdown.mp4",
"Duration": 30,
"EndAt": 30,
"Filename": "countdown.mp4",
"Loop": true,
"StartAt": 0
}
]
4.2. Status¶
Return the current status of the PiDeck. This also returns an array of clips.
curl 'http://<PiDeck.local>/status'
CLIPS - see above for the details of the values in this array.
CLIP_ID - currently selected clip.
DEVICEID - Unique ID of this PiDeck which is used to license it.
IFACES - List of network interfaces on this PiDeck.
LICENSED - Boolean, is this device licensed.
LVERSION - Latest Version of PiDeck.
VERSION - Version of software running on this PiDeck.
PARTFREE - Size of freespace in the /CLIPS partition in bytes.
PARTSIZE - Total size of space in the CLIPS Partition in bytes.
PIDECKNAME - Hostname of PiDeck, defaults to “PiDeck”.
PLAY - Current Play status.
SHOWINFO - Should show the splashscreen on boot.
SPEED - Playback speed.
TIMECODE - Current timecode of the player.
Example results.
{
"CLIPS": [
{
"ClipName": "splashscreen",
"Duration": 0,
"EndAt": 30,
"Filename": "/var/www/images/splashscreen.svg",
"Loop": true,
"StartAt": 0
},
{
"ClipName": "Count Down",
"Duration": 30,
"EndAt": 15,
"Filename": "yt5s.com-Countdown Clock 30 Seconds.mp4",
"Loop": true,
"StartAt": 0
},
{
"ClipName": "Install Walk Through",
"Duration": 203,
"EndAt": 203,
"Filename": "Install Walk Through.m4v",
"Loop": false,
"StartAt": 78
},
{
"ClipName": "countdown.mp4",
"Duration": 30,
"EndAt": 30,
"Filename": "countdown.mp4",
"Loop": true,
"StartAt": 0
}
],
"CLIP_ID": 0,
"DEVICEID": "E4:5F:01:3B:B5:C7",
"IFACES": {
"wlan0": "192.168.40.187"
},
"LICENSED": true,
"LVERSION": "1.1",
"PARTFREE": 10601975808,
"PARTSIZE": 15142027264,
"PIDECKNAME": "piDeck08",
"PLAY": false,
"SHOWINFO": true,
"SPEED": 100,
"TIMECODE": 10,
"VERSION": "1.1.1"
}
4.3. Select Clip¶
Select a clip to load ready for playback. The CLIP_ID is the index of the clip in the CLIPS array.
curl 'http://<PiDeck.local>/select_clip?id=<CLIP_ID>'
4.4. Update Clip¶
Update a clips details.
CLIP_ID is the index of the clip to modify from the CLIPS array
CLIP_NAME is the nice name for the clip
START_AT number of seconds to start the clip
END_AT number of seconds from the start at which to stop the clip
LOOP boolean, value to define if the clip should loop
Note
All values must be present
curl 'http://<PiDeck.local>/update_clip?id=<CLIP_ID>&name=<CLIP_NAME>&startat=<START_AT>&endat=<END_AT>&loop=<LOOP>'
If successful a status “200 ok” will be returned.
4.5. Goto timecode¶
For the currently selected clip, move to the specified timecode (in seconds).
curl 'http://<PiDeck.local>/goto_secs?secs=<Seconds>'
returns the same json response as status.
4.6. Show Info¶
Toggle if the boot splashscreen should be displayed on boot.
curl 'http://<PiDeck.local>/showinfo'
returns the same json response as status.
4.7. Play¶
Start playing a clip. If a clip is already playing then pause the clip.
curl 'http://<PiDeck.local>/play'
returns the same json response as status.
4.8. Stop¶
Stop the playback and return the clip to the start.
curl 'http://<PiDeck.local>/stop'
returns the same json response as status.
4.9. Upload¶
Upload a clip to the PiDeck.
curl --progress-bar -F 'videoFile=@<FILENAME>' 'http://<PiDeck.local>/upload'
4.10. Delete¶
Delete a clip from the PiDeck
curl 'http://<PiDeck.local>/delete?id=<CLIP_ID>'
returns the same json response as status.
4.11. Update hostname¶
Change the hostname of this PiDeck
curl 'http://<PiDeck.local>/update_host?hostname=<PIDECK_NAME>'
returns the same json response as status.