diff options
Diffstat (limited to 'p2pvr/daemon/schedules.cpp')
-rw-r--r-- | p2pvr/daemon/schedules.cpp | 61 |
1 files changed, 26 insertions, 35 deletions
diff --git a/p2pvr/daemon/schedules.cpp b/p2pvr/daemon/schedules.cpp index dab3917..b97924d 100644 --- a/p2pvr/daemon/schedules.cpp +++ b/p2pvr/daemon/schedules.cpp @@ -31,8 +31,7 @@ END_OPTIONS() class ScheduleCandidate { public: std::string What; - int ServiceId; - int EventId; + int EventUid; int TransportStreamId; datetime StartTime; datetime StopTime; @@ -51,16 +50,14 @@ enum RecordStatuses { class Record { public: Record() { }; - Record(int s, int e, RecordStatuses rs, int sc) : - ServiceId(s), - EventId(e), + Record(int e, RecordStatuses rs, int sc) : + EventUid(e), RecordStatus(rs), ScheduleId(sc) { } - int ServiceId; - int EventId; + int EventUid; RecordStatuses RecordStatus; int ScheduleId; }; @@ -71,8 +68,7 @@ template<> void CreateColumns<P2PVR::ScheduledToRecordPtr>(const ColumnCreator & cc) { - cc("serviceid", true); - cc("eventid", true); + cc("eventuid", true); cc("scheduleid", true); } @@ -80,9 +76,8 @@ template<> void UnbindColumns(RowState & rs, P2PVR::ScheduledToRecordPtr const & s) { - rs.fields[0] >> s->ServiceId; - rs.fields[1] >> s->EventId; - rs.fields[2] >> s->ScheduleId; + rs.fields[0] >> s->EventUid; + rs.fields[1] >> s->ScheduleId; } template<> @@ -91,7 +86,7 @@ CreateColumns<ScheduleCandidatePtr>(const ColumnCreator & cc) { cc("what", true); cc("serviceid", false); - cc("eventid", false); + cc("eventuid", false); cc("transportstreamid", false); cc("starttime", false); cc("stoptime", false); @@ -104,13 +99,12 @@ void UnbindColumns(RowState & rs, ScheduleCandidatePtr const & s) { rs.fields[0] >> s->What; - rs.fields[1] >> s->ServiceId; - rs.fields[2] >> s->EventId; - rs.fields[3] >> s->TransportStreamId; - rs.fields[4] >> s->StartTime; - rs.fields[5] >> s->StopTime; - rs.fields[6] >> s->Priority; - rs.fields[7] >> s->ScheduleId; + rs.fields[1] >> s->EventUid; + rs.fields[2] >> s->TransportStreamId; + rs.fields[3] >> s->StartTime; + rs.fields[4] >> s->StopTime; + rs.fields[5] >> s->Priority; + rs.fields[6] >> s->ScheduleId; } template<> @@ -119,7 +113,7 @@ CreateColumns<P2PVR::SchedulePtr>(const ColumnCreator & cc) { cc("scheduleid", true); cc("serviceid", false); - cc("eventid", false); + cc("eventuid", false); cc("title", false); cc("search", false); cc("priority", false); @@ -134,7 +128,7 @@ UnbindColumns(RowState & rs, P2PVR::SchedulePtr const & s) { rs.fields[0] >> s->ScheduleId; rs.fields[1] >> s->ServiceId; - rs.fields[2] >> s->EventId; + rs.fields[2] >> s->EventUid; rs.fields[3] >> s->Title; rs.fields[4] >> s->Search; rs.fields[5] >> s->Priority; @@ -147,8 +141,7 @@ template<> void CreateColumns<RecordPtr>(const ColumnCreator & cc) { - cc("serviceid", true); - cc("eventid", true); + cc("eventuid", true); cc("recordstatus", false); cc("scheduleid", false); } @@ -157,16 +150,14 @@ template<> void BindColumns(RowState & rs, RecordPtr const & s) { - rs.fields[0] << s->ServiceId; - rs.fields[1] << s->EventId; - rs.fields[2] << (int)s->RecordStatus; - rs.fields[3] << s->ScheduleId; + rs.fields[0] << s->EventUid; + rs.fields[1] << (int)s->RecordStatus; + rs.fields[2] << s->ScheduleId; } -Showing::Showing(unsigned int s, unsigned int e, unsigned int t, unsigned int sc, datetime start, datetime stop, int p, const Episode * ep) : +Showing::Showing(unsigned int e, unsigned int t, unsigned int sc, datetime start, datetime stop, int p, const Episode * ep) : episode(ep), - serviceId(s), - eventId(e), + eventUid(e), priority(p), scheduleId(sc), transportStreamId(t), @@ -338,7 +329,7 @@ Schedules::DoReschedule(const Ice::Current & ice) cur = new Episode(c->What); scheduleList.push_back(cur); } - ShowingPtr s = new Showing(c->ServiceId, c->EventId, c->TransportStreamId, c->ScheduleId, + ShowingPtr s = new Showing(c->EventUid, c->TransportStreamId, c->ScheduleId, c->StartTime, c->StopTime, c->Priority, cur.get()); minPriority = std::min(minPriority, s->priority); cur->showings.push_back(s); @@ -408,7 +399,7 @@ Schedules::DoReschedule(const Ice::Current & ice) } BOOST_FOREACH(const auto & i, c->showings) { if (i) { - records.push_back(RecordPtr(new Record(i->serviceId, i->eventId, + records.push_back(RecordPtr(new Record(i->eventUid, found ? selected.find(i) != selected.end() ? Record_WillRecordThisShowing : Record_WillRecordOtherShowing : Record_CannotRecordAnyShowing, i->scheduleId))); @@ -470,11 +461,11 @@ Schedules::UpdateSchedule(const P2PVR::SchedulePtr & s, const Ice::Current & ice { TxHelper tx(this); if (s->ScheduleId == 0) { - Modify(Schedules_insert, s->ServiceId, s->EventId, s->Title, s->Search, s->Priority, s->Early, s->Late, s->Repeats).second->execute(); + Modify(Schedules_insert, s->ServiceId, s->EventUid, s->Title, s->Search, s->Priority, s->Early, s->Late, s->Repeats).second->execute(); s->ScheduleId = SelectScalar<int>(Schedules_insertNewId); } else { - Modify(Schedules_update, s->ServiceId, s->EventId, s->Title, s->Search, s->Priority, s->Early, s->Late, s->Repeats, s->ScheduleId).second->execute(); + Modify(Schedules_update, s->ServiceId, s->EventUid, s->Title, s->Search, s->Priority, s->Early, s->Late, s->Repeats, s->ScheduleId).second->execute(); } DoReschedule(ice); return s->ScheduleId; |