[vdr-plugin-live] 06/08: Imported Upstream version 0.3.0+git20141029

Tobias Grimm tiber-guest at moszumanska.debian.org
Wed Oct 29 22:33:35 UTC 2014


This is an automated email from the git hooks/post-receive script.

tiber-guest pushed a commit to branch master
in repository vdr-plugin-live.

commit ce572d57419a8f7fbd13e752bb68d22689e99b60
Author: etobi <git at e-tobi.net>
Date:   Wed Oct 29 22:53:08 2014 +0100

    Imported Upstream version 0.3.0+git20141029
---
 .gitignore               |  14 ++
 pages/content.ecpp       |   4 +
 pages/edit_timer.ecpp    |   8 +-
 pages/multischedule.ecpp | 404 ++++++++++++++++++++++++-----------------------
 pages/recordings.ecpp    |   4 +
 pages/timers.ecpp        |   2 +
 tntconfig.cpp            | 166 ++++++++++++-------
 tntfeatures.h            |  12 ++
 8 files changed, 355 insertions(+), 259 deletions(-)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..020d64b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,14 @@
+CVS
+.#*
+*~
+*.o
+*.a
+*.so
+gen_version_suffix.h
+pages/*.cpp
+po/*.mo
+po/live.pot
+.dependencies
+.cvsignore
+.libs
+locale
diff --git a/pages/content.ecpp b/pages/content.ecpp
index 27d827c..cde092f 100644
--- a/pages/content.ecpp
+++ b/pages/content.ecpp
@@ -17,7 +17,11 @@ bool logged_in(false);
 
 string mime("image/png");
 if (request.getArgsCount() > 0) {
+#if TNT_MAPURL_NAMED_ARGS
+	mime = request.getArg("mime-type");
+#else
 	mime = request.getArg(0);
+#endif
 	// dsyslog("vdrlive::content found mime arg (%s)", mime.c_str());
 }
 reply.setContentType(mime);
diff --git a/pages/edit_timer.ecpp b/pages/edit_timer.ecpp
index 299f35a..0fe253c 100644
--- a/pages/edit_timer.ecpp
+++ b/pages/edit_timer.ecpp
@@ -26,7 +26,7 @@ using namespace vdrlive;
 	string async;
 	// form parameters
 	tChannelID channel;
-	bool active = true;
+	int active = 1;
 	string title = "";
 	string date = "";
 	bool wday_mon = false;
@@ -44,7 +44,7 @@ using namespace vdrlive;
 	int priority = 0;
 	int lifetime = 0;
 	string aux = "";
-        string directory = "";
+	string directory = "";
 </%args>
 <%session scope="global">
 bool logged_in(false);
@@ -141,7 +141,7 @@ cTimer* timer;
 		      title = title.substr(directory.size()+1);
 		   }
 		}
-		// TRANSLATORS: only adjust the ordering and separators, don't translate the m's, d's and y's	 
+		// TRANSLATORS: only adjust the ordering and separators, don't translate the m's, d's and y's
 		date = timer->Day() ? DatePickerToC(timer->Day(), tr("mm/dd/yyyy")) : "";
 		wday_mon = timer->WeekDays() & 0x01;
 		wday_tue = timer->WeekDays() & 0x02;
@@ -226,7 +226,7 @@ cTimer* timer;
 					             for (RecordingDirs::iterator rdir = recordingdirs.begin(); rdir != recordingdirs.end(); ++rdir) {
 						        std::string dir = *rdir;
 </%cpp>
-		    					<option value="<$ dir $>" 
+		    					<option value="<$ dir $>"
 %							if (*rdir == directory) {
 							selected="selected"
 %							}
diff --git a/pages/multischedule.ecpp b/pages/multischedule.ecpp
index 976f89f..d4fca9d 100644
--- a/pages/multischedule.ecpp
+++ b/pages/multischedule.ecpp
@@ -25,39 +25,39 @@ struct SchedEntry {
 	string end;
 	string day;
 	string epgid;
-        bool truncated;
-        bool has_timer;
+	bool truncated;
+	bool has_timer;
 	int start_row;
 	int row_count;
 };
 
-        std::string channel_groups_setting;
-        std::vector<std::string> channel_groups_names;
-        std::vector< std::vector<int> > channel_groups_numbers;
-        std::vector<std::string> times_names;
-        std::vector<time_t>      times_start;
+std::string 					channel_groups_setting;
+std::vector<std::string>		channel_groups_names;
+std::vector< std::vector<int> > channel_groups_numbers;
+std::vector<std::string>		times_names;
+std::vector<time_t>      		times_start;
 </%pre>
 <%args>
 	int channel = -1;
 	unsigned int time_para = 0;
 </%args>
 <%session scope="global">
-bool logged_in(false);
+	bool logged_in(false);
 </%session>
 <%request scope="page">
-        unsigned int channel_group=0;
-        unsigned int time_selected=0;
+	unsigned int channel_group=0;
+	unsigned int time_selected=0;
 </%request>
 <%include>page_init.eh</%include>
 <%cpp>
-if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html");
-pageTitle = tr("MultiSchedule");
+	if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html");
+	pageTitle = tr("MultiSchedule");
 
-        ReadLock channelsLock( Channels );
+	ReadLock channelsLock( Channels );
 	if ( !channelsLock )
 		throw HtmlError( tr("Couldn't aquire access to channels, please try again later.") );
 
-#define MAX_CHANNELS 10 
+#define MAX_CHANNELS 10
 #define MAX_DAYS 3
 #define MAX_HOURS 8
 #define MINUTES_PER_ROW 5
@@ -115,7 +115,7 @@ pageTitle = tr("MultiSchedule");
                     thisChannel = thisGroup.substr(0, channelSep );
                     if ( channelSep != thisGroup.npos )
                         thisGroup.erase( 0, channelSep+1 );
-                    else 
+                    else
                         thisGroup = "";
                     int channel_no = lexical_cast< int > (thisChannel);
                     cChannel* Channel = Channels.GetByNumber( channel_no );
@@ -143,8 +143,11 @@ pageTitle = tr("MultiSchedule");
             }
         }
     }
-	if ( channel < 0 ) {
-		if (cDevice::CurrentChannel()) {
+
+	if ( channel < 0 )
+	{
+		if (cDevice::CurrentChannel())
+		{
             // find group corresponding to current channel
             int curGroup =0;
 			int curChannel = cDevice::CurrentChannel();
@@ -162,89 +165,90 @@ pageTitle = tr("MultiSchedule");
             if ( channel < 0 )
                 channel = 0;
 		}
-		else {
+		else
+		{
             channel_group = channel;
 		}
 	}
 
-        if ( channel >= (int)channel_groups_numbers.size() )
-          channel = 0;
-        channel_group = channel;
-{
-    // build time list
-    times_names.clear();
-    times_start.clear();
-    
-    // calculate time of midnight (localtime) and convert back to GMT
-    time_t now = (time(NULL)/3600)*3600;
-    time_t now_local = time(NULL);
-    struct tm tm_r;
-    if ( localtime_r( &now_local, &tm_r ) == 0 ) {
-        ostringstream builder;
-        builder << "cannot represent timestamp " << now_local << " as local time";
-        throw runtime_error( builder.str() );
-    }
-    tm_r.tm_hour=0;
-    tm_r.tm_min=0;
-    tm_r.tm_sec=0;
-    time_t midnight = mktime( &tm_r );
+	if ( channel >= (int)channel_groups_numbers.size() )
+		channel = 0;
+	channel_group = channel;
+	{
+		// build time list
+		times_names.clear();
+		times_start.clear();
 
-    // add four 8h steps per day to the time list
-    for (int i=0; i<4*MAX_DAYS ; i++ )
-    {
-        times_start.push_back( midnight + MAX_HOURS*3600*i );
-    }
-    vector< string > parts = StringSplit( LiveSetup().GetTimes(), ';' );
-    vector< time_t > offsets;
-    vector< string >::const_iterator part = parts.begin();
-    for ( ; part != parts.end(); ++part ) 
-    {
-        try {
-            unsigned int sep = (*part).find(':');
-            std::string hour = (*part).substr(0, sep );
-            if ( sep == (*part).npos )
-            {
-                esyslog("Live: Error parsing time '%s'", (*part).c_str() );
-                continue;
-            }
-            std::string min = (*part).substr(sep+1, (*part).npos );
-            offsets.push_back( lexical_cast<time_t>( hour )*60*60 + lexical_cast<time_t>( min ) *60 );
-        }
-        catch ( const bad_lexical_cast & ) {
-            esyslog("Live: Error parsing time '%s'", part->c_str() );
-        };
-    };
-    // add the time of the favourites to the time list
-    for (int i=0; i< MAX_DAYS ; i++ )
-    {
-        vector< time_t >::const_iterator offset = offsets.begin();
-        for ( ; offset != offsets.end(); ++offset ) 
-        {
-            times_start.push_back( midnight + 24*3600*i + *offset );
-        }
-    }
-    // add now
-    times_start.push_back( now );
-    // sort the times
-    std::sort( times_start.begin(), times_start.end() );
-    // delete every time which has already passed
-    while ( *times_start.begin()< now )
-        times_start.erase(times_start.begin() );
+		// calculate time of midnight (localtime) and convert back to GMT
+		time_t now = (time(NULL)/3600)*3600;
+		time_t now_local = time(NULL);
+		struct tm tm_r;
+		if ( localtime_r( &now_local, &tm_r ) == 0 ) {
+			ostringstream builder;
+			builder << "cannot represent timestamp " << now_local << " as local time";
+			throw runtime_error( builder.str() );
+		}
+		tm_r.tm_hour=0;
+		tm_r.tm_min=0;
+		tm_r.tm_sec=0;
+		time_t midnight = mktime( &tm_r );
 
-    // build the corresponding names
-    for ( vector< time_t >::const_iterator start = times_start.begin();
-          start != times_start.end(); ++start ) 
-    {
-        times_names.push_back(FormatDateTime( tr("%A, %x"), *start)
-                              +std::string(" ")+ FormatDateTime( tr("%I:%M %p"), *start) );
-    }
-    // the first time is now
-    times_names[0]=tr("Now");
+		// add four 8h steps per day to the time list
+		for (int i=0; i<4*MAX_DAYS ; i++ )
+		{
+			times_start.push_back( midnight + MAX_HOURS*3600*i );
+		}
+		vector< string > parts = StringSplit( LiveSetup().GetTimes(), ';' );
+		vector< time_t > offsets;
+		vector< string >::const_iterator part = parts.begin();
+		for ( ; part != parts.end(); ++part )
+		{
+			try {
+				unsigned int sep = (*part).find(':');
+				std::string hour = (*part).substr(0, sep );
+				if ( sep == (*part).npos )
+				{
+					esyslog("Live: Error parsing time '%s'", (*part).c_str() );
+					continue;
+				}
+				std::string min = (*part).substr(sep+1, (*part).npos );
+				offsets.push_back( lexical_cast<time_t>( hour )*60*60 + lexical_cast<time_t>( min ) *60 );
+			}
+			catch ( const bad_lexical_cast & ) {
+				esyslog("Live: Error parsing time '%s'", part->c_str() );
+			};
+		};
+		// add the time of the favourites to the time list
+		for (int i=0; i< MAX_DAYS ; i++ )
+		{
+			vector< time_t >::const_iterator offset = offsets.begin();
+			for ( ; offset != offsets.end(); ++offset )
+			{
+				times_start.push_back( midnight + 24*3600*i + *offset );
+			}
+		}
+		// add now
+		times_start.push_back( now );
+		// sort the times
+		std::sort( times_start.begin(), times_start.end() );
+		// delete every time which has already passed
+		while ( *times_start.begin()< now )
+			times_start.erase(times_start.begin() );
+
+		// build the corresponding names
+		for ( vector< time_t >::const_iterator start = times_start.begin();
+			  start != times_start.end(); ++start )
+		{
+			times_names.push_back(FormatDateTime( tr("%A, %x"), *start)
+								  +std::string(" ")+ FormatDateTime( tr("%I:%M %p"), *start) );
+		}
+		// the first time is now
+		times_names[0]=tr("Now");
 
-    if ( time_para >= times_names.size() )
-        time_para = times_names.size()-1;
-    time_selected=time_para;
-}
+		if ( time_para >= times_names.size() )
+			time_para = times_names.size()-1;
+		time_selected=time_para;
+	}
 </%cpp>
 <& pageelems.doc_type &>
 <html>
@@ -260,116 +264,116 @@ pageTitle = tr("MultiSchedule");
 <%cpp>
 	cSchedulesLock schedulesLock;
 	cSchedules const* schedules = cSchedules::Schedules( schedulesLock );
-       
-        time_t now = time(NULL);
-        if ( time_para >= times_start.size() )
-            time_para = times_start.size()-1;
-        time_t sched_start = (times_start[ time_para ]/300)*300; 
-        time_t max_hours;
-        try {
-          max_hours = lexical_cast<time_t>( LiveSetup().GetScheduleDuration() );
-        }
-        catch ( const bad_lexical_cast & )
-        {
-          esyslog("Live: could not convert '%s' into a schedule duration", LiveSetup().GetScheduleDuration().c_str());
-          max_hours = 8;
-        };
-        if (max_hours > 48)
-            max_hours = 48;
 
-        time_t sched_end = sched_start + 60 * 60 * max_hours;
-        int sched_end_row = ( sched_end - sched_start ) / 60 / MINUTES_PER_ROW;
-        std::list<SchedEntry> table[MAX_CHANNELS];
-        std::vector<std::string> channel_names(channel_groups_numbers[ channel ].size() );
-        std::vector<tChannelID> channel_IDs(channel_groups_numbers[ channel ].size() );
-        if ( channel >= (int)channel_groups_numbers.size() )
-          channel = channel_groups_numbers.size()-1;
-        //for ( int chan = 0; chan<MAX_CHANNELS; chan++)
-        for ( unsigned int j = 0; j<channel_groups_numbers[ channel ].size(); j++)
-        {
-          int prev_row = -1;
+	time_t now = time(NULL);
+	if ( time_para >= times_start.size() )
+	    time_para = times_start.size()-1;
+	time_t sched_start = (times_start[ time_para ]/300)*300;
+	time_t max_hours;
+	try {
+		max_hours = lexical_cast<time_t>( LiveSetup().GetScheduleDuration() );
+	}
+	catch ( const bad_lexical_cast & )
+	{
+		esyslog("Live: could not convert '%s' into a schedule duration", LiveSetup().GetScheduleDuration().c_str());
+		max_hours = 8;
+	};
+	if (max_hours > 48)
+	    max_hours = 48;
 
+	time_t sched_end = sched_start + 60 * 60 * max_hours;
+	int sched_end_row = ( sched_end - sched_start ) / 60 / MINUTES_PER_ROW;
+	std::list<SchedEntry> table[MAX_CHANNELS];
+	std::vector<std::string> channel_names(channel_groups_numbers[ channel ].size() );
+	std::vector<tChannelID> channel_IDs(channel_groups_numbers[ channel ].size() );
+	if ( channel >= (int)channel_groups_numbers.size() )
+		channel = channel_groups_numbers.size()-1;
+	//for ( int chan = 0; chan<MAX_CHANNELS; chan++)
+	for ( unsigned int j = 0; j<channel_groups_numbers[ channel ].size(); j++)
+	{
+		int prev_row = -1;
 
-          int chan = channel_groups_numbers[ channel ][ j ];
 
-          cChannel* Channel = Channels.GetByNumber( chan );
-          if ( ! Channel )
-            continue;
-          if ( Channel->GroupSep() || Channel->Name() == '\0' )
-            continue;
-          channel_names[ j ] = Channel->Name();
-          channel_IDs[ j ] = Channel->GetChannelID();
+		int chan = channel_groups_numbers[ channel ][ j ];
 
-          cSchedule const* Schedule = schedules->GetSchedule( Channel );
-          if ( ! Schedule )
-            continue;
-          for (const cEvent *Event = Schedule->Events()->First(); Event; 
-               Event = Schedule->Events()->Next(Event) ) 
-          {
-            if (Event->EndTime() <= sched_start )
-              continue;
-            if (Event->StartTime() >= sched_end )
-              continue;
+		cChannel* Channel = Channels.GetByNumber( chan );
+		if ( ! Channel )
+			continue;
+		if ( Channel->GroupSep() || Channel->Name() == '\0' )
+			continue;
+		channel_names[ j ] = Channel->Name();
+		channel_IDs[ j ] = Channel->GetChannelID();
 
-            EpgInfoPtr epgEvent = EpgEvents::CreateEpgInfo(Channel, Event);
-            if ( prev_row < 0 && Event->StartTime() > sched_start + MINUTES_PER_ROW )
-            {
-              // insert dummy event at start
-              table[ j ].push_back( SchedEntry() );
-              SchedEntry &en=table[ j ].back();
-              int event_start_row = (Event->StartTime() - sched_start) / 60 / MINUTES_PER_ROW;
-              en.start_row = 0;
-              en.row_count = event_start_row;
-              // no title and no start time = dummy event
-              en.title = "";
-              en.start = "";
-              prev_row = en.start_row + en.row_count;
-            }
-            table[ j ].push_back( SchedEntry() );
-            SchedEntry &en=table[j].back();
+		cSchedule const* Schedule = schedules->GetSchedule( Channel );
+		if ( ! Schedule )
+			continue;
+		for (const cEvent *Event = Schedule->Events()->First(); Event;
+			 Event = Schedule->Events()->Next(Event) )
+		{
+			if (Event->EndTime() <= sched_start )
+				continue;
+			if (Event->StartTime() >= sched_end )
+				continue;
+
+			EpgInfoPtr epgEvent = EpgEvents::CreateEpgInfo(Channel, Event);
+			if ( prev_row < 0 && Event->StartTime() > sched_start + MINUTES_PER_ROW )
+			{
+				// insert dummy event at start
+				table[ j ].push_back( SchedEntry() );
+				SchedEntry &en=table[ j ].back();
+				int event_start_row = (Event->StartTime() - sched_start) / 60 / MINUTES_PER_ROW;
+				en.start_row = 0;
+				en.row_count = event_start_row;
+				// no title and no start time = dummy event
+				en.title = "";
+				en.start = "";
+				prev_row = en.start_row + en.row_count;
+			}
+			table[ j ].push_back( SchedEntry() );
+			SchedEntry &en=table[j].back();
 
-            en.title = epgEvent->Title();
-            en.short_description = epgEvent->ShortDescr();
-            en.description = epgEvent->LongDescr();
-            en.start = epgEvent->StartTime(tr("%I:%M %p"));
-            en.end = epgEvent->EndTime(tr("%I:%M %p"));
-            en.day = epgEvent->StartTime(tr("%A, %b %d %Y"));
-            en.epgid = EpgEvents::EncodeDomId(Channel->GetChannelID(), Event->EventID());
-            en.has_timer = LiveTimerManager().GetTimer(Event->EventID(), Channel->GetChannelID() ) != 0;
+			en.title = epgEvent->Title();
+			en.short_description = epgEvent->ShortDescr();
+			en.description = epgEvent->LongDescr();
+			en.start = epgEvent->StartTime(tr("%I:%M %p"));
+			en.end = epgEvent->EndTime(tr("%I:%M %p"));
+			en.day = epgEvent->StartTime(tr("%A, %b %d %Y"));
+			en.epgid = EpgEvents::EncodeDomId(Channel->GetChannelID(), Event->EventID());
+			en.has_timer = LiveTimerManager().GetTimer(Event->EventID(), Channel->GetChannelID() ) != 0;
 
-            en.start_row = prev_row > 0 ? prev_row : 0;
-            int end_time = Schedule->Events()->Next(Event) ? 
-              Schedule->Events()->Next(Event)->StartTime() :
-              Event->EndTime();
-            if (end_time > sched_end)
-                end_time = sched_end;
-            int next_event_start_row = (end_time - sched_start) / 60 / MINUTES_PER_ROW;
-            en.row_count = next_event_start_row - en.start_row;
-            if ( en.row_count < 1 )
-              en.row_count = 1;
-            prev_row = en.start_row + en.row_count;
+			en.start_row = prev_row > 0 ? prev_row : 0;
+			int end_time = Schedule->Events()->Next(Event) ?
+				Schedule->Events()->Next(Event)->StartTime() :
+				Event->EndTime();
+			if (end_time > sched_end)
+				end_time = sched_end;
+			int next_event_start_row = (end_time - sched_start) / 60 / MINUTES_PER_ROW;
+			en.row_count = next_event_start_row - en.start_row;
+			if ( en.row_count < 1 )
+				en.row_count = 1;
+			prev_row = en.start_row + en.row_count;
 
-            // truncate description if too long
-            en.truncated=false;
-            en.description_trunc=StringWordTruncate( en.description,
-                                                     CHARACTERS_PER_ROW*(en.row_count-2),
-                                                     en.truncated );
+			// truncate description if too long
+			en.truncated=false;
+			en.description_trunc=StringWordTruncate( en.description,
+													 CHARACTERS_PER_ROW*(en.row_count-2),
+													 en.truncated );
 
 
 
-          };
-          if ( table[ j ].begin() == table[ j ].end() )
-          {
-            // no entries... create a single dummy entry       
-            table[ j ].push_back( SchedEntry() );
-            SchedEntry &en=table[ j ].back();
-            en.start_row = 0;
-            en.row_count = sched_end_row;
-            // no title and no start time = dummy event
-            en.title = "";
-            en.start = "";
-          }
-        }
+		};
+		if ( table[ j ].begin() == table[ j ].end() )
+		{
+			// no entries... create a single dummy entry
+			table[ j ].push_back( SchedEntry() );
+			SchedEntry &en=table[ j ].back();
+			en.start_row = 0;
+			en.row_count = sched_end_row;
+			// no title and no start time = dummy event
+			en.title = "";
+			en.start = "";
+		}
+	}
 </%cpp>
 		<table class="mschedule" cellspacing="0" cellpadding="0">
 <%cpp>
@@ -426,7 +430,7 @@ pageTitle = tr("MultiSchedule");
 </%cpp>
 			  
 <%cpp>
-		        }	
+		        }
 </%cpp>
 		       </td>
 <%cpp>
@@ -436,11 +440,11 @@ pageTitle = tr("MultiSchedule");
 </%cpp>
 		                <td class = " time spacer " >   </td>
 <%cpp>
-                                if ( cur_event[channel] == table[channel].end() 
+                                if ( cur_event[channel] == table[channel].end()
                                      || cur_event[channel]->start_row != row )
                                   // no new event in this channel, skip it
                                   continue;
-                                
+
                                 SchedEntry &en=*cur_event[channel];
                                 if (en.title.empty() && en.start.empty() )
                                 {
@@ -451,7 +455,7 @@ pageTitle = tr("MultiSchedule");
 <%cpp>
 				  ++cur_event[channel];
                                   continue;
-                                        
+
                                 }
                                 // output an event cell
 </%cpp>
@@ -460,19 +464,19 @@ pageTitle = tr("MultiSchedule");
                         <div class=" tools1 " >
                           <& pageelems.event_timer epgid=(en.epgid) &>
 <%cpp>
-                           if (LiveFeatures<features::epgsearch>().Recent() ) { 
+                           if (LiveFeatures<features::epgsearch>().Recent() ) {
 </%cpp>
                           <a href="searchresults.html?searchplain=<$ StringUrlEncode(en.title) $>"><img src="<$ LiveSetup().GetThemedLink("img", "search.png") $>" alt="" <& tooltip.hint text=(tr("Search for repeats.")) &>></img></a>
-<%cpp> 
-                           } else { 
-                             </%cpp><img src="img/transparent.png" width="16" height="16"><%cpp> 
+<%cpp>
+                           } else {
+                             </%cpp><img src="img/transparent.png" width="16" height="16"><%cpp>
                            }
 </%cpp>
                           <& pageelems.imdb_info_href title=(en.title) &>
                          </div><div class= "start withmargin"><$ en.start $></div>
 			  <div class="title withmargin"><a <& tooltip.hint text=(StringEscapeAndBreak(tr("Click to view details."))) &><& tooltip.display domId=en.epgid &>><$ en.title $></a></div>
 <%cpp>
-                         if ( en.row_count>2 && !en.short_description.empty() ) 
+                         if ( en.row_count>2 && !en.short_description.empty() )
                          {
 </%cpp>
                           <div class="short withmargin"><$ en.short_description.empty() ? " " : en.short_description $></div>
diff --git a/pages/recordings.ecpp b/pages/recordings.ecpp
index 51018bb..80f145b 100644
--- a/pages/recordings.ecpp
+++ b/pages/recordings.ecpp
@@ -205,7 +205,11 @@ for (recIter = recItems.begin(); recIter != recItems.end(); ++recIter) {
 		<& rec_item_dir name=(recItem->Name()) level=(level) &>
 <%cpp>
 #if TNT_HAS_QUERYPARAMS
+#if TNT_QUERYPARAMS_NO_BOOL
+		tnt::QueryParams recItemParams(qparam);
+#else
 		tnt::QueryParams recItemParams(qparam, false);
+#endif
 #else
 		cxxtools::QueryParams recItemParams(qparam, false);
 #endif
diff --git a/pages/timers.ecpp b/pages/timers.ecpp
index 2a9ee4c..66b5235 100644
--- a/pages/timers.ecpp
+++ b/pages/timers.ecpp
@@ -49,10 +49,12 @@ static const size_t maximumDescriptionLength = 300;
 				throw HtmlError( tr("Sorry, no permission. Please contact your administrator!") );
 			LiveTimerManager().DelTimer(timer);
 			timerNotifier.SetTimerModification();
+			return reply.redirect("timers.html");
 		}
 		if (action == "toggle") {
 			LiveTimerManager().ToggleTimerActive(timer);
 			timerNotifier.SetTimerModification();
+			return reply.redirect("timers.html");
 		}
 	}
 
diff --git a/tntconfig.cpp b/tntconfig.cpp
index 3a1fd14..3325776 100644
--- a/tntconfig.cpp
+++ b/tntconfig.cpp
@@ -3,7 +3,13 @@
 #include <fstream>
 #include <sstream>
 #include <stdexcept>
+#include "tntfeatures.h"
+#if TNT_LOG_SERINFO
+#include <cxxtools/log.h>
+#include <cxxtools/xml/xmldeserializer.h>
+#else
 #include <cxxtools/loginit.h>
+#endif
 #include <tnt/sessionscope.h>
 #include <tnt/httpreply.h>
 #include <vdr/config.h>
@@ -181,19 +187,67 @@ namespace vdrlive {
 #endif
 
 #if TNT_CONFIG_INTERNAL
+	namespace {
+		std::string GetResourcePath()
+		{
+#if APIVERSNUM > 10729
+			string resourceDir(Plugin::GetResourceDirectory());
+			return resourceDir;
+#else
+			string configDir(Plugin::GetConfigDirectory());
+			return configDir;
+#endif
+		}
+
+		void MapUrl(tnt::Tntnet & app, const char *rule, const char * component, std::string const & instPath, const char * pathInfo, const char * mime_type)
+		{
+#if TNT_MAPURL_NAMED_ARGS
+			tnt::Mapping::args_type argMap;
+			argMap.insert(std::make_pair("mime-type", mime_type));
+#endif
+			app.mapUrl(rule, component)
+				.setPathInfo(instPath + pathInfo)
+#if TNT_MAPURL_NAMED_ARGS
+				.setArgs(argMap);
+#else
+				.pushArg(mime_type);
+#endif
+		}
+	}
+
 	void TntConfig::Configure(tnt::Tntnet& app) const
 	{
 		string const configDir(Plugin::GetConfigDirectory());
-#if APIVERSNUM > 10729
-		string const resourceDir(Plugin::GetResourceDirectory());
-#endif
 
+#if TNT_LOG_SERINFO
+		cxxtools::SerializationInfo si;
+		std::istringstream logXmlConf(
+			"<logging>\n"
+			"  <rootlogger>" + LiveSetup().GetTntnetLogLevel() + "</rootlogger>\n"
+			"  <loggers>\n"
+			"    <logger>\n"
+			"      <category>cxxtools</category>\n"
+			"      <level>" + LiveSetup().GetTntnetLogLevel() + "</level>\n"
+			"    </logger>\n"
+			"    <logger>\n"
+			"      <category>tntnet</category>\n"
+			"      <level>" + LiveSetup().GetTntnetLogLevel() + "</level>\n"
+			"    </logger>\n"
+			"  </loggers>\n"
+			"</logging>\n"
+			);
+		cxxtools::xml::XmlDeserializer d(logXmlConf);
+		d.deserialize(si);
+		log_init(si);
+#else
 		std::istringstream logConf(
 			"rootLogger=" + LiveSetup().GetTntnetLogLevel() + "\n"
 			"logger.tntnet=" + LiveSetup().GetTntnetLogLevel() + "\n"
 			"logger.cxxtools=" + LiveSetup().GetTntnetLogLevel() + "\n"
 			);
+
 		log_init(logConf);
+#endif
 
 		// +++ CAUTION +++ CAUTION +++ CAUTION +++ CAUTION +++ CAUTION +++
 		// ------------------------------------------------------------------------
@@ -229,13 +283,12 @@ namespace vdrlive {
 
 		// the following selects the theme specific 'theme.css' file
 		// inserted by 'tadi' -- verified with above, but not counterchecked yet!
-		app.mapUrl("^/themes/([^/]*)/css.*/(.+\\.css)", "content")
-#if APIVERSNUM > 10729
-			.setPathInfo(resourceDir + "/themes/$1/css/$2")
-#else
-			.setPathInfo(configDir + "/themes/$1/css/$2")
-#endif
-			.pushArg("text/css");
+		MapUrl(app,
+			   "^/themes/([^/]*)/css.*/(.+\\.css)",
+			   "content",
+			   GetResourcePath(),
+			   "/themes/$1/css/$2",
+			   "text/css");
 
 		// the following rules provide a search scheme for images. The first
 		// rule where a image is found, terminates the search.
