From d860353d9c2f9f531d108236bad9827fb165f68b Mon Sep 17 00:00:00 2001 From: randomdan Date: Fri, 13 Dec 2013 18:23:39 +0000 Subject: Extend interface for currently held recordings --- p2pvr/datasources/schema.sql | 181 +++++++++++++++++++++++++++++++------------ p2pvr/ice/p2pvr.ice | 20 +++-- 2 files changed, 146 insertions(+), 55 deletions(-) diff --git a/p2pvr/datasources/schema.sql b/p2pvr/datasources/schema.sql index a3f5769..6dff1ec 100644 --- a/p2pvr/datasources/schema.sql +++ b/p2pvr/datasources/schema.sql @@ -29,6 +29,55 @@ SET default_tablespace = ''; SET default_with_oids = false; +-- +-- Name: events; Type: TABLE; Schema: public; Owner: gentoo; Tablespace: +-- + +CREATE TABLE events ( + serviceid integer NOT NULL, + eventid integer NOT NULL, + title text, + titlelang text, + subtitle text, + description text, + descriptionlang text, + videoaspect smallint, + videoframerate smallint, + videohd boolean, + audiochannels smallint, + audiolanguage text, + subtitlelanguage text, + category smallint, + subcategory smallint, + usercategory smallint, + dvbrating smallint, + starttime timestamp without time zone, + stoptime timestamp without time zone, + episode smallint, + episodes smallint, + year smallint, + flags text, + season integer +); + + +ALTER TABLE public.events OWNER TO gentoo; + +-- +-- Name: event_tsvector(events); Type: FUNCTION; Schema: public; Owner: gentoo +-- + +CREATE FUNCTION event_tsvector(e events) RETURNS tsvector + LANGUAGE sql STABLE LEAKPROOF + AS $$ +select (setweight(to_tsvector('english', e.title), 'A') || + setweight(to_tsvector('english', e.subtitle), 'B') || + setweight(to_tsvector('english', e.description), 'C')); +$$; + + +ALTER FUNCTION public.event_tsvector(e events) OWNER TO gentoo; + -- -- Name: delivery_dvbc; Type: TABLE; Schema: public; Owner: gentoo; Tablespace: -- @@ -101,55 +150,6 @@ CREATE TABLE event_schedule ( ALTER TABLE public.event_schedule OWNER TO gentoo; --- --- Name: events; Type: TABLE; Schema: public; Owner: gentoo; Tablespace: --- - -CREATE TABLE events ( - serviceid integer NOT NULL, - eventid integer NOT NULL, - title text, - titlelang text, - subtitle text, - description text, - descriptionlang text, - videoaspect smallint, - videoframerate smallint, - videohd boolean, - audiochannels smallint, - audiolanguage text, - subtitlelanguage text, - category smallint, - subcategory smallint, - usercategory smallint, - dvbrating smallint, - starttime timestamp without time zone, - stoptime timestamp without time zone, - episode smallint, - episodes smallint, - year smallint, - flags text, - season integer -); - - -ALTER TABLE public.events OWNER TO gentoo; - --- --- Name: event_tsvector(events); Type: FUNCTION; Schema: public; Owner: gentoo --- - -CREATE FUNCTION event_tsvector(e events) RETURNS tsvector - LANGUAGE sql STABLE LEAKPROOF - AS $$ -select (setweight(to_tsvector('english', e.title), 'A') || - setweight(to_tsvector('english', e.subtitle), 'B') || - setweight(to_tsvector('english', e.description), 'C')); -$$; - - -ALTER FUNCTION public.event_tsvector(e events) OWNER TO gentoo; - -- -- Name: networks; Type: TABLE; Schema: public; Owner: gentoo; Tablespace: -- @@ -214,6 +214,46 @@ ALTER TABLE public.recorded_recordedid_seq OWNER TO gentoo; ALTER SEQUENCE recorded_recordedid_seq OWNED BY recorded.recordedid; +-- +-- Name: recordings; Type: TABLE; Schema: public; Owner: gentoo; Tablespace: +-- + +CREATE TABLE recordings ( + recordingid integer NOT NULL, + storageaddress text NOT NULL, + guid text NOT NULL, + scheduleid integer NOT NULL, + title text, + subtitle text, + description text, + starttime timestamp without time zone NOT NULL, + duration interval NOT NULL +); + + +ALTER TABLE public.recordings OWNER TO gentoo; + +-- +-- Name: recordings_recordingid_seq; Type: SEQUENCE; Schema: public; Owner: gentoo +-- + +CREATE SEQUENCE recordings_recordingid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.recordings_recordingid_seq OWNER TO gentoo; + +-- +-- Name: recordings_recordingid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: gentoo +-- + +ALTER SEQUENCE recordings_recordingid_seq OWNED BY recordings.recordingid; + + -- -- Name: schedules; Type: TABLE; Schema: public; Owner: gentoo; Tablespace: -- @@ -308,6 +348,13 @@ ALTER TABLE public.transportstreams OWNER TO gentoo; ALTER TABLE ONLY recorded ALTER COLUMN recordedid SET DEFAULT nextval('recorded_recordedid_seq'::regclass); +-- +-- Name: recordingid; Type: DEFAULT; Schema: public; Owner: gentoo +-- + +ALTER TABLE ONLY recordings ALTER COLUMN recordingid SET DEFAULT nextval('recordings_recordingid_seq'::regclass); + + -- -- Name: scheduleid; Type: DEFAULT; Schema: public; Owner: gentoo -- @@ -371,6 +418,14 @@ ALTER TABLE ONLY recorded ADD CONSTRAINT pk_recorded PRIMARY KEY (recordedid); +-- +-- Name: pk_recordings; Type: CONSTRAINT; Schema: public; Owner: gentoo; Tablespace: +-- + +ALTER TABLE ONLY recordings + ADD CONSTRAINT pk_recordings PRIMARY KEY (recordingid); + + -- -- Name: pk_records; Type: CONSTRAINT; Schema: public; Owner: gentoo; Tablespace: -- @@ -446,6 +501,34 @@ CREATE INDEX idx_recorded_starttime ON recorded USING btree (starttime); CREATE INDEX idx_recorded_title ON recorded USING btree (title); +-- +-- Name: idx_recordings_schedule; Type: INDEX; Schema: public; Owner: gentoo; Tablespace: +-- + +CREATE INDEX idx_recordings_schedule ON recordings USING btree (scheduleid); + + +-- +-- Name: idx_recordings_starttime; Type: INDEX; Schema: public; Owner: gentoo; Tablespace: +-- + +CREATE INDEX idx_recordings_starttime ON recordings USING btree (starttime); + + +-- +-- Name: idx_recordings_title; Type: INDEX; Schema: public; Owner: gentoo; Tablespace: +-- + +CREATE INDEX idx_recordings_title ON recordings USING btree (title); + + +-- +-- Name: uni_recordings_storage; Type: INDEX; Schema: public; Owner: gentoo; Tablespace: +-- + +CREATE UNIQUE INDEX uni_recordings_storage ON recordings USING btree (storageaddress, guid); + + -- -- Name: fk_delivery_dvbc_transportstream; Type: FK CONSTRAINT; Schema: public; Owner: gentoo -- diff --git a/p2pvr/ice/p2pvr.ice b/p2pvr/ice/p2pvr.ice index b4aeb8a..e37f2a0 100644 --- a/p2pvr/ice/p2pvr.ice +++ b/p2pvr/ice/p2pvr.ice @@ -173,15 +173,16 @@ module P2PVR { sequence ProgramList; // Something that we have recorded. - struct Recording { + class Recording { int RecordingId; + string StorageAddress; + string Guid; + optional(1) int ScheduleId; string Title; - string Subtitle; - string Description; + optional(2) string Subtitle; + optional(3) string Description; Common::DateTime StartTime; - Common::DateTime EndTime; - long FileSize; - int ServiceId; + string Duration; }; sequence RecordingList; @@ -254,7 +255,14 @@ module P2PVR { idempotent void UpdateEvents(short type); }; + interface Storage { + idempotent string CreateForEventRecording(Schedule sc, DVBSI::Service se, DVBSI::Event ev); + idempotent RawDataClient OpenForWrite(string guid); + idempotent void Delete(string guid); + }; + interface Recordings { + idempotent int NewRecording(Recording rec); idempotent void DeleteRecording(int recordingId); idempotent RecordingList GetRecordings(); }; -- cgit v1.2.3