CPPMyth
Library to interoperate with MythTV server
Myth::Control Class Reference
Collaboration diagram for Myth::Control:

Public Member Functions

 Control (const std::string &server, unsigned protoPort, unsigned wsapiPort, const std::string &wsapiSecurityPin)
 
 Control (const std::string &server, unsigned protoPort, unsigned wsapiPort, const std::string &wsapiSecurityPin, bool frontend)
 
bool Open ()
 
void Close ()
 
bool IsOpen ()
 
bool HasHanging () const
 
void CleanHanging ()
 
ProtoBase::ERROR_t GetProtoError () const
 
unsigned CheckService ()
 Check availability of API services. More...
 
std::string GetServerHostName ()
 Query server host name. More...
 
VersionPtr GetVersion ()
 Query server version infos. More...
 
bool QueryFreeSpaceSummary (int64_t *total, int64_t *used)
 Queries the backend for free space summary. More...
 
bool QueryGenPixmap (const Program &program)
 Triggers preview image generation on the backend for a specified show. More...
 
bool CancelNextRecording (int rnum, bool cancel)
 Ask the backend to cancel/continue next recording. More...
 
SettingPtr GetSetting (const std::string &key, const std::string &hostname)
 Query setting by its key. More...
 
SettingPtr GetSetting (const std::string &key, bool myhost)
 Query setting by its key. More...
 
SettingMapPtr GetSettings (const std::string &hostname)
 Query all settings. More...
 
SettingMapPtr GetSettings (bool myhost)
 Query all settings. More...
 
bool PutSetting (const std::string &key, const std::string &value, bool myhost)
 Put setting. More...
 
std::string GetBackendServerIP (const std::string &hostName)
 Query backend server IP. More...
 
std::string GetBackendServerIP6 (const std::string &hostName)
 Query backend server IP6. More...
 
unsigned GetBackendServerPort (const std::string &hostName)
 Query backend server port for protocol commands. More...
 
ProgramListPtr GetRecordedList (unsigned n=0, bool descending=false)
 Query information on all recorded programs. More...
 
ProgramPtr GetRecorded (uint32_t chanid, time_t recstartts)
 Query information on a single item from recordings. More...
 
ProgramPtr GetRecorded (uint32_t recordedid)
 Query information on a single item from recordings. More...
 
bool UpdateRecordedWatchedStatus (const Program &program, bool watched)
 Update watched status for a recorded. More...
 
bool DeleteRecording (const Program &program, bool forceDelete=false, bool allowRerecord=false)
 Remove a Recording from the database and disk. More...
 
bool UndeleteRecording (const Program &program)
 
bool StopRecording (const Program &program)
 
CaptureCardListPtr GetCaptureCardList ()
 Get all configured capture devices. More...
 
VideoSourceListPtr GetVideoSourceList ()
 Get all video sources. More...
 
ChannelListPtr GetChannelList (uint32_t sourceid, bool onlyVisible=true)
 Get all configured channels for a video source. More...
 
ChannelPtr GetChannel (uint32_t chanid)
 Retrieve a single channel, by channel id. More...
 
ProgramMapPtr GetProgramGuide (uint32_t chanid, time_t starttime, time_t endtime)
 Query the guide information for a particular time period and a channel. More...
 
std::map< uint32_t, ProgramMapPtr > GetProgramGuide (time_t starttime, time_t endtime)
 Query the guide information for a particular time period. More...
 
RecordScheduleListPtr GetRecordScheduleList ()
 Query all configured recording rules. More...
 
RecordSchedulePtr GetRecordSchedule (uint32_t recordid)
 Get a single recording rule, by record id. More...
 
bool AddRecordSchedule (RecordSchedule &record)
 Add a new recording rule. More...
 
bool UpdateRecordSchedule (RecordSchedule &record)
 Update a recording rule. More...
 
bool DisableRecordSchedule (uint32_t recordid)
 Disable a recording rule. More...
 
bool EnableRecordSchedule (uint32_t recordid)
 Enable a recording rule. More...
 
