diff options
author | randomdan <randomdan@localhost> | 2013-05-30 11:10:49 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2013-05-30 11:10:49 +0000 |
commit | dab012c11f59e84c0b68ac8c6ff7f3111c593c90 (patch) | |
tree | 14c01b6de78c3599dcc6049b712e09a75953cfa8 | |
parent | Tidy up and create a separate comms module (diff) | |
download | p2pvr-dab012c11f59e84c0b68ac8c6ff7f3111c593c90.tar.bz2 p2pvr-dab012c11f59e84c0b68ac8c6ff7f3111c593c90.tar.xz p2pvr-dab012c11f59e84c0b68ac8c6ff7f3111c593c90.zip |
Tidy up, extend ICE interface
-rw-r--r-- | p2pvr/cron/epg.xml (renamed from p2pvr/cron/schedule.xml) | 2 | ||||
-rw-r--r-- | p2pvr/cron/importEpg.xml (renamed from p2pvr/cron/importSchedule.xml) | 2 | ||||
-rw-r--r-- | p2pvr/ice/Jamfile.jam | 4 | ||||
-rw-r--r-- | p2pvr/ice/p2pvr.ice | 56 | ||||
-rw-r--r-- | p2pvr/ice/p2tv.ice | 9 | ||||
-rw-r--r-- | p2pvr/scanner/Jamfile.jam | 20 | ||||
-rw-r--r-- | p2pvr/scanner/epgRows.cpp (renamed from p2pvr/scanner/eitRows.cpp) | 46 | ||||
-rw-r--r-- | p2pvr/scanner/epgRows.h (renamed from p2pvr/scanner/eitRows.h) | 34 |
8 files changed, 107 insertions, 66 deletions
diff --git a/p2pvr/cron/schedule.xml b/p2pvr/cron/epg.xml index 8d76e99..8fa9828 100644 --- a/p2pvr/cron/schedule.xml +++ b/p2pvr/cron/epg.xml @@ -1,7 +1,7 @@ <?xml version="1.0"?> <block name="importSchedule" xmlns:p2="http://project2.randomdan.homeip.net"> <p2:library path="libp2pvr-scan-p2.so" /> - <p2:eitrows name="schedule" demux="/dev/dvb/adapter0/demux0" /> + <p2:epgrows name="schedule" demux="/dev/dvb/adapter0/demux0" /> <p2:view name="showSchedule" source="schedule" rootname="sched" recordname="show"> <columns> <title source="parent" attribute="title" depth="1" /> diff --git a/p2pvr/cron/importSchedule.xml b/p2pvr/cron/importEpg.xml index 2cc0765..c3858f5 100644 --- a/p2pvr/cron/importSchedule.xml +++ b/p2pvr/cron/importEpg.xml @@ -1,7 +1,7 @@ <?xml version="1.0"?> <block name="importSchedule" xmlns:p2="http://project2.randomdan.homeip.net"> <p2:library path="libp2pvr-scan-p2.so" /> - <p2:eitrows name="schedule" demux="/dev/dvb/adapter0/demux0" /> + <p2:epgrows name="schedule" demux="/dev/dvb/adapter0/demux0" /> <p2:sqlmerge name="mergeSchedule" datasource="postgres" targettable="programs"> <p2:iterate name="programs" source="schedule"> <p2:sqlmergeinsert name="insertProgram"> diff --git a/p2pvr/ice/Jamfile.jam b/p2pvr/ice/Jamfile.jam index e77a3ae..9055b2e 100644 --- a/p2pvr/ice/Jamfile.jam +++ b/p2pvr/ice/Jamfile.jam @@ -4,8 +4,8 @@ lib Ice : : <name>Ice ; lib IceUtil : : <name>IceUtil ; lib pthread : : <name>pthread ; -lib p2tvice : - p2tv.ice : +lib p2pvrice : + [ glob *.ice ] : <library>Ice <library>IceUtil <library>pthread diff --git a/p2pvr/ice/p2pvr.ice b/p2pvr/ice/p2pvr.ice new file mode 100644 index 0000000..aaa01bf --- /dev/null +++ b/p2pvr/ice/p2pvr.ice @@ -0,0 +1,56 @@ +module P2TV { + struct Recording { + int recordingId; + string Title; + string Subtitle; + string Description; + long startTime; + long endTime; + long fileSize; + int serviceId; + }; + sequence<Recording> RecordingList; + + struct Schedule { + int scheduleId; + }; + sequence<Schedule> ScheduleList; + + struct Program { + int programId; + int serviceId; + int eventId; + string Title; + string Subtitle; + string Description; + long startTime; + long endTime; + }; + sequence<Program> ProgramList; + + struct Service { + int serviceId; + string name; + string authority; + }; + sequence<Service> ServiceList; + + interface Recordings { + idempotent void DeleteRecording(int recordingId); + idempotent RecordingList GetRecordings(); + }; + + interface Schedules { + idempotent void DeleteSchedule(int scheduleId); + idempotent ScheduleList GetSchedules(); + idempotent int UpdateSchedule(Schedule newSchedule); + idempotent void DoReschedule(); + }; + + interface EPG { + idempotent ServiceList GetServices(); + idempotent ProgramList GetPrograms(int serviceId, int limit); + idempotent ProgramList GetNowAndNext(); + }; +}; + diff --git a/p2pvr/ice/p2tv.ice b/p2pvr/ice/p2tv.ice deleted file mode 100644 index 7602ffa..0000000 --- a/p2pvr/ice/p2tv.ice +++ /dev/null @@ -1,9 +0,0 @@ -module P2TV { - interface Recordings { - void DeleteRecording(int recordingId); - }; - interface Schedules { - void DoReschedule(); - }; -}; - diff --git a/p2pvr/scanner/Jamfile.jam b/p2pvr/scanner/Jamfile.jam index e7af082..768e86c 100644 --- a/p2pvr/scanner/Jamfile.jam +++ b/p2pvr/scanner/Jamfile.jam @@ -1,23 +1,17 @@ -lib boost_regex : : <name>boost_regex ; - +alias glibmm : : : : + <cflags>"`pkg-config --cflags glibmm-2.4`" + <linkflags>"`pkg-config --libs glibmm-2.4`" + ; project : requirements <variant>debug:<linkflags>-Wl,-z,defs <cflags>"-W -Wall -Werror -Wwrite-strings" ; -# Scanner - the common part implementing the ICE interface -lib p2pvr-scan-ice : icescan.cpp scanner.ice : <library>p2pvr-scan-p2 ; - # Scanner - t -lib p2pvr-scan-p2 : - eitRows.cpp - serviceRows.cpp - dvbSiReaderHelper.cpp +lib p2pvrscanner : + [ glob *.cpp ] : <library>../../project2/common//p2common + <library>glibmm ; -# ScannerICE - the ICE test app -#exe scanice : ice_scan.cpp : <library>p2pvr-scan ; - -explicit p2pvr-scan-ice ; diff --git a/p2pvr/scanner/eitRows.cpp b/p2pvr/scanner/epgRows.cpp index cb69882..7cf8de6 100644 --- a/p2pvr/scanner/eitRows.cpp +++ b/p2pvr/scanner/epgRows.cpp @@ -44,10 +44,10 @@ #include "si_tables.h" #include "rowProcessor.h" -#include "eitRows.h" +#include "epgRows.h" #include <boost/tuple/tuple_comparison.hpp> -struct EitProgram { +struct EpgProgram { VariableType serviceID; VariableType eventID; VariableType title; @@ -85,24 +85,24 @@ getMember(M C::*t, C * p) { SimpleMessageException(NoSuchAttribute); void -EitRows::loadComplete(const CommonObjects *) +EpgRows::loadComplete(const CommonObjects *) { } -EitRowState::EitRowState() : +EpgRowState::EpgRowState() : current(NULL) { } const Columns & -EitRowState::getColumns() const +EpgRowState::getColumns() const { return columns; } -#define returnAttr(name) if (attrName == #name) return boost::bind(getMember<EitProgram, VariableType>, &EitProgram::name, boost::ref(current)) +#define returnAttr(name) if (attrName == #name) return boost::bind(getMember<EpgProgram, VariableType>, &EpgProgram::name, boost::ref(current)) RowState::RowAttribute -EitRowState::resolveAttr(const Glib::ustring & attrName) const { +EpgRowState::resolveAttr(const Glib::ustring & attrName) const { returnAttr(serviceID); returnAttr(eventID); returnAttr(title); @@ -132,15 +132,15 @@ EitRowState::resolveAttr(const Glib::ustring & attrName) const { throw NoSuchAttribute(attrName); } -DECLARE_LOADER("eitrows", EitRows); +DECLARE_LOADER("epgrows", EpgRows); -EitRows::EitRows(const ScriptNodePtr p) : +EpgRows::EpgRows(const ScriptNodePtr p) : RowSet(p), DvbSiReaderHelper(p) { } -EitRows::~EitRows() +EpgRows::~EpgRows() { } @@ -152,7 +152,7 @@ static Glib::RefPtr<Glib::Regex> yearRegex = Glib::Regex::create("\\(([0-9]{4})[ static Glib::RefPtr<Glib::Regex> flagsRegex = Glib::Regex::create("[ []+([A-Z,]+)\\]"); void -EitRowState::parseEventDescription(const u_char * data, EitProgram * current) const { +EpgRowState::parseEventDescription(const u_char * data, EpgProgram * current) const { assert(GetDescriptorTag(data) == 0x4D); const struct descr_short_event *evtdesc = reinterpret_cast<const struct descr_short_event *>(data); @@ -233,7 +233,7 @@ EitRowState::parseEventDescription(const u_char * data, EitProgram * current) co /* Parse 0x4E Extended Event Descriptor. {{{ */ void -EitRowState::parseLongEventDescription(const u_char * data, EitProgram * current) const { +EpgRowState::parseLongEventDescription(const u_char * data, EpgProgram * current) const { assert(GetDescriptorTag(data) == 0x4E); const struct descr_extended_event *levt = reinterpret_cast<const struct descr_extended_event *>(data); bool non_empty = (levt->descriptor_number || levt->last_descriptor_number || levt->length_of_items || levt->data[0]); @@ -275,7 +275,7 @@ EitRowState::parseLongEventDescription(const u_char * data, EitProgram * current only output the first one of each (XMLTV can't cope with more than one) */ void -EitRowState::parseComponentDescription(const u_char * data, EitProgram * current) const { +EpgRowState::parseComponentDescription(const u_char * data, EpgProgram * current) const { assert(GetDescriptorTag(data) == 0x50); const struct descr_component *dc = reinterpret_cast<const struct descr_component *>(data); @@ -300,7 +300,7 @@ EitRowState::parseComponentDescription(const u_char * data, EitProgram * current } /*}}}*/ void -EitRowState::parseContentDescription(const u_char * data, EitProgram * current) const { +EpgRowState::parseContentDescription(const u_char * data, EpgProgram * current) const { assert(GetDescriptorTag(data) == 0x54); const struct descr_content * dc = reinterpret_cast<const struct descr_content *>(data); for (const u_char * p = reinterpret_cast<const u_char*>(&dc->data); p < data + DESCR_GEN_LEN + dc->descriptor_length; p += NIBBLE_CONTENT_LEN) { @@ -312,7 +312,7 @@ EitRowState::parseContentDescription(const u_char * data, EitProgram * current) } void -EitRowState::parseRatingDescription(const u_char * data, EitProgram * current) const { +EpgRowState::parseRatingDescription(const u_char * data, EpgProgram * current) const { assert(GetDescriptorTag(data) == 0x55); const struct descr_parental_rating * pr = reinterpret_cast<const struct descr_parental_rating *>(data); for (const u_char * p = reinterpret_cast<const u_char *>(&pr->data); p < data + DESCR_GEN_LEN + pr->descriptor_length; p += PARENTAL_RATING_ITEM_LEN) { @@ -337,7 +337,7 @@ int parsePrivateDataSpecifier(const u_char *data) { /* Parse 0x76 Content Identifier Descriptor. {{{ */ /* See ETSI TS 102 323, section 12 */ void -EitRowState::parseContentIdentifierDescription(const u_char * data, EitProgram * current) const { +EpgRowState::parseContentIdentifierDescription(const u_char * data, EpgProgram * current) const { assert(GetDescriptorTag(data) == 0x76); const struct descr_content_identifier *ci = reinterpret_cast<const struct descr_content_identifier *>(data); for (const u_char * p = reinterpret_cast<const u_char *>(&ci->data); p < data + DESCR_GEN_LEN + ci->descriptor_length; p += DESCR_GEN_LEN + ci->descriptor_length) { @@ -379,7 +379,7 @@ EitRowState::parseContentIdentifierDescription(const u_char * data, EitProgram * 'new', 'subtitles', 'rating', 'star-rating' */ void -EitRowState::parseDescription(const u_char * data, size_t len, EitProgram * current) const { +EpgRowState::parseDescription(const u_char * data, size_t len, EpgProgram * current) const { int pds = 0; for (const u_char * p = data; p < data + len; p += DESCR_GEN_LEN + GetDescriptorLength(p)) { const struct descr_gen *desc = reinterpret_cast<const struct descr_gen *>(p); @@ -449,7 +449,7 @@ static bool validateDescription(const u_char *data, size_t len) { } /*}}}*/ bool -EitRowState::parseInfoTable(const u_char *data, size_t len, const RowProcessor * rp) { +EpgRowState::parseInfoTable(const u_char *data, size_t len, const RowProcessor * rp) { const struct eit *e = reinterpret_cast<const struct eit *>(data); len -= 4; //remove CRC @@ -475,7 +475,7 @@ EitRowState::parseInfoTable(const u_char *data, size_t len, const RowProcessor * BcdCharToInt(evt->start_time_h) + time_offset, BcdCharToInt(evt->start_time_m), BcdCharToInt(evt->start_time_s)); - EitProgram results; + EpgProgram results; current = &results; results.startTime = startTime; results.stopTime = startTime + boost::posix_time::time_duration( @@ -502,7 +502,7 @@ EitRowState::parseInfoTable(const u_char *data, size_t len, const RowProcessor * SimpleMessageException(DemuxSetFilterFailure); void -EitRows::filterInput(int fd) const +EpgRows::filterInput(int fd) const { struct dmx_sct_filter_params sctFilterParams; memset(&sctFilterParams, 0, sizeof(dmx_sct_filter_params)); @@ -518,11 +518,11 @@ EitRows::filterInput(int fd) const } void -EitRows::execute(const Glib::ustring &, const RowProcessor * rp) const +EpgRows::execute(const Glib::ustring &, const RowProcessor * rp) const { - EitRowState state; + EpgRowState state; openInput(); - readTables(boost::bind(&EitRowState::parseInfoTable, &state, _1, _2, rp)); + readTables(boost::bind(&EpgRowState::parseInfoTable, &state, _1, _2, rp)); closeInput(); } diff --git a/p2pvr/scanner/eitRows.h b/p2pvr/scanner/epgRows.h index 2a3603f..6f155e2 100644 --- a/p2pvr/scanner/eitRows.h +++ b/p2pvr/scanner/epgRows.h @@ -1,5 +1,5 @@ -#ifndef EITROWS_H -#define EITROWS_H +#ifndef EPGROWS_H +#define EPGROWS_H #include "scripts.h" #include "rowSet.h" @@ -7,12 +7,12 @@ #include "dvbSiReaderHelper.h" #include <boost/tuple/tuple.hpp> -class EitProgram; +class EpgProgram; -class EitRows : public RowSet, DvbSiReaderHelper { +class EpgRows : public RowSet, DvbSiReaderHelper { public: - EitRows(const ScriptNodePtr p); - ~EitRows(); + EpgRows(const ScriptNodePtr p); + ~EpgRows(); void execute(const Glib::ustring &, const RowProcessor *) const; void loadComplete(const CommonObjects *); @@ -21,30 +21,30 @@ class EitRows : public RowSet, DvbSiReaderHelper { void filterInput(int fd) const; }; -class EitRowState : public RowState, DvbSiParserHelper { +class EpgRowState : public RowState, DvbSiParserHelper { public: - EitRowState(); + EpgRowState(); const Columns & getColumns() const; RowAttribute resolveAttr(const Glib::ustring & attrName) const; bool parseInfoTable(const u_char *data, size_t len, const RowProcessor *); private: - void parseEventDescription(const u_char *data, EitProgram * current) const; - void parseLongEventDescription(const u_char *data, EitProgram * current) const; - void parseComponentDescription(const u_char *data, EitProgram * current) const; - void parseContentDescription(const u_char *data, EitProgram * current) const; - void parseRatingDescription(const u_char *data, EitProgram * current) const; - void parseContentIdentifierDescription(const u_char *data, EitProgram * current) const; - void parseDescription(const u_char * data, size_t len, EitProgram * current) const; + void parseEventDescription(const u_char *data, EpgProgram * current) const; + void parseLongEventDescription(const u_char *data, EpgProgram * current) const; + void parseComponentDescription(const u_char *data, EpgProgram * current) const; + void parseContentDescription(const u_char *data, EpgProgram * current) const; + void parseRatingDescription(const u_char *data, EpgProgram * current) const; + void parseContentIdentifierDescription(const u_char *data, EpgProgram * current) const; + void parseDescription(const u_char * data, size_t len, EpgProgram * current) const; typedef boost::tuple<int, int> SeenProgram; typedef std::set<SeenProgram> SeenPrograms; SeenPrograms seenPrograms; Columns columns; - friend class EitRows; - mutable EitProgram * current; + friend class EpgRows; + mutable EpgProgram * current; }; |