@@ -243,79 +296,82 @@ namespace vdrlive {
 		// 2. /img/<imgname>.<ext>
 		// deprecated: 3. <imgname>.<ext> (builtin images)
 		// inserted by 'tadi' -- verified with above, but not counterchecked yet!
-		app.mapUrl("^/themes/([^/]*)/img.*/(.+)\\.(.+)", "content")
-#if APIVERSNUM > 10729
-			.setPathInfo(resourceDir + "/themes/$1/img/$2.$3")
-#else
-			.setPathInfo(configDir + "/themes/$1/img/$2.$3")
-#endif
-			.pushArg("image/$3");
-		app.mapUrl("^/themes/([^/]*)/img.*/(.+)\\.(.+)", "content")
-#if APIVERSNUM > 10729
-			.setPathInfo(resourceDir + "/img/$2.$3")
-#else
-			.setPathInfo(configDir + "/img/$2.$3")
-#endif
-			.pushArg("image/$3");
+		MapUrl(app,
+			   "^/themes/([^/]*)/img.*/(.+)\\.(.+)",
+			   "content",
+			   GetResourcePath(),
+			   "/themes/$1/img/$2.$3",
+			   "image/$3");
+
+		MapUrl(app,
+			   "^/themes/([^/]*)/img.*/(.+)\\.(.+)",
+			   "content",
+			   GetResourcePath(),
+			   "/img/$2.$3",
+			   "image/$3");
 		// deprecated: file << "MapUrl ^/themes/([^/]*)/img.*/(.+)\\.(.+) $2@" << endl;
 
 		// Epg images
 		string const epgImgPath(LiveSetup().GetEpgImageDir());
 		if (!epgImgPath.empty()) {
 			// inserted by 'tadi' -- verified with above, but not counterchecked yet!
-			app.mapUrl("^/epgimages/([^/]*)\\.([^./]+)", "content")
-				.setPathInfo(epgImgPath + "/$1.$2")
-				.pushArg("image/$2");
+			MapUrl(app,
+				   "^/epgimages/([^/]*)\\.([^./]+)",
+				   "content",
+				   epgImgPath,
+				   "/$1.$2",
+				   "image/$2");
 		}
 
 		// select additional (not build in) javascript.
 		// WARNING: no path components with '.' in the name are allowed. Only
 		// the basename may contain dots and must end with '.js'
 		// inserted by 'tadi' -- verified with above, but not counterchecked yet!
-		app.mapUrl("^/js(/[^.]*)([^/]*\\.js)", "content")
-#if APIVERSNUM > 10729
-			.setPathInfo(resourceDir + "/js$1$2")
-#else
-			.setPathInfo(configDir + "/js$1$2")
-#endif
-			.pushArg("text/javascript");
+		MapUrl(app,
+			   "^/js(/[^.]*)([^/]*\\.js)",
+			   "content",
+			   GetResourcePath(),
+			   "/js$1$2",
+			   "text/javascript");
 
 		// map to 'css/basename(uri)'
 		// inserted by 'tadi' -- verified with above, but not counterchecked yet!
-		app.mapUrl("^/css.*/(.+)", "content")
-#if APIVERSNUM > 10729
-			.setPathInfo(resourceDir + "/css/$1")
-#else
-			.setPathInfo(configDir + "/css/$1")
-#endif
-			.pushArg("text/css");
+		MapUrl(app,
+			   "^/css.*/(.+)",
+			   "content",
+			   GetResourcePath(),
+			   "/css/$1",
+			   "text/css");
 
 		// map to 'img/basename(uri)'
 		// inserted by 'tadi' -- verified with above, but not counterchecked yet!
-		app.mapUrl("^/img.*/(.+)\\.([^.]+)", "content")
-#if APIVERSNUM > 10729
-			.setPathInfo(resourceDir + "/img/$1.$2")
-#else
-			.setPathInfo(configDir + "/img/$1.$2")
-#endif
-			.pushArg("image/$2");
+		MapUrl(app,
+			   "^/img.*/(.+)\\.([^.]+)",
+			   "content",
+			   GetResourcePath(),
+			   "/img/$1.$2",
+			   "image/$2");
 
 		// Map favicon.ico into img directory
-		app.mapUrl("^/favicon.ico$", "content")
-#if APIVERSNUM > 10729
-			.setPathInfo(resourceDir + "/img/favicon.ico")
-#else
-			.setPathInfo(configDir + "/img/favicon.ico")
-#endif
-			.pushArg("image/x-icon");
+		MapUrl(app,
+			   "^/favicon.ico$",
+			   "content",
+			   GetResourcePath(),
+			   "/img/favicon.ico",
+			   "image/x-icon");
 
 		// takes first path components without 'extension' when it does not
 		// contain '.'
 		// modified by 'tadi' -- verified with above, but not counterchecked yet!
 		app.mapUrl("^/([^./]+)(.*)?", "$1");
 
+#if TNT_GLOBAL_TNTCONFIG
+		tnt::TntConfig::it().sessionTimeout = 86400;
+		tnt::TntConfig::it().defaultContentType = string("text/html; charset=") + LiveI18n().CharacterEncoding();
+#else
 		tnt::Sessionscope::setDefaultTimeout(86400);
 		tnt::HttpReply::setDefaultContentType(string("text/html; charset=") + LiveI18n().CharacterEncoding());
+#endif
 
 		Setup::IpList const& ips = LiveSetup().GetServerIps();
 		int port = LiveSetup().GetServerPort();
diff --git a/tntfeatures.h b/tntfeatures.h
index 6de1f88..76d3757 100644
--- a/tntfeatures.h
+++ b/tntfeatures.h
@@ -17,6 +17,9 @@
 // Query params are now in tntnet and not in cxxtools
 #define TNT_HAS_QUERYPARAMS		(TNTVERSION >= 16060)
 
+// Query params without boolean parameter
+#define TNT_QUERYPARAMS_NO_BOOL (TNTVERSION >= 22000)
+
 // One can request the host part of the request url
 #define TNT_HAS_GETHOST			(TNTVERSION >= 16060)
 
@@ -26,4 +29,13 @@
 // version of TNTNET that binds ipv6 addresses with IPV6_V6ONLY flag set to true
 #define TNT_IPV6_V6ONLY	  	    (CXXTOOLVER >= 21000)
 
+// version of TNTNET with properties deserializer for logger configuration args.
+#define TNT_LOG_SERINFO			(CXXTOOLVER >= 22000)
+
+// version of TNTNET wich expects name, value mappings for Url-Mapper arguments.
+#define TNT_MAPURL_NAMED_ARGS	(TNTVERSION >= 22000)
+
+// version of TNTNET where configuration is global
+#define TNT_GLOBAL_TNTCONFIG	(TNTVERSION >= 22000)
+
 #endif // VDR_LIVE_TNTFEATURES_H

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-vdr-dvb/vdr-plugin-live.git



More information about the pkg-vdr-dvb-changes mailing list