forked from yavdr/vdr-plugin-restfulapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
recordings.h
105 lines (94 loc) · 3.18 KB
/
recordings.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#include <cxxtools/http/request.h>
#include <cxxtools/http/reply.h>
#include <cxxtools/http/responder.h>
#include <cxxtools/arg.h>
#include <cxxtools/jsonserializer.h>
#include <cxxtools/serializationinfo.h>
#include <cxxtools/utf8codec.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include "tools.h"
#include <vdr/cutter.h>
#include <vdr/recording.h>
class RecordingsResponder : public cxxtools::http::Responder
{
public:
explicit RecordingsResponder(cxxtools::http::Service& service)
: cxxtools::http::Responder(service)
{ }
virtual void reply(std::ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply);
void deleteRecording(std::ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply);
void showRecordings(std::ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply);
void saveMarks(std::ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply);
void deleteMarks(std::ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply);
void cutRecording(std::ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply);
void showCutterStatus(std::ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply);
};
typedef cxxtools::http::CachedService<RecordingsResponder> RecordingsService;
class SerMarks
{
public:
std::vector< std::string > marks;
};
struct SerRecording
{
int Number;
cxxtools::String Name;
cxxtools::String FileName;
cxxtools::String RelativeFileName;
bool IsNew;
bool IsEdited;
bool IsPesRecording;
int Duration;
double FramesPerSecond;
SerMarks Marks;
cxxtools::String EventTitle;
cxxtools::String EventShortText;
cxxtools::String EventDescription;
int EventStartTime;
int EventDuration;
};
void operator<<= (cxxtools::SerializationInfo& si, const SerRecording& p);
class RecordingList : public BaseList
{
protected:
bool read_marks;
int total;
StreamExtension *s;
public:
RecordingList(std::ostream* _out, bool _read_marks);
~RecordingList();
virtual void init() { };
virtual void addRecording(cRecording* recording, int nr) { };
virtual void finish() { };
virtual void setTotal(int _total) { total = _total; }
};
class HtmlRecordingList : RecordingList
{
public:
HtmlRecordingList(std::ostream* _out, bool _read_marks) : RecordingList(_out, _read_marks) { };
~HtmlRecordingList() { };
virtual void init();
virtual void addRecording(cRecording* recording, int nr);
virtual void finish();
};
class JsonRecordingList : RecordingList
{
private:
std::vector < struct SerRecording > serRecordings;
public:
JsonRecordingList(std::ostream* _out, bool _read_marks) : RecordingList(_out, _read_marks) { };
~JsonRecordingList() { };
virtual void addRecording(cRecording* recording, int nr);
virtual void finish();
};
class XmlRecordingList : RecordingList
{
public:
XmlRecordingList(std::ostream* _out, bool _read_marks) : RecordingList(_out, _read_marks) { };
~XmlRecordingList() { };
virtual void init();
virtual void addRecording(cRecording* recording, int nr);
virtual void finish();
};