<%pre> #include #include #include #include #include #include #include "exception.h" #include "tools.h" #include "epgsearch.h" #include "setup.h" #include "i18n.h" using namespace std; using namespace vdrlive; <%args> // input parameters string searchtimerid; string test; // form parameters string search = ""; int mode = 0; bool matchcase = false; int tolerance = 1; bool usetitle = false; bool usesubtitle = false; bool usedescr = false; int usechannel = SearchTimer::NoChannel; tChannelID channelidfrom; tChannelID channelfrom; tChannelID channelidto; tChannelID channelto; string changrpsel = ""; bool usetime = false; string start_h = "00"; string start_m = "00"; string stop_h = "00"; string stop_m = "00"; bool useduration = false; int durationmin = 0; int durationmax = 90; bool useweekday = false; bool wday_mon = false; bool wday_tue = false; bool wday_wed = false; bool wday_thu = false; bool wday_fri = false; bool wday_sat = false; bool wday_sun = false; bool useinfavorites = false; int useassearchtimer = 0; int searchtimeraction = 0; bool seriesrecording = false; string directory = ""; int delrecafterdays = 0; int keeprecs = 0; int pauseonrecs = 0; int blacklistmode = 0; string blacklistids[]; int switchminbefore = 0; bool useextepginfo = false; string extepgvalues[]; bool avoidrepeats = false; int allowedrepeats = 0; int repeatswithindays = 0; bool comparetitle = false; int comparesubtitle = 0; bool comparesummary = false; unsigned avoidrepeatscatselected[]; int priority = 0; int lifetime = 0; int marginstart = 0; int marginstop = 0; bool usevps = false; bool delmode = false; int delaftercountrecs = 0; int delafterdaysoffirstrec = 0; string blacklistids_internal; string useassearchtimerfrom; string useassearchtimerto; bool ignoreMissingEPGCats = false; <%session scope="global"> bool logged_in(false); <%request scope="page"> ExtEPGInfos extEPGInfos; ChannelGroups channelGroups; Blacklists blacklists; RecordingDirs recordingdirs; SearchTimer* editsearchtimer; <%include>page_init.eh <{ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); }> <%cpp> #define SELECTIF(x) reply.out() << ( (x) ? "selected=\"selected\"" : "" ); #define CHECKIF(x) reply.out() << ( (x) ? "checked=\"checked\"" : "" ); SearchTimers searchtimers; bool testmode = !test.empty(); editsearchtimer = NULL; if ( request.getMethod() == "POST") { SearchTimer searchtimer; if ( !searchtimerid.empty() && !testmode) { editsearchtimer = searchtimers.GetByTimerId( searchtimerid ); if ( editsearchtimer == 0 ) throw HtmlError( tr("Couldn't find searchtimer. Maybe you mistyped your request?") ); searchtimer.SetId(editsearchtimer->Id()); } searchtimer.SetSearch(search); searchtimer.SetSearchMode(mode); searchtimer.SetTolerance(tolerance); searchtimer.SetMatchCase(matchcase); searchtimer.SetUseTitle(usetitle); searchtimer.SetUseSubtitle(usesubtitle); searchtimer.SetUseDescription(usedescr); searchtimer.SetUseExtEPGInfo(useextepginfo); if (useextepginfo) { vector< string > infos; unsigned int i=0; for (ExtEPGInfos::iterator extinfo = extEPGInfos.begin(); extinfo != extEPGInfos.end(); ++extinfo, i++) { ostringstream os; os << extinfo->Id() << "#" << (iSearch(); mode = searchtimer->SearchMode(); tolerance = searchtimer->Tolerance(); matchcase = searchtimer->MatchCase(); usetitle = searchtimer->UseTitle(); usesubtitle = searchtimer->UseSubtitle(); usedescr = searchtimer->UseDescription(); usechannel = searchtimer->UseChannel(); channelfrom = searchtimer->ChannelMin(); channelto = searchtimer->ChannelMax(); if (!channelto.Valid() && channelfrom.Valid()) channelto = channelfrom; if (usechannel == SearchTimer::Group) changrpsel = searchtimer->ChannelText(); usetime = searchtimer->UseTime(); ostringstream os; os << setw(2) << setfill('0') << ( searchtimer->StartTime() / 100 ) % 100; start_h = os.str(); os.str(""); os << setw(2) << setfill('0') << searchtimer->StartTime() % 100; start_m = os.str(); os.str(""); os << setw(2) << setfill('0') << ( searchtimer->StopTime() / 100 ) % 100; stop_h = os.str(); os.str(""); os << setw(2) << setfill('0') << searchtimer->StopTime() % 100; stop_m = os.str(); useduration = searchtimer->UseDuration(); if (useduration) { durationmin = searchtimer->MinDuration(); durationmax = searchtimer->MaxDuration(); } useweekday = searchtimer->UseDayOfWeek(); if (useweekday) { int dayofweek = searchtimer->DayOfWeek(); if (dayofweek >= 0) { wday_sun = (dayofweek == 0); wday_mon = (dayofweek == 1); wday_tue = (dayofweek == 2); wday_wed = (dayofweek == 3); wday_thu = (dayofweek == 4); wday_fri = (dayofweek == 5); wday_sat = (dayofweek == 6); } else { wday_sun = -dayofweek & 0x01; wday_mon = -dayofweek & 0x02; wday_tue = -dayofweek & 0x04; wday_wed = -dayofweek & 0x08; wday_thu = -dayofweek & 0x10; wday_fri = -dayofweek & 0x20; wday_sat = -dayofweek & 0x40; } } useinfavorites = searchtimer->UseInFavorites(); useassearchtimer = searchtimer->UseAsSearchTimer(); if (useassearchtimer == 2) { useassearchtimerfrom = searchtimer->UseAsSearchTimerFrom(tr("mm/dd/yyyy")); useassearchtimerto = searchtimer->UseAsSearchTimerTil(tr("mm/dd/yyyy")); } searchtimeraction = searchtimer->SearchTimerAction(); seriesrecording = searchtimer->UseSeriesRecording(); directory = searchtimer->Directory(); delrecafterdays = searchtimer->DelRecsAfterDays(); keeprecs = searchtimer->KeepRecs(); pauseonrecs = searchtimer->PauseOnRecs(); blacklistmode = searchtimer->BlacklistMode(); switchminbefore = searchtimer->SwitchMinBefore(); useextepginfo = searchtimer->UseExtEPGInfo(); vector< string > infos = searchtimer->ExtEPGInfo(); for(unsigned int i=0; i parts = StringSplit( infos[i], '#' ); extepgvalues.push_back(parts.size() > 1?parts[1]:""); } else extepgvalues.push_back(""); } ignoreMissingEPGCats = searchtimer->IgnoreMissingEPGCats(); avoidrepeats = searchtimer->AvoidRepeats(); allowedrepeats = searchtimer->AllowedRepeats(); repeatswithindays = searchtimer->RepeatsWithinDays(); comparetitle = searchtimer->CompareTitle(); comparesubtitle = searchtimer->CompareSubtitle(); comparesummary = searchtimer->CompareSummary(); for(unsigned int i=0; iCompareCategories() & (1<Priority(); lifetime = searchtimer->Lifetime(); marginstart = searchtimer->MarginStart(); marginstop = searchtimer->MarginStop(); usevps = searchtimer->UseVPS(); delmode = searchtimer->DelMode(); delaftercountrecs = searchtimer->DelAfterCountRecs(); delafterdaysoffirstrec = searchtimer->DelAfterDaysOfFirstRec(); editsearchtimer = searchtimer; } else { for(unsigned int i=0; i(EPGSearchSetupValues::ReadValue("DefPriority")); lifetime = lexical_cast< int >(EPGSearchSetupValues::ReadValue("DefLifetime")); marginstart = lexical_cast< int >(EPGSearchSetupValues::ReadValue("DefMarginStart")); marginstop = lexical_cast< int >(EPGSearchSetupValues::ReadValue("DefMarginStop")); } <& pageelems.doc_type &> VDR Live - <$ editsearchtimer ? tr("Edit search timer") : tr("New search timer") $> <& pageelems.stylesheets &> <& pageelems.ajax_js &> <& pageelems.logo &> <& menu active=("searchtimers") &>
% if (extEPGInfos.size() > 0) { % }
<$ editsearchtimer ? tr("Edit search timer") : tr("New search timer") $>
<$ tr("Search term") $>:
<$ tr("Search mode" ) $>:
<$ tr("Match case") $>:
id="matchcase"/>
<$ tr("Search in") $>:
/>
/>
/>
<$ tr("Use extended EPG info" ) $>:
onclick="changeduseextepginfo(this)" id="useextepginfo"/>
<$ tr("Use channel" ) $>:
<$ tr("Use time") $>:
onclick="changedusetime(this)" id="usetime" />
<$ tr("Use duration") $>:
onclick="changeduseduration(this)" id="useduration" />
<$ tr("Use day of week") $>:
onclick="changeduseweekday(this)" id="useweekday" />
<$ tr("Use blacklists" ) $>:
<$ tr("Use in favorites menu") $>:
/>
<$ tr("Use as search timer" ) $>:
<%include>page_exit.eh