bool RemoveRecordSchedule (uint32_t recordid)
 Remove a recording rule. More...
 
ProgramListPtr GetUpcomingList ()
 Query information on all upcoming programs matching recording rules. More...
 
ProgramListPtr GetConflictList ()
 Query information on upcoming items which will not record due to conflicts. More...
 
ProgramListPtr GetExpiringList ()
 Query information on recorded programs which are set to expire. More...
 
StringListPtr GetRecGroupList ()
 Get list of recording group. More...
 
WSStreamPtr GetFile (const std::string &filename, const std::string &sgname)
 Download a given file from a given storage group. More...
 
WSStreamPtr GetChannelIcon (uint32_t chanid, unsigned width=0, unsigned height=0)
 Get the icon file for a given channel. More...
 
std::string GetChannelIconUrl (uint32_t chanid, unsigned width=0, unsigned height=0)
 Get URL of icon for a given channel. More...
 
WSStreamPtr GetPreviewImage (const Program &program, unsigned width=0, unsigned height=0)
 Get, and optionally scale, an preview thumbnail for a given recording by timestamp, chanid and starttime. More...
 
std::string GetPreviewImageUrl (const Program &program, unsigned width=0, unsigned height=0)
 Get URL of preview thumbnail for a given recording by timestamp, chanid and starttime. More...
 
WSStreamPtr GetRecordingArtwork (const std::string &type, const Program &program, unsigned width=0, unsigned height=0)
 Get, and optionally scale, an image file of a given type (coverart, banner, fanart) for a given recording's inetref and season number. More...
 
std::string GetRecordingArtworkUrl (const std::string &type, const Program &program, unsigned width=0, unsigned height=0)
 Get an image URL of a given type (coverart, banner, fanart) for a given recording's inetref and season number. More...
 
ArtworkListPtr GetRecordingArtworkList (uint32_t chanid, time_t recstartts)
 Get a list of artwork available for a recording by start time and channel id. More...
 
bool RefreshRecordedArtwork (Program &program)
 Refresh artwork available for a recording. More...
 
MarkListPtr GetCutList (const Program &program, int unit=0)
 Request a set of cut list marks for a recording. More...
 
MarkListPtr GetCommBreakList (const Program &program, int unit=0)
 Request a set of commercial break marks for a recording. More...
 
bool BlockShutdown ()
 Prevents backend from shutting down until a the next call to AllowShutdown(). More...
 
bool AllowShutdown ()
 Allows backend to shut down again after a previous call to BlockShutdown(). More...
 
bool SetSavedBookmark (const Program &program, int unit, int64_t value)
 Set saved bookmark for a program. More...
 
int64_t GetSavedBookmark (const Program &program, int unit)
 Retrieve saved bookmark for a program. More...
 

Private Attributes

ProtoMonitor m_monitor
 
WSAPI m_wsapi
 

Detailed Description

Definition at line 32 of file mythcontrol.h.

Member Function Documentation

◆ AddRecordSchedule()

bool Myth::Control::AddRecordSchedule ( RecordSchedule record)
inline

Add a new recording rule.

Parameters
record
Returns
status. On success Id is updated with the new.

Definition at line 344 of file mythcontrol.h.

References Myth::WSAPI::AddRecordSchedule().

◆ AllowShutdown()

bool Myth::Control::AllowShutdown ( )
inline

Allows backend to shut down again after a previous call to BlockShutdown().

Returns
bool

Definition at line 575 of file mythcontrol.h.

◆ BlockShutdown()

bool Myth::Control::BlockShutdown ( )
inline

Prevents backend from shutting down until a the next call to AllowShutdown().

Returns
bool

Definition at line 566 of file mythcontrol.h.

◆ CancelNextRecording()

bool Myth::Control::CancelNextRecording ( int  rnum,
bool  cancel 
)
inline

Ask the backend to cancel/continue next recording.

Parameters
rnumrecorder Id
cancel
Returns
bool

Definition at line 100 of file mythcontrol.h.

◆ CheckService()

unsigned Myth::Control::CheckService ( )
inline

Check availability of API services.

