Skip to content

Commit

Permalink
Bundled Fix/Features
Browse files Browse the repository at this point in the history
 Feature to update timer via timer_id, minpre, minpost
    
    "TimersResponder:CreateOrUpdateTimer" updated to update timer "minpre" and "minpost" property. 
    Sequence example e.g.: "curl -X PUT -v -H "Content-Type: application/json" -d 'timer_id=S19.2E-1-1019-10301:0:1550876400:1516:1758&minpre=15&minpost=8' localhost:8002/timers.json"

-Fix: NULL value in timer->Aux() field was leading into an error, Fixed in TimersResponder::createOrUpdateTimer(
- Fix timer deadlock
- applied patched from vdr forum, https://www.vdr-portal.de/forum/index.php?thread/131645-restfulapi-fix/&postID=1303965&highlight=restfulapi#post1303965
  • Loading branch information
frank0304 committed Feb 28, 2019
1 parent 96a03b3 commit 0884c04
Show file tree
Hide file tree
Showing 8 changed files with 296 additions and 96 deletions.
6 changes: 3 additions & 3 deletions epgsearch/services.h
Expand Up @@ -157,7 +157,7 @@ class cServiceHandler
struct Epgsearch_services_v1_0
{
// in/out
std::auto_ptr<cServiceHandler> handler;
std::unique_ptr<cServiceHandler> handler;
};

// Data structures for service "Epgsearch-services-v1.1"
Expand All @@ -173,7 +173,7 @@ class cServiceHandler_v1_1 : public cServiceHandler
struct Epgsearch_services_v1_1
{
// in/out
std::auto_ptr<cServiceHandler_v1_1> handler;
std::unique_ptr<cServiceHandler_v1_1> handler;
};

// Data structures for service "Epgsearch-services-v1.2"
Expand All @@ -189,7 +189,7 @@ class cServiceHandler_v1_2 : public cServiceHandler_v1_1
struct Epgsearch_services_v1_2
{
// in/out
std::auto_ptr<cServiceHandler_v1_2> handler;
std::unique_ptr<cServiceHandler_v1_2> handler;
};

#endif
32 changes: 29 additions & 3 deletions events.cpp
Expand Up @@ -28,7 +28,7 @@ void EventsResponder::reply(ostream& out, cxxtools::http::Request& request, cxxt

void EventsResponder::replyEvents(ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply)
{
QueryHandler q("/events", request);
QueryHandler q("/events", request);

if ( request.method() != "GET") {

Expand All @@ -38,7 +38,7 @@ void EventsResponder::replyEvents(ostream& out, cxxtools::http::Request& request


EventList* eventList;

if ( q.isFormat(".json") ) {
reply.addHeader("Content-Type", "application/json; charset=utf-8");
eventList = (EventList*)new JsonEventList(&out);
Expand All @@ -65,6 +65,8 @@ void EventsResponder::replyEvents(ostream& out, cxxtools::http::Request& request
string onlyCount = q.getOptionAsString("only_count");

#if APIVERSNUM > 20300
/* create a dummer timer lock to avoid deadlock*/
LOCK_TIMERS_READ;
LOCK_CHANNELS_READ;
const cChannels& channels = *Channels;
#else
Expand Down Expand Up @@ -113,7 +115,31 @@ void EventsResponder::replyEvents(ostream& out, cxxtools::http::Request& request
int total = 0;
for(int i=0; i<channels.Count(); i++) {
const cSchedule *Schedule = Schedules->GetSchedule(channels.Get(i)->GetChannelID());


#if APIVERSNUM > 20300
if (Channels->Get(i)->GroupSep()) { // we have a group-separator
if (channel_from > 0) channel_from += 1;
if (channel_to > 0 && channel_to < Channels->Count()) channel_to += 1;
continue;
}

if (!Schedule) {
channel_from += 1;
if (channel_to < Channels->Count()) channel_to += 1;
}
#else
if (Channels.Get(i)->GroupSep()) { // we have a group-separator
if (channel_from > 0) channel_from += 1;
if (channel_to > 0 && channel_to < Channels.Count()) channel_to += 1;
continue;
}

if (!Schedule) {
channel_from += 1;
if (channel_to < Channels.Count()) channel_to += 1;
}
#endif

if ((channel == NULL || strcmp(channel->GetChannelID().ToString(), channels.Get(i)->GetChannelID().ToString()) == 0) && (i >= channel_from && i <= channel_to)) {
if (!Schedule) {
if (channel != NULL) {
Expand Down

0 comments on commit 0884c04

Please sign in to comment.