25 #include "mythtypes.h" 26 #include "mythwsstream.h" 28 #define MYTH_API_VERSION_MIN_RANKING 0x00020000 29 #define MYTH_API_VERSION_MAX_RANKING 0x0005FFFF 60 WSAPI(
const std::string& server,
unsigned port,
const std::string& securityPin);
63 unsigned CheckService();
65 void InvalidateService();
66 std::string GetServerHostName();
67 VersionPtr GetVersion();
68 std::string ResolveHostName(
const std::string& hostname);
73 SettingPtr
GetSetting(
const std::string& key,
const std::string& hostname)
76 if (wsv.ranking >= 0x00050000)
return GetSetting5_0(key, hostname);
77 if (wsv.ranking >= 0x00020000)
return GetSetting2_0(key, hostname);
84 SettingPtr GetSetting(
const std::string& key,
bool myhost);
92 if (wsv.ranking >= 0x00050000)
return GetSettings5_0(hostname);
93 if (wsv.ranking >= 0x00020000)
return GetSettings2_0(hostname);
94 return SettingMapPtr(
new SettingMap);
100 SettingMapPtr GetSettings(
bool myhost);
105 bool PutSetting(
const std::string& key,
const std::string& value,
bool myhost)
108 if (wsv.ranking >= 0x00020000)
return PutSetting2_0(key, value, myhost);
118 if (wsv.ranking >= 0x00010004)
return GetCaptureCardList1_4();
119 return CaptureCardListPtr(
new CaptureCardList);
128 if (wsv.ranking >= 0x00010002)
return GetVideoSourceList1_2();
129 return VideoSourceListPtr(
new VideoSourceList);
138 if (wsv.ranking >= 0x00010005)
return GetChannelList1_5(sourceid, onlyVisible);
139 if (wsv.ranking >= 0x00010002)
return GetChannelList1_2(sourceid, onlyVisible);
140 return ChannelListPtr(
new ChannelList);
149 if (wsv.ranking >= 0x00010002)
return GetChannel1_2(chanid);
159 if (wsv.ranking >= 0x00020002)
return GetProgramList2_2(chanid, starttime, endtime);
160 if (wsv.ranking >= 0x00010000)
return GetProgramGuide1_0(chanid, starttime, endtime);
161 return ProgramMapPtr(
new ProgramMap);
170 if (wsv.ranking >= 0x00020002)
return GetProgramGuide2_2(starttime, endtime);
171 if (wsv.ranking >= 0x00010000)
return GetProgramGuide1_0(starttime, endtime);
172 return std::map<uint32_t, ProgramMapPtr>();
181 if (wsv.ranking >= 0x00010005)
return GetRecordedList1_5(n, descending);
182 return ProgramListPtr(
new ProgramList);
191 if (wsv.ranking >= 0x00010005)
return GetRecorded1_5(chanid, recstartts);
201 if (wsv.ranking >= 0x00060000)
return GetRecorded6_0(recordedid);
211 if (wsv.ranking >= 0x00040005)
return UpdateRecordedWatchedStatus4_5(chanid, recstartts, watched);
221 if (wsv.ranking >= 0x00060000)
return UpdateRecordedWatchedStatus6_0(recordedid, watched);
228 bool DeleteRecording(uint32_t chanid, time_t recstartts,
bool forceDelete =
false,
bool allowRerecord =
false)
231 if (wsv.ranking >= 0x00020001)
return DeleteRecording2_1(chanid, recstartts, forceDelete, allowRerecord);
238 bool DeleteRecording(uint32_t recordedid,
bool forceDelete =
false,
bool allowRerecord =
false)
241 if (wsv.ranking >= 0x00060000)
return DeleteRecording6_0(recordedid, forceDelete, allowRerecord);
251 if (wsv.ranking >= 0x00020001)
return UnDeleteRecording2_1(chanid, recstartts);
261 if (wsv.ranking >= 0x00060000)
return UnDeleteRecording6_0(recordedid);
271 if (wsv.ranking >= 0x00010005)
return GetRecordScheduleList1_5();
272 return RecordScheduleListPtr(
new RecordScheduleList);
281 if (wsv.ranking >= 0x00010005)
return GetRecordSchedule1_5(recordid);
282 return RecordSchedulePtr();
291 if (wsv.ranking >= 0x00010007)
return AddRecordSchedule1_7(record);
292 if (wsv.ranking >= 0x00010005)
return AddRecordSchedule1_5(record);
302 if (wsv.ranking >= 0x00010007)
return UpdateRecordSchedule1_7(record);
312 if (wsv.ranking >= 0x00010005)
return DisableRecordSchedule1_5(recordid);
322 if (wsv.ranking >= 0x00010005)
return EnableRecordSchedule1_5(recordid);
332 if (wsv.ranking >= 0x00010005)
return RemoveRecordSchedule1_5(recordid);
342 if (wsv.ranking >= 0x00020002)
return GetUpcomingList2_2();
343 if (wsv.ranking >= 0x00010005)
return GetUpcomingList1_5();
344 return ProgramListPtr(
new ProgramList);
353 if (wsv.ranking >= 0x00010005)
return GetConflictList1_5();
354 return ProgramListPtr(
new ProgramList);
363 if (wsv.ranking >= 0x00010005)
return GetExpiringList1_5();
364 return ProgramListPtr(
new ProgramList);
373 if (wsv.ranking >= 0x00010005)
return GetRecGroupList1_5();
374 return StringListPtr(
new StringList);
380 WSStreamPtr
GetFile(
const std::string& filename,
const std::string& sgname)
383 if (wsv.ranking >= 0x00010020)
return GetFile1_32(filename, sgname);
384 return WSStreamPtr();
390 WSStreamPtr
GetChannelIcon(uint32_t chanid,
unsigned width = 0,
unsigned height = 0)
393 if (wsv.ranking >= 0x00010020)
return GetChannelIcon1_32(chanid, width, height);
394 return WSStreamPtr();
403 if (wsv.ranking >= 0x00010020)
return GetChannelIconUrl1_32(chanid, width, height);
410 WSStreamPtr
GetPreviewImage(uint32_t chanid, time_t recstartts,
unsigned width = 0,
unsigned height = 0)
413 if (wsv.ranking >= 0x00010020)
return GetPreviewImage1_32(chanid, recstartts, width, height);
414 return WSStreamPtr();
420 std::string
GetPreviewImageUrl(uint32_t chanid, time_t recstartts,
unsigned width = 0,
unsigned height = 0)
423 if (wsv.ranking >= 0x00010020)
return GetPreviewImageUrl1_32(chanid, recstartts, width, height);
430 WSStreamPtr
GetRecordingArtwork(
const std::string& type,
const std::string& inetref, uint16_t season,
unsigned width = 0,
unsigned height = 0)
433 if (wsv.ranking >= 0x00010020)
return GetRecordingArtwork1_32(type, inetref, season, width, height);
434 return WSStreamPtr();
440 std::string
GetRecordingArtworkUrl(
const std::string& type,
const std::string& inetref, uint16_t season,
unsigned width = 0,
unsigned height = 0)
443 if (wsv.ranking >= 0x00010020)
return GetRecordingArtworkUrl1_32(type, inetref, season, width, height);
453 if (wsv.ranking >= 0x00010020)
return GetRecordingArtworkList1_32(chanid, recstartts);
454 return ArtworkListPtr(
new ArtworkList);
466 if (wsv.ranking >= 0x00060001)
return GetRecordedCommBreak6_1(recordedid, unit);
467 return MarkListPtr(
new MarkList);
479 if (wsv.ranking >= 0x00060001)
return GetRecordedCutList6_1(recordedid, unit);
480 return MarkListPtr(
new MarkList);
493 if (wsv.ranking >= 0x00060002)
return SetSavedBookmark6_2(recordedid, unit, value);
507 if (wsv.ranking >= 0x00060002)
return GetSavedBookmark6_2(recordedid, unit);
513 std::string m_server;
515 std::string m_securityPin;
518 std::string m_serverHostName;
520 std::map<std::string, std::string> m_namedCache;
528 bool CheckServerHostName2_0();
529 bool CheckVersion2_0();
531 SettingPtr GetSetting2_0(
const std::string& key,
const std::string& hostname);
532 SettingPtr GetSetting5_0(
const std::string& key,
const std::string& hostname);
533 SettingMapPtr GetSettings2_0(
const std::string& hostname);
534 SettingMapPtr GetSettings5_0(
const std::string& hostname);
535 bool PutSetting2_0(
const std::string& key,
const std::string& value,
bool myhost);
537 CaptureCardListPtr GetCaptureCardList1_4();
539 VideoSourceListPtr GetVideoSourceList1_2();
540 ChannelListPtr GetChannelList1_2(uint32_t sourceid,
bool onlyVisible);
541 ChannelListPtr GetChannelList1_5(uint32_t sourceid,
bool onlyVisible);
542 ChannelPtr GetChannel1_2(uint32_t chanid);
544 std::map<uint32_t, ProgramMapPtr> GetProgramGuide1_0(time_t starttime, time_t endtime);
545 ProgramMapPtr GetProgramGuide1_0(uint32_t chanid, time_t starttime, time_t endtime);
546 std::map<uint32_t, ProgramMapPtr> GetProgramGuide2_2(time_t starttime, time_t endtime);
547 ProgramMapPtr GetProgramList2_2(uint32_t chanid, time_t starttime, time_t endtime);
549 ProgramListPtr GetRecordedList1_5(
unsigned n,
bool descending);
550 ProgramPtr GetRecorded1_5(uint32_t chanid, time_t recstartts);
551 ProgramPtr GetRecorded6_0(uint32_t recordedid);
552 bool DeleteRecording2_1(uint32_t chanid, time_t recstartts,
bool forceDelete,
bool allowRerecord);
553 bool DeleteRecording6_0(uint32_t recordedid,
bool forceDelete,
bool allowRerecord);
554 bool UnDeleteRecording2_1(uint32_t chanid, time_t recstartts);
555 bool UnDeleteRecording6_0(uint32_t recordedid);
556 bool UpdateRecordedWatchedStatus4_5(uint32_t chanid, time_t recstartts,
bool watched);
557 bool UpdateRecordedWatchedStatus6_0(uint32_t recordedid,
bool watched);
558 MarkListPtr GetRecordedCommBreak6_1(uint32_t recordedid,
int unit);
559 MarkListPtr GetRecordedCutList6_1(uint32_t recordedid,
int unit);
560 bool SetSavedBookmark6_2(uint32_t recordedid,
int unit, int64_t value);
561 int64_t GetSavedBookmark6_2(uint32_t recordedid,
int unit);
563 RecordScheduleListPtr GetRecordScheduleList1_5();
564 RecordSchedulePtr GetRecordSchedule1_5(uint32_t recordid);
568 bool DisableRecordSchedule1_5(uint32_t recordid);
569 bool EnableRecordSchedule1_5(uint32_t recordid);
570 bool RemoveRecordSchedule1_5(uint32_t recordid);
571 ProgramListPtr GetUpcomingList1_5();
572 ProgramListPtr GetUpcomingList2_2();
573 ProgramListPtr GetConflictList1_5();
574 ProgramListPtr GetExpiringList1_5();
575 StringListPtr GetRecGroupList1_5();
577 WSStreamPtr GetFile1_32(
const std::string& filename,
const std::string& sgname);
578 WSStreamPtr GetChannelIcon1_32(uint32_t chanid,
unsigned width,
unsigned height);
579 std::string GetChannelIconUrl1_32(uint32_t chanid,
unsigned width,
unsigned height);
580 WSStreamPtr GetPreviewImage1_32(uint32_t chanid, time_t recstartts,
unsigned width,
unsigned height);
581 std::string GetPreviewImageUrl1_32(uint32_t chanid, time_t recstartts,
unsigned width,
unsigned height);
582 WSStreamPtr GetRecordingArtwork1_32(
const std::string& type,
const std::string& inetref, uint16_t season,
unsigned width,
unsigned height);
583 std::string GetRecordingArtworkUrl1_32(
const std::string& type,
const std::string& inetref, uint16_t season,
unsigned width,
unsigned height);
584 ArtworkListPtr GetRecordingArtworkList1_32(uint32_t chanid, time_t recstartts);
ChannelPtr GetChannel(uint32_t chanid)
GET Channel/GetChannelInfo.
bool DeleteRecording(uint32_t recordedid, bool forceDelete=false, bool allowRerecord=false)
POST Dvr/DeleteRecording.
WSStreamPtr GetPreviewImage(uint32_t chanid, time_t recstartts, unsigned width=0, unsigned height=0)
GET Content/GetPreviewImage.
bool AddRecordSchedule(RecordSchedule &record)
POST Dvr/AddRecordSchedule.
SettingMapPtr GetSettings(const std::string &hostname)
GET Myth/GetSetting.
CaptureCardListPtr GetCaptureCardList()
GET Capture/GetCaptureCardList.
std::string GetChannelIconUrl(uint32_t chanid, unsigned width=0, unsigned height=0)
Returns URL for channel icon.
ProgramListPtr GetConflictList()
GET Dvr/GetConflictList.
ChannelListPtr GetChannelList(uint32_t sourceid, bool onlyVisible=true)
GET Channel/GetChannelInfoList.
bool UnDeleteRecording(uint32_t recordedid)
POST Dvr/UnDeleteRecording.
ProgramListPtr GetExpiringList()
GET Dvr/GetExpiringList.
StringListPtr GetRecGroupList()
GET Dvr/GetRecGroupList.
WSStreamPtr GetRecordingArtwork(const std::string &type, const std::string &inetref, uint16_t season, unsigned width=0, unsigned height=0)
GET Content/GetRecordingArtwork.
bool DisableRecordSchedule(uint32_t recordid)
POST Dvr/DisableRecordSchedule.
std::string GetRecordingArtworkUrl(const std::string &type, const std::string &inetref, uint16_t season, unsigned width=0, unsigned height=0)
Returns URL for recording artwork.
ProgramListPtr GetRecordedList(unsigned n=0, bool descending=false)
GET Dvr/GetRecordedList.
RecordSchedulePtr GetRecordSchedule(uint32_t recordid)
GET Dvr/GetRecordSchedule.
std::map< uint32_t, ProgramMapPtr > GetProgramGuide(time_t starttime, time_t endtime)
GET Guide/GetProgramGuide.
bool UpdateRecordedWatchedStatus(uint32_t chanid, time_t recstartts, bool watched)
POST Dvr/UpdateRecordedWatchedStatus.
std::string GetPreviewImageUrl(uint32_t chanid, time_t recstartts, unsigned width=0, unsigned height=0)
Returns URL for preview image.
MarkListPtr GetRecordedCommBreak(uint32_t recordedid, int unit)
GET Dvr/GetRecordedCommBreak.
bool UpdateRecordedWatchedStatus(uint32_t recordedid, bool watched)
POST Dvr/UpdateRecordedWatchedStatus.
VideoSourceListPtr GetVideoSourceList()
GET Channel/GetVideoSourceList.
WSStreamPtr GetChannelIcon(uint32_t chanid, unsigned width=0, unsigned height=0)
GET Guide/GetChannelIcon.
RecordScheduleListPtr GetRecordScheduleList()
GET Dvr/GetRecordScheduleList.
WSStreamPtr GetFile(const std::string &filename, const std::string &sgname)
GET Content/GetFile.
ProgramPtr GetRecorded(uint32_t chanid, time_t recstartts)
GET Dvr/GetRecorded.
ArtworkListPtr GetRecordingArtworkList(uint32_t chanid, time_t recstartts)
GET Content/GetRecordingArtworkList.
bool EnableRecordSchedule(uint32_t recordid)
POST Dvr/EnableRecordSchedule.
bool UpdateRecordSchedule(RecordSchedule &record)
POST Dvr/UpdateRecordSchedule.
This is the main namespace that encloses all public classes.
bool SetSavedBookmark(uint32_t recordedid, int unit, int64_t value)
POST Dvr/SetSavedBookmark.
bool RemoveRecordSchedule(uint32_t recordid)
POST Dvr/RemoveRecordSchedule.
MarkListPtr GetRecordedCutList(uint32_t recordedid, int unit)
GET Dvr/GetRecordedCutList.
bool DeleteRecording(uint32_t chanid, time_t recstartts, bool forceDelete=false, bool allowRerecord=false)
POST Dvr/DeleteRecording.
int64_t GetSavedBookmark(uint32_t recordedid, int unit)
GET Dvr/GetSavedBookmark.
ProgramListPtr GetUpcomingList()
GET Dvr/GetUpcomingList.
ProgramPtr GetRecorded(uint32_t recordedid)
GET Dvr/GetRecorded.
ProgramMapPtr GetProgramGuide(uint32_t chanid, time_t starttime, time_t endtime)
GET Guide/GetProgramGuide for the given channel.
SettingPtr GetSetting(const std::string &key, const std::string &hostname)
GET Myth/GetSetting.
bool UnDeleteRecording(uint32_t chanid, time_t recstartts)
POST Dvr/UnDeleteRecording.
bool PutSetting(const std::string &key, const std::string &value, bool myhost)
POST Myth/PutSetting.