Returns
If unavailable then 0 else the backend protocol number

Definition at line 50 of file mythcontrol.h.

◆ DeleteRecording()

bool Myth::Control::DeleteRecording ( const Program program,
bool  forceDelete = false,
bool  allowRerecord = false 
)
inline

Remove a Recording from the database and disk.

Parameters
program
forceDelete(default false)
allowRerecord(default false)
Returns
bool

Definition at line 233 of file mythcontrol.h.

References Myth::WSAPI::DeleteRecording(), and Myth::WSAPI::UnDeleteRecording().

◆ DisableRecordSchedule()

bool Myth::Control::DisableRecordSchedule ( uint32_t  recordid)
inline

Disable a recording rule.

Parameters
recordid
Returns
status

Definition at line 364 of file mythcontrol.h.

References Myth::WSAPI::DisableRecordSchedule().

◆ EnableRecordSchedule()

bool Myth::Control::EnableRecordSchedule ( uint32_t  recordid)
inline

Enable a recording rule.

Parameters
recordid
Returns
status

Definition at line 374 of file mythcontrol.h.

References Myth::WSAPI::EnableRecordSchedule().

◆ GetBackendServerIP()

std::string Control::GetBackendServerIP ( const std::string &  hostName)

Query backend server IP.

Parameters
hostName
Returns
string containing found IP or nil

Definition at line 58 of file mythcontrol.cpp.

References GetSetting().

Referenced by PutSetting().

Here is the caller graph for this function:

◆ GetBackendServerIP6()

std::string Control::GetBackendServerIP6 ( const std::string &  hostName)

Query backend server IP6.

Parameters
hostName
Returns
string containing found IP6 or nil

Definition at line 68 of file mythcontrol.cpp.

References GetSetting().

Referenced by PutSetting().

Here is the caller graph for this function:

◆ GetBackendServerPort()

unsigned Control::GetBackendServerPort ( const std::string &  hostName)

Query backend server port for protocol commands.

Parameters
hostName
Returns
unsigned more than 0 else invalid

Definition at line 78 of file mythcontrol.cpp.

References GetSetting().

Referenced by PutSetting().

Here is the caller graph for this function:

◆ GetCaptureCardList()

CaptureCardListPtr Myth::Control::GetCaptureCardList ( )
inline

Get all configured capture devices.

Returns
CaptureCardListPtr

Definition at line 262 of file mythcontrol.h.

References Myth::WSAPI::GetCaptureCardList().

◆ GetChannel()

ChannelPtr Myth::Control::GetChannel ( uint32_t  chanid)
inline

Retrieve a single channel, by channel id.

Parameters
chanid
Returns
ChannelPtr

Definition at line 292 of file mythcontrol.h.

References Myth::WSAPI::GetChannel().

◆ GetChannelIcon()

WSStreamPtr Myth::Control::GetChannelIcon ( uint32_t  chanid,
unsigned  width = 0,
unsigned  height = 0 
)
inline

Get the icon file for a given channel.

Parameters
chanid
width(default 0)
height(default 0)
Returns
WSStreamPtr

Definition at line 443 of file mythcontrol.h.

References Myth::WSAPI::GetChannelIcon().

◆ GetChannelIconUrl()

std::string Myth::Control::GetChannelIconUrl ( uint32_t  chanid,
unsigned  width = 0,
unsigned  height = 0 
)
inline

Get URL of icon for a given channel.

Parameters
chanid
width(default 0)
height(default 0)
Returns
url

Definition at line 455 of file mythcontrol.h.

References Myth::WSAPI::GetChannelIconUrl().

◆ GetChannelList()

ChannelListPtr Myth::Control::GetChannelList ( uint32_t  sourceid,
bool  onlyVisible = true 
)
inline

Get all configured channels for a video source.

Parameters
sourceid
onlyVisible(default true)
Returns
ChannelListPtr

Definition at line 282 of file mythcontrol.h.

References Myth::WSAPI::GetChannelList().

◆ GetCommBreakList()

