]> git.vomp.tv Git - vompserver.git/commitdiff
Add support for events identified tvmedia in protocoll
authorMarten Richter <marten.richter@freenet.de>
Sat, 13 Sep 2014 10:22:07 +0000 (12:22 +0200)
committerMarten Richter <marten.richter@freenet.de>
Sat, 13 Sep 2014 10:22:07 +0000 (12:22 +0200)
picturereader.c
vdrcommand.h
vompclientrrproc.c
vompclientrrproc.h

index a940ebe33237cf68fa0db12970aa4c26ab599846..d336b3859f9d795e9043636cced9ca6937ff60e1 100644 (file)
@@ -1,5 +1,6 @@
 #include "picturereader.h"
 #include <vdr/plugin.h>
+#include <vdr/channels.h>
 #include <sstream>
 
 
@@ -166,6 +167,30 @@ std::string PictureReader::getPictName(TVMediaRequest & req)
          return std::string("");
       }
    }; break;
+   case 4: { // I do not know
+   // First get the schedules
+      cSchedulesLock MutexLock;
+      const cSchedules *Schedules = cSchedules::Schedules(MutexLock);
+      const cSchedule *Schedule = NULL;
+      if (Schedules)
+      {
+        Schedule = Schedules->GetSchedule(
+                  Channels.GetByChannelID(
+                       tChannelID::FromString(req.primary_name.c_str())));
+      }
+      cEvent *event = NULL;
+      if (Schedule) Schedule->GetEvent(req.primary_id);
+      ScraperGetPosterThumb getter;
+      getter.event = event;
+      getter.recording = NULL;
+      if (x->scraper && event) {
+        x->scraper->Service("GetPosterThumb",&getter);
+        return getter.poster.path;
+      } else {
+         return std::string("");
+      }
+   }; break;
+   
    default:
      return std::string("");
      break;
index 9b2d0e07065bd5ac3fd9d38c857fbcf5da390de7..de3d29f1318f6f5316aeac215528de7e254dc7fc 100644 (file)
@@ -74,6 +74,9 @@ const static ULONG VDR_GETSCRAPERMOVIEINFO = 39;
 const static ULONG VDR_GETSCRAPERSERIESINFO = 40;
 const static ULONG VDR_LOADTVMEDIA          =41;
 const static ULONG VDR_LOADTVMEDIARECTHUMB  =42;
+const static ULONG VDR_GETEVENTSCRAPEREVENTTYPE = 43;
+const static ULONG VDR_LOADTVMEDIAEVENTTHUMB  =44;
+
 const static ULONG VDR_SHUTDOWN            = 666;
 
 class VDR_Command : public SerializableList {
index d8e1bb7c58ef21b3e247f43c2b7ab44684f5b563..f45fa29233e75dcdb0dea35d9e89a4db4ea89b5a 100644 (file)
@@ -290,6 +290,13 @@ bool VompClientRRProc::processPacket()
     case VDR_LOADTVMEDIARECTHUMB:
       result = processLoadTvMediaRecThumb();
     break;
+    case VDR_GETEVENTSCRAPEREVENTTYPE:
+      result = processGetEventScraperEventType();
+    break;
+    case VDR_LOADTVMEDIAEVENTTHUMB:
+      result = processLoadTvMediaEventThumb();
+    break;
+
 #endif
     case VDR_GETMEDIALIST:
       result = processGetMediaList();
@@ -2033,6 +2040,51 @@ int VompClientRRProc::processGetRecScraperEventType()
   return 1;
 }
 
+int VompClientRRProc::processGetEventScraperEventType()
+{
+  ScraperGetEventType call;
+  call.type = tNone;
+  ULONG channelid = ntohl(*(ULONG*)req->data);
+  ULONG eventid = ntohl(*(ULONG*)(req->data+4));
+  const cEvent *event = NULL; 
+  
+  cChannel* channel = x.channelFromNumber(channelid);
+
+#if VDRVERSNUM < 10300
+  cMutexLock MutexLock;
+  const cSchedules *Schedules = cSIProcessor::Schedules(MutexLock);
+#else
+  cSchedulesLock MutexLock;
+  const cSchedules *Schedules = cSchedules::Schedules(MutexLock);
+#endif
+  const cSchedule * Schedule;
+  if (Schedules && channel)
+  {
+     const cSchedule *Schedule = Schedules->GetSchedule(channel->GetChannelID());
+     if (Schedule) {
+        event = Schedule->GetEvent(eventid);
+    }
+  }
+    
+  if (event && x.scraper) 
+  {
+     call.event = event;
+     x.scraper->Service("GetEventType",&call);
+  }
+  resp->addUCHAR(call.type);
+  if (call.type == tMovie)
+  {
+     resp->addLONG(call.movieId);
+  } else if (call.type == tSeries){
+     resp->addLONG(call.seriesId);
+     resp->addLONG(call.episodeId);
+  }
+  resp->finalise();
+  x.tcp.sendPacket(resp->getPtr(), resp->getLen());
+
+  return 1;
+}
+
 #define ADDSTRING_TO_PAKET(y) if ((y)!=0)  resp->addString(x.charconvutf8->Convert(y)); else resp->addString(""); 
 
 int VompClientRRProc::processGetScraperMovieInfo()
@@ -2198,6 +2250,31 @@ int VompClientRRProc::processLoadTvMediaRecThumb()
    return 1;
 }
 
+int VompClientRRProc::processLoadTvMediaEventThumb()
+{
+   TVMediaRequest tvreq;
+   tvreq.streamID = req->requestID;
+   tvreq.type = 4; // unknown but primary_id is set
+   UINT channelid = ntohl(*(ULONG*)req->data);
+   tvreq.primary_id = ntohl(*(ULONG*)(req->data+4));
+   tvreq.secondary_id = 0;
+   cChannel* channel = x.channelFromNumber(channelid);
+
+   if (channel) tvreq.primary_name = std::string((const char*)channel->GetChannelID().ToString());
+   tvreq.type_pict = 1;
+   tvreq.container = 0;
+   tvreq.container_member = 0;
+   log->log("RRProc", Log::DEBUG, "TVMedia request %d %s",req->requestID,req->data);
+   x.pict->addTVMediaRequest(tvreq);
+
+   
+   resp->finalise();
+
+   x.tcp.sendPacket(resp->getPtr(), resp->getLen());
+   
+   return 1;
+}
+
  
 
 
index 0d2cf1e17f6609369583410489aeca1f85a5cc9b..e59fddf8b1bbff0e8a82a7292ac8cdbc68dc7e58 100644 (file)
@@ -88,6 +88,9 @@ class VompClientRRProc : public Thread
     int processGetScraperSeriesInfo();
     int processLoadTvMedia();
     int processLoadTvMediaRecThumb();
+    int processGetEventScraperEventType();
+    int processLoadTvMediaEventThumb();
+
 #endif
     int processLogin();
     int processConfigSave();