<%pre> #include #include #include #include "setup.h" #include "tools.h" using namespace std; using namespace vdrlive; <%args> tChannelID channel; string async; string recid; <%session scope="global"> bool logged_in(false); <%request scope="page"> cChannel* Channel; <%include>page_init.eh <%cpp> if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); bool asyncReq = !async.empty() && (lexical_cast(async) != 0); // the availabilty of Channel signals that we will do live tv streaming. Channel = 0; if (recid.empty()) { pageTitle = tr("VLC: live video stream"); ReadLock channelsLock(Channels); if (!channelsLock) { throw HtmlError(tr("Couldn't aquire access to channels, please try again later.")); } Channel = Channels.GetByChannelID(channel); if (Channel == 0) { throw HtmlError( tr("Couldn't find channel or no channels available. Maybe you mistyped your request?") ); } } else { pageTitle = tr("VLC: play recording"); } <& pageelems.doc_type &> VDR-Live - <$ pageTitle $> <& pageelems.stylesheets &> <%cpp> if (!asyncReq) { <& pageelems.ajax_js &> <%cpp> } else { <%cpp> } <%cpp> if (!asyncReq) { <& pageelems.logo &> <& menu active="vlc" &>
<%cpp> } <%cpp> #if TNTVERSION >= 1606 string server = request.getHost(); if (Channel != 0) { server = server.substr(0, server.rfind(':')); } #else string server = request.getServerIp(); #endif string videourl; if (Channel != 0) { int streamdevPort = LiveSetup().GetStreamdevPort(); videourl = string("http://") + server + ":" + lexical_cast(streamdevPort) + "/" + LiveSetup().GetStreamdevType() + "/" + *Channel->GetChannelID().ToString(); } else { #if TNTVERSION >= 1606 # define SERVER_AND_PORT server #else # define SERVER_AND_PORT server + ":" + lexical_cast(LiveSetup().GetServerPort()); #endif videourl = string("http://") + SERVER_AND_PORT + "/recstream.html?recid=" + recid; } <& vlc.controls videourl=(videourl) asyncReq=(asyncReq) &> <%cpp> if (!asyncReq) {
<%cpp> } <%include>page_exit.eh <%def controls> <%args> string videourl; bool asyncReq;
<%cpp> if (asyncReq) { <%cpp> }

<$ tr("VLC media URL") $>: <$ videourl $>