MarkListPtr Myth::Control::GetCommBreakList ( const Program program,
int  unit = 0 
)
inline

Request a set of commercial break marks for a recording.

Parameters
program
unit0 = Frame count, 1 = Position, 2 = Duration ms
Returns
MarkListPtr

Definition at line 551 of file mythcontrol.h.

References Myth::WSAPI::GetRecordedCommBreak().

◆ GetConflictList()

ProgramListPtr Myth::Control::GetConflictList ( )
inline

Query information on upcoming items which will not record due to conflicts.

Returns
ProgramListPtr

Definition at line 402 of file mythcontrol.h.

References Myth::WSAPI::GetConflictList().

◆ GetCutList()

MarkListPtr Myth::Control::GetCutList ( const Program program,
int  unit = 0 
)
inline

Request a set of cut list marks for a recording.

Parameters
program
unit0 = Frame count, 1 = Position, 2 = Duration ms
Returns
MarkListPtr

Definition at line 534 of file mythcontrol.h.

References Myth::WSAPI::GetRecordedCutList().

◆ GetExpiringList()

ProgramListPtr Myth::Control::GetExpiringList ( )
inline

Query information on recorded programs which are set to expire.

Returns
ProgramListPtr

Definition at line 411 of file mythcontrol.h.

References Myth::WSAPI::GetExpiringList().

◆ GetFile()

WSStreamPtr Myth::Control::GetFile ( const std::string &  filename,
const std::string &  sgname 
)
inline

Download a given file from a given storage group.

Parameters
filename
sgname
Returns
WSStreamPtr

Definition at line 431 of file mythcontrol.h.

References Myth::WSAPI::GetFile().

◆ GetPreviewImage()

WSStreamPtr Myth::Control::GetPreviewImage ( const Program program,
unsigned  width = 0,
unsigned  height = 0 
)
inline

Get, and optionally scale, an preview thumbnail for a given recording by timestamp, chanid and starttime.

Parameters
program
width(default 0)
height(default 0)
Returns
WSStreamPtr

Definition at line 467 of file mythcontrol.h.

References Myth::WSAPI::GetPreviewImage().

◆ GetPreviewImageUrl()

std::string Myth::Control::GetPreviewImageUrl ( const Program program,
unsigned  width = 0,
unsigned  height = 0 
)
inline

Get URL of preview thumbnail for a given recording by timestamp, chanid and starttime.

Parameters
program
width(default 0)
height(default 0)
Returns
url

Definition at line 479 of file mythcontrol.h.

References Myth::WSAPI::GetPreviewImageUrl().

◆ GetProgramGuide() [1/2]

ProgramMapPtr Myth::Control::GetProgramGuide ( uint32_t  chanid,
time_t  starttime,
time_t  endtime 
)
inline

Query the guide information for a particular time period and a channel.

Parameters
chanid
starttime
endtime
Returns
ProgramMapPtr

Definition at line 304 of file mythcontrol.h.

References Myth::WSAPI::GetProgramGuide().

◆ GetProgramGuide() [2/2]

std::map<uint32_t, ProgramMapPtr> Myth::Control::GetProgramGuide ( time_t  starttime,
time_t  endtime 
)
inline

Query the guide information for a particular time period.

Parameters
starttime
endtime
Returns
map

Definition at line 315 of file mythcontrol.h.

References Myth::WSAPI::GetProgramGuide().

◆ GetRecGroupList()

StringListPtr Myth::Control::GetRecGroupList ( )
inline

Get list of recording group.

Returns
StringListPtr

Definition at line 420 of file mythcontrol.h.

References Myth::WSAPI::GetRecGroupList().

◆ GetRecorded() [1/2]

ProgramPtr Myth::Control::GetRecorded ( uint32_t  chanid,
time_t  recstartts 
)
inline

Query information on a single item from recordings.

Parameters
chanid
recstartts
Returns
ProgramPtr

Definition at line 197 of file mythcontrol.h.

References Myth::WSAPI::GetRecorded().

◆ GetRecorded() [2/2]

ProgramPtr Myth::Control::GetRecorded ( uint32_t  recordedid)
inline

