Json php backend for new ajax version
Technical documentation
03/11/2010
Here are the php backend specs to develop for future version:
Method:
backend.php?action={call}&{post}
- call: getGlobals
post:
return:{ "streamdev_server": "http://127.0.0.1:3000", "rec_path": "/video/", "video_path": "/mnt/media/Video/", "audio_path": "/mnt/media/Music/" }
- call: getRunningSessions
post:
return:
{ "broadcast": [ { "session": "1", "name": "TF1", "type": "tv", }, { "session": "2", "name": "Turbo", "type": "rec", }, { "session": "3", "name": "Movie.avi", "type": "vid", } ] }
- call: getTvCat
post:
return:{ "categories": [ { "name": "Nationales&TNT", "channels": "17" },{ "name": "Divertissements", "channels": "12" },{ "name": "Information", "channels": "6" } ] }
- call: getFullChanList
post:
retunr:{ "category": [ { "name": "Nationales&TNT", "channel": [ { "name": "TF1", "number": "1" },{ "name": "FRANCE 2", "number": "2" },{ "name": "FRANCE 3", "number": "3" } ] }, { "name": "Divertissement", "channel": [ { "name": "Paris Première", "number": "10" },{ "name": "RTL Télévision", "number": "11" } ] } ] }
- call: getTvChan
post: cat=[category]
return:{ "channel": [ { "name": "TF1", "number": "1", "now_title": "Journal de 13h", },{ "name": "FRANCE 2", "number": "2", "now_title": "Tournez manège", },{ "name": "FRANCE 3", "number": "3", "now_title": "Journal régional" } ] }
- call: getChanInfo
post: chan=[channel]
return:{ "program": { "name": "TF1", "number": "1", "now_time": "13h00-13h30", "now_title": "Journal de 13h", "now_desc": "Les informations de 13h... Blahblah..", "next_time": "13h35-13h45", "next_title": "Météo", "next_desc": "Le bulletin météo de la journée." } }
- call: getRecInfo
post: rec=[recfolder]
return:{ "program": { "name": "Journal de 13h", "channel": "TF1", "recorded": "2010-02-02 at 19h30", "desc": "Les informations de 13h..." } }
- call: getVidInfo
post: file=[vidfile]
return:{ "program": { "name": "My_video.avi", "desc": "", "duration": "1:41:55", "format": "avi", "video": "XviD MPEG-4", "audio": "MPEG Layer 3", "resolution": "608x256" } }
- call: getStreamInfo
post: session=[session_number]
return:
if Tv:{ "stream": { "session": "1", "type": "tv", "name": "TF1", "mode": "3G", "now_time": "13h00-13h30", "now_title": "Journal de 13h", "now_desc": "Les informations de 13h...", "next_time": "13h35-13h45", "next_title": "Météo", "next_desc": "Le bulletin météo de la journée.", "thumbwidth": "80", "thumbheight": "80" } }
if Rec:{ "stream": { "session": "1", "type": "rec", "name": "Journal de 13h", "channel": "TF1", "recorded": "2010-02-02 at 19h30", "desc": "Les informations de 13h...", "mode": "3G", "thumbwidth": "80", "thumbheight": "80" } }
if Video:
{ "stream": { "session": "1", "type": "vid", "name": "Mavideo.avi", "desc": "", "duration": "1:41:55", "format": "avi", "video": "XviD MPEG-4", "audio": "MPEG Layer 3", "resolution": "608x256" "mode": "3G", "thumbwidth": "180", "thumbheight": "100" } }
- call: startBroadcast
post: type=[streamtype]&url=[sourceurl]
return:{ "session": "1" }
- call: StopBroadcast
post: session=[session]
return:{ "status": "ok", "message": "Successfully stopped broadcast" }
or{ "status": "error", "message": "There was an error stopping broadcast" }
- call: getStreamStatus
post: session=[session]&msg=[previousmessagereceived]
return:
{"status": "wait","message": "Requesting streamdev channel","url": ""}
or
{"status": "wait","message": "Requesting video file","url": ""}
or
{"status": "wait","message": "Starting encoding","url": ""}
or
{"status": "ready","message": "3G Broadcast ready", "url": "ram/session0/stream.m3u8"}
or
{"status": "error","message": "Error: Couldn't open channel", "url": ""}
or
{"status": "error","message": "Error: Couldn't encode channel", "url": ""}
or
{"status": "error","message": "Error: Couldn't encode file", "url": ""}
- call: getTimers
post:
return:
{ "timer": [ { "id": "1", "name": "Timername", "active": "1", "channumber": "2", "channame": "FRANCE 2", "date": "2010-03-10", "starttime": "2030", "endtime": "2230", "running": "0" } { "id": "2", "name": "Timername2", "active": "0", "channumber": "3", "channame": "FRANCE 3", "date": "2010-05-10", "starttime": "1030", "endtime": "1230", "running": "0" } ] }* call: editTimer
post: id=[id]&name=[name]&active=[active]&channumber=[channumber]&date=[date]&starttime=[starttime]
&endtime=[endtime]
return:
{ "status": "ok", "message":"Timer edited successfully" }
or
{ "status": "error", "message":"Timer can't be edited" }
- call: addTimer
post: name=[name]&active=[active]&channumber=[channumber]&date=[date]&starttime=[starttime]&endtime=[endtime]
return:
{ "status": "ok", "message":"Timer created successfully" }
or
{ "status": "error", "message":"Timer can't be created" }
- call: delTimer
post: id=[id]
return:
{ "status": "ok", "message":"Timer successfully deleted" }
or
{ "status": "error", "message":"Timer can't be deleted" }
- call: browseFolder
post: path=[path] ( video path )
return:
{ "list": [ { "type": "folder", "name": "movie1", "path": "/mnt/videos/movie1" }, { "type": "folder", "name": "movie2", "path": "/mnt/videos/movie2" }, { "type": "video", "name": "videofile.avi", "path": "/mnt/videos/videofile.avi" } ] }
- Call: browseFolder
post: path=[path] ( recording path )
return:
{ "list": [ { "type": "folder", "name": "rec1", "path": "/video/rec1" }, { "type": "folder", "name": "rec2", "path": "/video/rec2" } ] }
or
{ "list": [ { "type": "rec", "name": "2010/02/25 at 23h21", "path": "/video/rec1/2010-02-25.23.21.3-0.rec" }, { "type": "rec", "name": "2010/02/26 at 22h35", "path": "/video/rec1/2010-02-26.22.35.3-0.rec" } ] }
- call: browseFolder
post: path=[path] ( audio path )
return:
{ "list": [ { "type": "folder", "name": "album1", "path": "/mnt/music/album1" }, { "type": "folder", "name": "album2", "path": "/mnt/music/album2" }, { "type": "audio", "name": "audiofile.mp3", "nnumber": "tracknumber", "length": "3.30", "path": "/mnt/music/audiofile.mp3" } ] }
- call: streamAudio
post: path=[path]&file=[file]
return:
{ "track": [ { "file": "/istreamdev/playlist/track1.mp3" }, { "file": "/istreamdev/playlist/track2.mp3" }, { "file": "/istreamdev/playlist/track3.mp3" } ] }
- call: getEpg
post: channel&[channumber or "all"]&time=[hour+minutes]&day=[value from today (0) to lastday (ex: 6 if 6 days of epg) ]&programs=[numberofprogramtoget]
example: channel=all&time=1300&day=0&programs=2
return:
{ "category": [ { "name": "NATIONALES&TNT", "channel": [ { "name": "TF1", "number": "1", "epg": [ { "time": "13h00-13h30", "title": "Attention à la marche" },{ "time": "13h30-14h00", "title": "Tournez manège" } ] },{ "name": "FRANCE 2", "number": "2", "epg": [ { "time": "12h55-13h25", "title": "Informations" },{ "time": "13h25-14h00", "title": "Météo" } ] } ] }, { "name": "DIVERTISSEMENT", "channel": [ { "name": "RTL", "number": "10", "epg": [ { "time": "13h00-13h30", "title": "Attention à la marche" },{ "time": "13h30-14h00", "title": "Tournez manège" } ] },{ "name": "PARIS PREMIERE", "number": "11", "epg": [ { "time": "12h55-13h25", "title": "Informations" },{ "time": "13h25-14h00", "title": "Météo" } ] } ] ] }
call: getEpgInfo
post: channel&[channame or "all"]&time=[hour+minutes]&day=[value from today (0) to lastday (ex: 6 if 6 days of epg) ]
in this example: channel=1&time=1300&day=0
{ "program: { "name": "TF1", "number": "1", "date": "2010-03-24", "time": "12h45-13h30", "title": "Informations", "desc": "Les informations de 13h...", "running": "no" } }