From 70f268b6fff0037cbff265cf849663755223ffed Mon Sep 17 00:00:00 2001 From: Dieter Hametner Date: Tue, 8 May 2007 22:59:40 +0000 Subject: - Control recordings playback from Infobox - Added button images (Buttons by skiller2k1) - Made recordings look more like schedule - Made all tables 100% width to have a common look over all pages - some cleanup in ajax xml responses - common file for xmlresponses - Added translations for recordings related strings - Javascript updates in vdr_status.js for new playback control functions - Added tasks for playback control actions --- pages/Makefile | 6 +++-- pages/ffw_recording.ecpp | 26 +++++++++++++++++++ pages/ibox.ecpp | 65 +++++++++++++--------------------------------- pages/menu.ecpp | 4 +-- pages/pageelems.ecpp | 20 +++++++++----- pages/pause_recording.ecpp | 26 +++++++++++++++++++ pages/play_recording.ecpp | 13 +++------- pages/recordings.ecpp | 15 ++++++++--- pages/rwd_recording.ecpp | 26 +++++++++++++++++++ pages/stop_recording.ecpp | 26 +++++++++++++++++++ pages/switch_channel.ecpp | 9 +------ pages/xmlresponse.ecpp | 62 +++++++++++++++++++++++++++++++++++++++++++ 12 files changed, 218 insertions(+), 80 deletions(-) create mode 100644 pages/ffw_recording.ecpp create mode 100644 pages/pause_recording.ecpp create mode 100644 pages/rwd_recording.ecpp create mode 100644 pages/stop_recording.ecpp create mode 100644 pages/xmlresponse.ecpp (limited to 'pages') diff --git a/pages/Makefile b/pages/Makefile index fadb1b9..92a4932 100644 --- a/pages/Makefile +++ b/pages/Makefile @@ -18,9 +18,11 @@ VDRDIR ?= ../../../.. OBJS = menu.o channels.o recordings.o schedule.o \ screenshot.o timers.o whats_on.o switch_channel.o \ keypress.o remote.o channels_widget.o edit_timer.o \ - error.o pageelems.o tooltip.o play_recording.o \ + error.o pageelems.o tooltip.o \ searchtimers.o edit_searchtimer.o searchresults.o \ - searchepg.o login.o ibox.o + searchepg.o login.o ibox.o xmlresponse.o \ + play_recording.o pause_recording.o stop_recording.o \ + ffw_recording.o rwd_recording.o ### Default rules: diff --git a/pages/ffw_recording.ecpp b/pages/ffw_recording.ecpp new file mode 100644 index 0000000..5b2d8bc --- /dev/null +++ b/pages/ffw_recording.ecpp @@ -0,0 +1,26 @@ +<%pre> +#include +#include +#include "exception.h" +#include "setup.h" +#include "tasks.h" +#include "tools.h" + +using namespace std; +using namespace vdrlive; + + +<%args> + string param; + +<%session scope="global"> + bool logged_in(false); + +<%cpp> + if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); + reply.setContentType( "application/xml" ); + + ForwardRecordingTask task( param ); + LiveTaskManager().Execute( task ); + +<& xmlresponse.ajax name=("ffw_recording") pname=("recording") value=(param) result=(task.Result()) error=(task.Error()) &> diff --git a/pages/ibox.ecpp b/pages/ibox.ecpp index e2b2fb8..0ed2f8c 100644 --- a/pages/ibox.ecpp +++ b/pages/ibox.ecpp @@ -10,6 +10,7 @@ #include "setup.h" #include "tools.h" #include "epg_events.h" +#include "recordings.h" using namespace vdrlive; using namespace std; @@ -30,18 +31,22 @@ bool logged_in(false); reply.setContentType( "application/xml" ); if (cReplayControl::NowReplaying()) { - cThreadLock RecordingsLock(&Recordings); - cRecording *Recording = Recordings.GetByName(cReplayControl::NowReplaying()); - if (Recording) { - const cRecordingInfo* info = Recording->Info(); + RecordingsManagerPtr recManager = LiveRecordingsManager(); + cRecording *recording = Recordings.GetByName(cReplayControl::NowReplaying()); + if (recording) { + string name(recording->Name()); + size_t index = name.find_last_of('~'); + if (index != string::npos) + name = name.substr(index, name.length()); + const cRecordingInfo* info = recording->Info(); if (info) { - EpgEventPtr epgEvent(new EpgEvent("recording", - Recording->Name(), - info->Title() ? info->Title() : Recording->Name(), + EpgEventPtr epgEvent(new EpgEvent(recManager->Md5Hash(recording), + tr("playing recording"), + info->Title() ? info->Title() : name, info->ShortText() ? info->ShortText() : "", info->Description() ? info->Description() : "", - Recording->start, - Recording->start)); + recording->start, + recording->start)); epgEvents.push_back(epgEvent); } } @@ -124,59 +129,25 @@ bool logged_in(false); if (prev_chan.Valid() && next_chan.Valid()) { -<& xmlresponse update=(update) type=(epg->Id()) caption=(epg->Caption()) currentTime=(epg->CurrentTime(tr("%I:%M:%S %p"))) duration=(epg->StartTime(tr("%I:%M %p")) + string(" - ") + epg->EndTime(tr("%I:%M %p"))) title=(epg->Title()) elapsed=(epg->Elapsed()) prev_chan=(prev_chan) next_chan=(next_chan) &> +<& xmlresponse.ibox update=(update) type=(epg->Id()) caption=(epg->Caption()) currentTime=(epg->CurrentTime(tr("%I:%M:%S %p"))) duration=(epg->StartTime(tr("%I:%M %p")) + string(" - ") + epg->EndTime(tr("%I:%M %p"))) title=(epg->Title()) elapsed=(epg->Elapsed()) prev_chan=(prev_chan) next_chan=(next_chan) &> <%cpp> } else if (prev_chan.Valid()) { -<& xmlresponse update=(update) type=(epg->Id()) caption=(epg->Caption()) currentTime=(epg->CurrentTime(tr("%I:%M:%S %p"))) duration=(epg->StartTime(tr("%I:%M %p")) + string(" - ") + epg->EndTime(tr("%I:%M %p"))) title=(epg->Title()) elapsed=(epg->Elapsed()) prev_chan=(prev_chan) &> +<& xmlresponse.ibox update=(update) type=(epg->Id()) caption=(epg->Caption()) currentTime=(epg->CurrentTime(tr("%I:%M:%S %p"))) duration=(epg->StartTime(tr("%I:%M %p")) + string(" - ") + epg->EndTime(tr("%I:%M %p"))) title=(epg->Title()) elapsed=(epg->Elapsed()) prev_chan=(prev_chan) &> <%cpp> } else if (next_chan.Valid()) { -<& xmlresponse update=(update) type=(epg->Id()) caption=(epg->Caption()) currentTime=(epg->CurrentTime(tr("%I:%M:%S %p"))) duration=(epg->StartTime(tr("%I:%M %p")) + string(" - ") + epg->EndTime(tr("%I:%M %p"))) title=(epg->Title()) elapsed=(epg->Elapsed()) next_chan=(next_chan) &> +<& xmlresponse.ibox update=(update) type=(epg->Id()) caption=(epg->Caption()) currentTime=(epg->CurrentTime(tr("%I:%M:%S %p"))) duration=(epg->StartTime(tr("%I:%M %p")) + string(" - ") + epg->EndTime(tr("%I:%M %p"))) title=(epg->Title()) elapsed=(epg->Elapsed()) next_chan=(next_chan) &> <%cpp> } else { -<& xmlresponse update=(update) type=(epg->Id()) caption=(epg->Caption()) currentTime=(epg->CurrentTime(tr("%I:%M:%S %p"))) duration=(epg->StartTime(tr("%I:%M %p")) + string(" - ") + epg->EndTime(tr("%I:%M %p"))) title=(epg->Title()) elapsed=(epg->Elapsed()) &> +<& xmlresponse.ibox update=(update) type=(epg->Id()) caption=(epg->Caption()) currentTime=(epg->CurrentTime(tr("%I:%M:%S %p"))) duration=(epg->StartTime(tr("%I:%M %p")) + string(" - ") + epg->EndTime(tr("%I:%M %p"))) title=(epg->Title()) elapsed=(epg->Elapsed()) &> <%cpp> } break; } -<%def xmlresponse> -<%args> - int update; - string type; - string currentTime; - string caption; - string title; - string duration; - int elapsed; - string prev_chan; - string next_chan; - - - - - <$ update $> - - 1 - - - <$ update $> - - <$ type $> - <$ caption $> - <$ currentTime $> - <$ title $> - <$ duration $> - <$ elapsed $> - <$ next_chan $> - <$ prev_chan $> - - - - diff --git a/pages/menu.ecpp b/pages/menu.ecpp index 5acbc13..ac31d79 100644 --- a/pages/menu.ecpp +++ b/pages/menu.ecpp @@ -39,9 +39,9 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); % } ><$ tr("Recordings") $> | ><$ tr("Remote Control") $> - +--- #> % if (LiveSetup().UseAuth()) { | <$ tr("Logout") $> % } diff --git a/pages/pageelems.ecpp b/pages/pageelems.ecpp index a7fcf33..e12f9dc 100644 --- a/pages/pageelems.ecpp +++ b/pages/pageelems.ecpp @@ -41,13 +41,19 @@ using namespace vdrlive;
--:--
-
- > - - - <& ajax_action_href action=("switch_channel") id=("infobox_prevchan") image=("one_downarrow.png") tip=(tr("previous channel")) &> - <& ajax_action_href action=("switch_channel") id=("infobox_nextchan") image=("one_uparrow.png") tip=(tr("next channel")) &> - +
+ > +
+ +
+ <& ajax_action_href action=("switch_channel") id=("infobox_prevchan") image=("one_downarrow.png") tip=(tr("previous channel")) &> + <& ajax_action_href action=("switch_channel") id=("infobox_nextchan") image=("one_uparrow.png") tip=(tr("next channel")) &>
<& progressbar id=("infobox_elapsed") &> diff --git a/pages/pause_recording.ecpp b/pages/pause_recording.ecpp new file mode 100644 index 0000000..1208a42 --- /dev/null +++ b/pages/pause_recording.ecpp @@ -0,0 +1,26 @@ +<%pre> +#include +#include +#include "exception.h" +#include "setup.h" +#include "tasks.h" +#include "tools.h" + +using namespace std; +using namespace vdrlive; + + +<%args> + string param; + +<%session scope="global"> + bool logged_in(false); + +<%cpp> + if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); + reply.setContentType( "application/xml" ); + + PauseRecordingTask task( param ); + LiveTaskManager().Execute( task ); + +<& xmlresponse.ajax name=("pause_recording") pname=("recording") value=(param) result=(task.Result()) error=(task.Error()) &> diff --git a/pages/play_recording.ecpp b/pages/play_recording.ecpp index 3d95352..5a26b41 100644 --- a/pages/play_recording.ecpp +++ b/pages/play_recording.ecpp @@ -14,20 +14,13 @@ using namespace vdrlive; string param; <%session scope="global"> -bool logged_in(false); + bool logged_in(false); <%cpp> if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); reply.setContentType( "application/xml" ); - ReplayRecordingTask task( param ); + PlayRecordingTask task( param ); LiveTaskManager().Execute( task ); - - - -<$ param $> - -<$ task.Result() $> -<$ task.Error() $> - +<& xmlresponse.ajax name=("play_recording") pname=("recording") value=(param) result=(task.Result()) error=(task.Error()) &> diff --git a/pages/recordings.ecpp b/pages/recordings.ecpp index 4993284..ebc68e7 100644 --- a/pages/recordings.ecpp +++ b/pages/recordings.ecpp @@ -102,10 +102,10 @@ for (iter = recordingsTree.begin(path); iter != end; ++iter) { } string day(FormatDateTime("%a,", recItem->StartTime())); string dayLen(lexical_cast(day.length() - 1) + ".25em;"); - string shortDescr(tr("Click to view details.")); if (epgEvent && !epgEvent->ShortDescr().empty()) shortDescr = (epgEvent->ShortDescr() + string("
") + shortDescr); + string hint(tr("Click to view details.")); if (epgEvent && !epgEvent->ShortDescr().empty()) hint = (epgEvent->ShortDescr() + "
" + hint);
  • - <& rec_item_file name=(recItem->Name()) level=(level) id=(recItem->Id()) day=(day) dayLen=(dayLen) startTime=(recItem->StartTime()) shortDescr=(shortDescr) archived=(epgEvent ? epgEvent->Archived() : "") archiveId=(recItem->ArchiveId()) &> + <& rec_item_file name=(recItem->Name()) level=(level) id=(recItem->Id()) day=(day) dayLen=(dayLen) startTime=(recItem->StartTime()) hint=(hint) shortDescr=(epgEvent ? epgEvent->ShortDescr() : "") archived=(epgEvent ? epgEvent->Archived() : "") archiveId=(recItem->ArchiveId()) &>
  • <%cpp> } @@ -177,6 +177,7 @@ for (iter = recordingsTree.begin(path); iter != end; ++iter) { string day; string dayLen; time_t startTime; + string hint; string shortDescr; string archived; string archiveId; @@ -187,8 +188,7 @@ for (iter = recordingsTree.begin(path); iter != end; ++iter) {
    <$ day $>
    <$ FormatDateTime(tr("%b %d %y"), startTime) $>
    <$ FormatDateTime(tr("%I:%M %p"), startTime) $>
    -
    <& tooltip.display domId=(id) &>><$ name $>
    - <%cpp> if (! archived.empty()) {
    <$ archived $>
    <%cpp> } +
    <& tooltip.display domId=(id) &>><$ name $>
    <%cpp>if ((name != shortDescr) && (!shortDescr.empty())) {<$ shortDescr $><%cpp> } else {  <%cpp> }
    <%cpp> @@ -206,5 +206,12 @@ for (iter = recordingsTree.begin(path); iter != end; ++iter) {
    +<%cpp> + if (! archived.empty()) { + +
    <$ archived $>
    +<%cpp> + } +
    diff --git a/pages/rwd_recording.ecpp b/pages/rwd_recording.ecpp new file mode 100644 index 0000000..a0ce569 --- /dev/null +++ b/pages/rwd_recording.ecpp @@ -0,0 +1,26 @@ +<%pre> +#include +#include +#include "exception.h" +#include "setup.h" +#include "tasks.h" +#include "tools.h" + +using namespace std; +using namespace vdrlive; + + +<%args> + string param; + +<%session scope="global"> + bool logged_in(false); + +<%cpp> + if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); + reply.setContentType( "application/xml" ); + + BackwardRecordingTask task( param ); + LiveTaskManager().Execute( task ); + +<& xmlresponse.ajax name=("rwd_recording") pname=("recording") value=(param) result=(task.Result()) error=(task.Error()) &> diff --git a/pages/stop_recording.ecpp b/pages/stop_recording.ecpp new file mode 100644 index 0000000..869beb0 --- /dev/null +++ b/pages/stop_recording.ecpp @@ -0,0 +1,26 @@ +<%pre> +#include +#include +#include "exception.h" +#include "setup.h" +#include "tasks.h" +#include "tools.h" + +using namespace std; +using namespace vdrlive; + + +<%args> + string param; + +<%session scope="global"> + bool logged_in(false); + +<%cpp> + if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); + reply.setContentType( "application/xml" ); + + StopRecordingTask task( param ); + LiveTaskManager().Execute( task ); + +<& xmlresponse.ajax name=("stop_recording") pname=("recording") value=(param) result=(task.Result()) error=(task.Error()) &> diff --git a/pages/switch_channel.ecpp b/pages/switch_channel.ecpp index 91f4f30..0031f4e 100644 --- a/pages/switch_channel.ecpp +++ b/pages/switch_channel.ecpp @@ -16,11 +16,4 @@ using namespace vdrlive; SwitchChannelTask task( param ); LiveTaskManager().Execute( task ); - - - -<$ param $> - -<$ task.Result() $> -<$ task.Error() $> - +<& xmlresponse.ajax name=("switch_channel") pname=("channel") value=(param) result=(task.Result()) error=(task.Error()) &> diff --git a/pages/xmlresponse.ecpp b/pages/xmlresponse.ecpp new file mode 100644 index 0000000..1123368 --- /dev/null +++ b/pages/xmlresponse.ecpp @@ -0,0 +1,62 @@ +<%pre> +#include + +using namespace std; + + +<# ------------------------------------------------------------------------- #> + +<%def ajax> +<%args> + string name; + string pname; + string value; + bool result; + string error; + + + + + <$ value $> + + <$ result $> + <$ error $> + + + +<# ------------------------------------------------------------------------- #> + +<%def ibox> +<%args> + int update; + string type; + string currentTime; + string caption; + string title; + string duration; + int elapsed; + string prev_chan; + string next_chan; + + + + + <$ update $> + + 1 + + + <$ update $> + + <$ type $> + <$ caption $> + <$ currentTime $> + <$ title $> + <$ duration $> + <$ elapsed $> + <$ next_chan $> + <$ prev_chan $> + + + + -- cgit v1.2.3