Query information on a single item from recordings.

Parameters
recordedid
Returns
ProgramPtr

Definition at line 207 of file mythcontrol.h.

References Myth::WSAPI::GetRecorded().

◆ GetRecordedList()

ProgramListPtr Myth::Control::GetRecordedList ( unsigned  n = 0,
bool  descending = false 
)
inline

Query information on all recorded programs.

Parameters
n
descending
Returns
ProgramListPtr

Definition at line 186 of file mythcontrol.h.

References Myth::WSAPI::GetRecordedList().

◆ GetRecordingArtwork()

WSStreamPtr Myth::Control::GetRecordingArtwork ( const std::string &  type,
const Program program,
unsigned  width = 0,
unsigned  height = 0 
)
inline

Get, and optionally scale, an image file of a given type (coverart, banner, fanart) for a given recording's inetref and season number.

Parameters
type
program
width(default 0)
height(default 0)
Returns
WSStreamPtr

Definition at line 492 of file mythcontrol.h.

References Myth::WSAPI::GetRecordingArtwork().

◆ GetRecordingArtworkList()

ArtworkListPtr Myth::Control::GetRecordingArtworkList ( uint32_t  chanid,
time_t  recstartts 
)
inline

Get a list of artwork available for a recording by start time and channel id.

Parameters
chanid
recstartts
Returns
ArtworkListPtr

Definition at line 516 of file mythcontrol.h.

References Myth::WSAPI::GetRecordingArtworkList(), and RefreshRecordedArtwork().

Referenced by RefreshRecordedArtwork().

Here is the caller graph for this function:

◆ GetRecordingArtworkUrl()

std::string Myth::Control::GetRecordingArtworkUrl ( const std::string &  type,
const Program program,
unsigned  width = 0,
unsigned  height = 0 
)
inline

Get an image URL of a given type (coverart, banner, fanart) for a given recording's inetref and season number.

Parameters
type
program
width(default 0)
height(default 0)
Returns
WSStreamPtr

Definition at line 505 of file mythcontrol.h.

References Myth::WSAPI::GetRecordingArtworkUrl().

◆ GetRecordSchedule()

RecordSchedulePtr Myth::Control::GetRecordSchedule ( uint32_t  recordid)
inline

Get a single recording rule, by record id.

Parameters
recordid
Returns
RecordSchedulePtr

Definition at line 334 of file mythcontrol.h.

References Myth::WSAPI::GetRecordSchedule().

◆ GetRecordScheduleList()

RecordScheduleListPtr Myth::Control::GetRecordScheduleList ( )
inline

Query all configured recording rules.

Returns
RecordScheduleListPtr

Definition at line 324 of file mythcontrol.h.

References Myth::WSAPI::GetRecordScheduleList().

◆ GetSavedBookmark()

int64_t Myth::Control::GetSavedBookmark ( const Program program,
int  unit 
)
inline

Retrieve saved bookmark for a program.

Parameters
program
unit1 = Position, 2 = Duration ms
Returns
value

Definition at line 597 of file mythcontrol.h.

References Myth::WSAPI::GetSavedBookmark().

◆ GetServerHostName()

std::string Myth::Control::GetServerHostName ( )
inline

Query server host name.

Returns
string

Definition at line 59 of file mythcontrol.h.

◆ GetSetting() [1/2]

SettingPtr Myth::Control::GetSetting ( const std::string &  key,
const std::string &  hostname 
)
inline

Query setting by its key.

Parameters
key
hostname
Returns
SettingPtr

Definition at line 111 of file mythcontrol.h.

References Myth::WSAPI::GetSetting().

Referenced by GetBackendServerIP(), GetBackendServerIP6(), and GetBackendServerPort().

Here is the caller graph for this function:

◆ GetSetting() [2/2]

SettingPtr Myth::Control::GetSetting ( const std::string &  key,
bool  myhost 
)
inline

Query setting by its key.

Parameters
key
myhost
Returns
SettingPtr

Definition at line 122 of file mythcontrol.h.

