From bff3ba2885529c95d7b7694cf265f2d7fa6e4090 Mon Sep 17 00:00:00 2001 From: Christian Wieninger Date: Sun, 15 Apr 2007 18:41:58 +0000 Subject: editing search timers --- pages/edit_searchtimer.ecpp | 710 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 710 insertions(+) create mode 100644 pages/edit_searchtimer.ecpp diff --git a/pages/edit_searchtimer.ecpp b/pages/edit_searchtimer.ecpp new file mode 100644 index 0000000..7328253 --- /dev/null +++ b/pages/edit_searchtimer.ecpp @@ -0,0 +1,710 @@ +<%pre> +#include +#include +#include +#include +#include +#include +#include "exception.h" +#include "tools.h" +#include "epgsearch.h" + +using namespace std; +using namespace vdrlive; + + +<%args> + // input parameters + string searchtimerid; + // 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; + bool useassearchtimer = false; + 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; + bool comparetitle = false; + bool comparesubtitle = false; + bool comparesummary = false; + unsigned avoidrepeatscatselected[]; + int priority = 0; + int lifetime = 0; + int marginstart = 0; + int marginstop = 0; + bool usevps = false; + string blacklistids_internal; + +<%request scope="page"> +SearchTimer* searchtimer; +ExtEPGInfos extEPGInfos; +ChannelGroups channelGroups; +Blacklists blacklists; + + +<%include>page_init.eh +<%cpp> + +#define SELECTIF(x) reply.out() << ( (x) ? "selected=\"selected\"" : "" ); +#define CHECKIF(x) reply.out() << ( (x) ? "checked=\"checked\"" : "" ); + + SearchTimers searchtimers; + + searchtimer = 0; + if ( !searchtimerid.empty() ) { + searchtimer = searchtimers.GetByTimerId( searchtimerid ); + if ( searchtimer == 0 ) + throw HtmlError( tr("Couldn't find searchtimer. Maybe you mistyped your request?") ); + } + + if ( request.getMethod() == "POST" ) { + if ( !searchtimerid.empty() ) + searchtimer = searchtimers.GetByTimerId( searchtimerid ); + else + searchtimer = new SearchTimer; + + 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() << "#" << (iSetExtEPGInfo(infos); + } + searchtimer->SetUseChannel((SearchTimer::eUseChannel)usechannel); + if (usechannel == SearchTimer::Interval) + { + searchtimer->SetChannelMin(channelfrom); + searchtimer->SetChannelMax(channelto); + } + if (usechannel == SearchTimer::Group) + searchtimer->SetChannelText(changrpsel); + + searchtimer->SetUseTime(usetime); + if (usetime) + { + searchtimer->SetStartTime(StringToInt(start_h) * 100 + StringToInt(start_m)); + searchtimer->SetStopTime(StringToInt(stop_h) * 100 + StringToInt(stop_m)); + } + searchtimer->SetUseDuration(useduration); + if (useduration) + { + searchtimer->SetMinDuration(durationmin); + searchtimer->SetMaxDuration(durationmax); + } + searchtimer->SetUseDayOfWeek(useweekday); + if (useweekday) + { + int dayofweek = 0; + if (wday_sun) dayofweek |= 0x01; + if (wday_mon) dayofweek |= 0x02; + if (wday_tue) dayofweek |= 0x04; + if (wday_wed) dayofweek |= 0x08; + if (wday_thu) dayofweek |= 0x10; + if (wday_fri) dayofweek |= 0x20; + if (wday_sat) dayofweek |= 0x40; + searchtimer->SetDayOfWeek(-dayofweek); + } + searchtimer->SetUseInFavorites(useinfavorites); + searchtimer->SetUseAsSearchTimer(useassearchtimer); + searchtimer->SetSearchTimerAction(searchtimeraction); + searchtimer->SetUseSeriesRecording(seriesrecording); + searchtimer->SetDirectory(directory); + searchtimer->SetDelRecsAfterDays(delrecafterdays); + searchtimer->SetKeepRecs(keeprecs); + searchtimer->SetPauseOnRecs(pauseonrecs); + searchtimer->SetBlacklistMode(blacklistmode); + if (blacklistmode == 1) + searchtimer->ParseBlacklist(blacklistids_internal); + + searchtimer->SetSwitchMinBefore(switchminbefore); + + searchtimer->SetAvoidRepeats(avoidrepeats); + if (avoidrepeats) + { + searchtimer->SetCompareTitle(comparetitle); + searchtimer->SetCompareSubtitle(comparesubtitle); + searchtimer->SetCompareSummary(comparesummary); + } + unsigned long catsselected = 0; + for (unsigned int i=0; i< avoidrepeatscatselected.size(); i++) + catsselected |= (1<< (avoidrepeatscatselected[i]-1)); + + searchtimer->SetCompareCategories(catsselected); + searchtimer->SetPriority(priority); + searchtimer->SetLifetime(lifetime); + searchtimer->SetMarginStart(marginstart); + searchtimer->SetMarginStop(marginstop); + searchtimer->SetUseVPS(usevps); + + searchtimers.Save(searchtimer); + return reply.redirect("searchtimers.html"); + + } + pageTitle = searchtimer ? tr("Edit search timer") : tr("New search timer"); + + if ( searchtimer != 0 ) { + search = searchtimer->Search(); + 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(); + 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(""); + } + avoidrepeats = searchtimer->AvoidRepeats(); + 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(); + } + +<& pageelems.doc_type &> + + + <& pageelems.ajax_js &> + + + VDR Live - <$ searchtimer ? tr("Edit search timer") : tr("New search timer") $> + + + +
+ <& pageelems.logo &> + <& menu active=("searchtimers") component=("edit_searchtimer.header") &> +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +% if (extEPGInfos.size() > 0) { + + + + + +% } + + + + + + + + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
<$ 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" ) $>:
+ onclick="changeduseassearchtimer(this)" + id="useassearchtimer"/> +
+ + + +
+
+
+
+ + +<%include>page_exit.eh + +<%def header> +<$ (searchtimer ? tr("Edit search timer") : tr("New search timer")) $> + -- cgit v1.2.3