<%pre> #include #include #include #include #include "exception.h" #include "epg_events.h" #include "setup.h" #include "tasks.h" #include "tools.h" #include "i18n.h" #include "recman.h" #define MB_PER_MINUTE 25.75 // this is just an estimate! using namespace vdrlive; using namespace std; <%args> string todel; string diskinfo; <%session scope="global"> bool logged_in(false); <%request scope="page"> string deleteResult; <%include>page_init.eh <%cpp> if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); pageTitle = tr("Recordings"); if (!todel.empty()) { RemoveRecordingTask task(todel); LiveTaskManager().Execute(task); if (!task.Result()) deleteResult = string() + tr("ERROR:") + " " + task.Error(); else deleteResult = string() + tr("Deleted recording:") + " " + StringReplace(task.RecName(), "~", "/"); } int FreeMB, UsedMB; int Percent = VideoDiskSpace(&FreeMB, &UsedMB); int Minutes = int(double(FreeMB) / MB_PER_MINUTE); int Hours = Minutes / 60; Minutes %= 60; diskinfo = cString::sprintf("%s %d%% - %2d:%02d %s", trVDR("Disk"), Percent, Hours, Minutes, trVDR("free")); <& pageelems.doc_type &> VDR-Live - <$ pageTitle $> <& pageelems.stylesheets &> <& pageelems.ajax_js &> <& pageelems.logo &> <%cpp> if (! deleteResult.empty()) { <& menu active=("recordings") component=("recordings.delete_error") &> <%cpp> } else { <& menu active=("recordings") &> <%cpp> }
<$ string(tr("List of recordings")) + " (" + diskinfo + ")" $>
<%cpp> if (Recordings.Count() == 0) { <$ tr("No recordings found") $> <%cpp> } else {
    <& recordings.recordings_item &>
<%cpp> }
<%include>page_exit.eh <# ---------------------------------------------------------------------- #> <%def recordings_item> <%args> path[]; int level = 0; <%cpp> RecordingsTreePtr recordingsTree(LiveRecordingsManager()->GetRecordingsTree()); RecordingsMap::iterator iter; RecordingsMap::iterator end = recordingsTree->end(path); for (iter = recordingsTree->begin(path); iter != end; ++iter) { RecordingsItemPtr recItem = iter->second; string folderimg("folder_closed.png"); string collapseimg("plus.png"); if (recItem->IsDir()) {
  • <& rec_item_dir name=(recItem->Name()) level=(level) &> <%cpp> #if TNTVERSION >= 1606 tnt::QueryParams recItemParams(qparam, false); #else cxxtools::QueryParams recItemParams(qparam, false); #endif for (path_type::const_iterator i = path.begin(); i != path.end(); ++i) { recItemParams.add("path", *i); } recItemParams.add("path", recItem->Name()); recItemParams.add("level", lexical_cast(level + 1));
  • <%cpp> } } for (iter = recordingsTree->begin(path); iter != end; ++iter) { RecordingsItemPtr recItem = iter->second; if (!recItem->IsDir()) { string day(FormatDateTime("%a,", recItem->StartTime())); string dayLen(lexical_cast(day.length() - 1) + ".25em;"); string duration(lexical_cast(recItem->Duration()) + "'"); string shortDescr(recItem->RecInfo()->ShortText() ? recItem->RecInfo()->ShortText() : ""); string hint(tr("Click to view details.")); if (!shortDescr.empty()) hint = shortDescr + "
    " + hint;
  • <& rec_item_file name=(recItem->Name()) level=(level) id=(recItem->Id()) day=(day) dayLen=(dayLen) startTime=(recItem->StartTime()) duration=(duration) hint=(hint) shortDescr=(shortDescr) archived=(RecordingsManager::GetArchiveDescr(recItem->Recording())) &>
  • <%cpp> } } <# ---------------------------------------------------------------------- #> <%def del_rec> <%args> string id; <%cpp> { >" alt="" /><%cpp> } <# ---------------------------------------------------------------------- #> <%def rec_tools> <%args> string id; string title; <& pageelems.ajax_action_href action="play_recording" param=(id) tip=(tr("play this recording.")) image="play.png" alt="" &> <& pageelems.vlc_stream_recording recid=(id) &> <& pageelems.imdb_info_href title=(title) &> <& recordings.del_rec id=(id) &> <# ---------------------------------------------------------------------- #> <%def archived_disc> <%args> string archived; string title; " alt="on_dvd" <& tooltip.hint text=(archived) &> /> <& pageelems.imdb_info_href title=(title) &> <# ---------------------------------------------------------------------- #> <%def rec_item_dir> <%args> string name; int level; string collapseimg = "plus.png"; string folderimg = "folder_closed.png";
    <%cpp> reply.out() << StringRepeat(level, "\"\""); " alt="" />" alt="" />
    <$ name $>
     
    <# ---------------------------------------------------------------------- #> <%def rec_item_file> <%args> string name; int level; string id; string day; string dayLen; time_t startTime; string duration; string hint; string shortDescr; string archived;
    <%cpp> reply.out() << StringRepeat(level + 1, "\"\""); <%cpp> if (!archived.empty()) { " alt="on_dvd" <& tooltip.hint text=(archived) &> /><%cpp> } else { " alt="movie" /><%cpp> }
    <$ day $>
    <$ FormatDateTime(tr("%b %d %y"), startTime) $>
    <$ FormatDateTime(tr("%I:%M %p"), startTime) $>
    <$ duration $>
    <%cpp> if (archived.empty()) { <& recordings.rec_tools id=(id) title=(name)&> <%cpp> } else { <& pageelems.imdb_info_href title=(name) &> <%cpp> }
    <%cpp> if (! archived.empty()) {
    <$ archived $>
    <%cpp> }
    <# ---------------------------------------------------------------------- #> <%def delete_error> <%cpp> { <$ deleteResult $><%cpp> }