References Myth::WSAPI::GetSetting().

◆ GetSettings() [1/2]

SettingMapPtr Myth::Control::GetSettings ( const std::string &  hostname)
inline

Query all settings.

Parameters
hostname
Returns
SettingMapPtr

Definition at line 132 of file mythcontrol.h.

References Myth::WSAPI::GetSettings().

◆ GetSettings() [2/2]

SettingMapPtr Myth::Control::GetSettings ( bool  myhost)
inline

Query all settings.

Parameters
myhost
Returns
SettingMapPtr

Definition at line 142 of file mythcontrol.h.

References Myth::WSAPI::GetSettings().

◆ GetUpcomingList()

ProgramListPtr Myth::Control::GetUpcomingList ( )
inline

Query information on all upcoming programs matching recording rules.

Returns
ProgramListPtr

Definition at line 393 of file mythcontrol.h.

References Myth::WSAPI::GetUpcomingList().

◆ GetVersion()

VersionPtr Myth::Control::GetVersion ( )
inline

Query server version infos.

Returns
VersionPtr

Definition at line 68 of file mythcontrol.h.

◆ GetVideoSourceList()

VideoSourceListPtr Myth::Control::GetVideoSourceList ( )
inline

Get all video sources.

Returns
VideoSourceListPtr

Definition at line 271 of file mythcontrol.h.

References Myth::WSAPI::GetVideoSourceList().

◆ PutSetting()

bool Myth::Control::PutSetting ( const std::string &  key,
const std::string &  value,
bool  myhost 
)
inline

Put setting.

Parameters
key
value
myhost
Returns
bool

Definition at line 154 of file mythcontrol.h.

References GetBackendServerIP(), GetBackendServerIP6(), GetBackendServerPort(), and Myth::WSAPI::PutSetting().

◆ QueryFreeSpaceSummary()

bool Myth::Control::QueryFreeSpaceSummary ( int64_t *  total,
int64_t *  used 
)
inline

Queries the backend for free space summary.

Parameters
total
used
Returns
bool

Definition at line 79 of file mythcontrol.h.

◆ QueryGenPixmap()

bool Myth::Control::QueryGenPixmap ( const Program program)
inline

Triggers preview image generation on the backend for a specified show.

Parameters
program
Returns
bool

Definition at line 89 of file mythcontrol.h.

◆ RefreshRecordedArtwork()

bool Control::RefreshRecordedArtwork ( Program program)

Refresh artwork available for a recording.

Parameters
program
Returns
bool Return true if any artwork found

Definition at line 88 of file mythcontrol.cpp.

References GetRecordingArtworkList().

Referenced by GetRecordingArtworkList().

Here is the caller graph for this function:

◆ RemoveRecordSchedule()

bool Myth::Control::RemoveRecordSchedule ( uint32_t  recordid)
inline

Remove a recording rule.

Parameters
recordid
Returns
status

Definition at line 384 of file mythcontrol.h.

References Myth::WSAPI::RemoveRecordSchedule().

◆ SetSavedBookmark()

bool Myth::Control::SetSavedBookmark ( const Program program,
int  unit,
int64_t  value 
)
inline

Set saved bookmark for a program.

Parameters
program
unit1 = Position, 2 = Duration ms
Returns
bool

Definition at line 586 of file mythcontrol.h.

References Myth::WSAPI::SetSavedBookmark().

◆ UpdateRecordedWatchedStatus()

bool Myth::Control::UpdateRecordedWatchedStatus ( const Program program,
bool  watched 
)
inline

Update watched status for a recorded.

Parameters
chanid
recstartts
Returns
bool

Definition at line 218 of file mythcontrol.h.

References Myth::WSAPI::UpdateRecordedWatchedStatus().

◆ UpdateRecordSchedule()

bool Myth::Control::UpdateRecordSchedule ( RecordSchedule record)
inline

Update a recording rule.

Parameters
record
Returns
status

Definition at line 354 of file mythcontrol.h.

References Myth::WSAPI::UpdateRecordSchedule().


The documentation for this class was generated from the following files: