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

Private Attributes

ProtoMonitor m_monitor
WSAPI m_wsapi

Detailed Description

Definition at line 32 of file mythcontrol.h.

Constructor & Destructor Documentation

◆ Control() [1/2]

Control::Control ( const std::string & server,
unsigned protoPort,
unsigned wsapiPort,
const std::string & wsapiSecurityPin )

Definition at line 26 of file mythcontrol.cpp.

◆ Control() [2/2]

Control::Control ( const std::string & server,
unsigned protoPort,
unsigned wsapiPort,
const std::string & wsapiSecurityPin,
bool frontend )

Definition at line 33 of file mythcontrol.cpp.

◆ ~Control()

Control::~Control ( )

Definition at line 40 of file mythcontrol.cpp.

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 364 of file mythcontrol.h.

◆ AllowShutdown()

bool Myth::Control::AllowShutdown ( )
inline

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

Returns
bool

Definition at line 595 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 586 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 120 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 61 of file mythcontrol.h.

◆ CleanHanging()

void Myth::Control::CleanHanging ( )
inline

Definition at line 54 of file mythcontrol.h.

◆ Close()

void Control::Close ( )

Definition at line 52 of file mythcontrol.cpp.

◆ 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 253 of file mythcontrol.h.

◆ DisableRecordSchedule()

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

Disable a recording rule.

Parameters
recordid
Returns
status

Definition at line 384 of file mythcontrol.h.

◆ EnableRecordSchedule()

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

Enable a recording rule.

Parameters
recordid
Returns
status

Definition at line 394 of file mythcontrol.h.

◆ 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 GetHostSetting().

◆ 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 GetHostSetting().

◆ 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 GetHostSetting().

◆ GetBaseURL()

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

Returns the base URL of WS-API.

Returns
string

Definition at line 79 of file mythcontrol.h.

◆ GetCaptureCardList()

CaptureCardListPtr Myth::Control::GetCaptureCardList ( )
inline

Get all configured capture devices.

Returns
CaptureCardListPtr

Definition at line 282 of file mythcontrol.h.

◆ GetChannel()

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

Retrieve a single channel, by channel id.

Parameters
chanid
Returns
ChannelPtr

Definition at line 312 of file mythcontrol.h.

◆ 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 463 of file mythcontrol.h.

◆ 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 475 of file mythcontrol.h.

◆ 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 302 of file mythcontrol.h.

◆ 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 571 of file mythcontrol.h.

◆ GetConflictList()

ProgramListPtr Myth::Control::GetConflictList ( )
inline

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

Returns
ProgramListPtr

Definition at line 422 of file mythcontrol.h.

◆ 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 554 of file mythcontrol.h.

◆ GetExpiringList()

ProgramListPtr Myth::Control::GetExpiringList ( )
inline

Query information on recorded programs which are set to expire.

Returns
ProgramListPtr

Definition at line 431 of file mythcontrol.h.

◆ 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 451 of file mythcontrol.h.

◆ GetHostSetting()

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

Query setting by its key.

Parameters
key
hostname
Returns
SettingPtr

Definition at line 131 of file mythcontrol.h.

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

Here is the caller graph for this function:

◆ GetHostSettings()

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

Query all settings.

Parameters
hostname
Returns
SettingMapPtr

Definition at line 152 of file mythcontrol.h.

◆ 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 487 of file mythcontrol.h.

◆ 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 499 of file mythcontrol.h.

◆ GetProgramGuide() [1/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 335 of file mythcontrol.h.

◆ GetProgramGuide() [2/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 324 of file mythcontrol.h.

◆ GetProtoError()

ProtoBase::ERROR_t Myth::Control::GetProtoError ( ) const
inline

Definition at line 55 of file mythcontrol.h.

◆ GetRecGroupList()

StringListPtr Myth::Control::GetRecGroupList ( )
inline

Get list of recording group.

Returns
StringListPtr

Definition at line 440 of file mythcontrol.h.

◆ 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 217 of file mythcontrol.h.

◆ 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 227 of file mythcontrol.h.

◆ 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 206 of file mythcontrol.h.

◆ 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 512 of file mythcontrol.h.

◆ 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 536 of file mythcontrol.h.

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 525 of file mythcontrol.h.

◆ GetRecordSchedule()

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

Get a single recording rule, by record id.

Parameters
recordid
Returns
RecordSchedulePtr

Definition at line 354 of file mythcontrol.h.

◆ GetRecordScheduleList()

RecordScheduleListPtr Myth::Control::GetRecordScheduleList ( )
inline

Query all configured recording rules.

Returns
RecordScheduleListPtr

Definition at line 344 of file mythcontrol.h.

◆ 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 617 of file mythcontrol.h.

◆ GetServerHostName()

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

Query server host name.

Returns
string

Definition at line 70 of file mythcontrol.h.

◆ GetSetting()

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

Query setting by its key.

Parameters
key
myhost
Returns
SettingPtr

Definition at line 142 of file mythcontrol.h.

◆ GetSettings()

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

Query all settings.

Parameters
myhost
Returns
SettingMapPtr

Definition at line 162 of file mythcontrol.h.

◆ GetUpcomingList()

ProgramListPtr Myth::Control::GetUpcomingList ( )
inline

Query information on all upcoming programs matching recording rules.

Returns
ProgramListPtr

Definition at line 413 of file mythcontrol.h.

◆ GetVersion()

VersionPtr Myth::Control::GetVersion ( )
inline

Query server version infos.

Returns
VersionPtr

Definition at line 88 of file mythcontrol.h.

◆ GetVideoSourceList()

VideoSourceListPtr Myth::Control::GetVideoSourceList ( )
inline

Get all video sources.

Returns
VideoSourceListPtr

Definition at line 291 of file mythcontrol.h.

◆ HasHanging()

bool Myth::Control::HasHanging ( ) const
inline

Definition at line 53 of file mythcontrol.h.

◆ IsOpen()

bool Myth::Control::IsOpen ( )
inline

Definition at line 52 of file mythcontrol.h.

◆ Open()

bool Control::Open ( )

Definition at line 45 of file mythcontrol.cpp.

◆ 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 174 of file mythcontrol.h.

◆ 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 99 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 109 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().

◆ RemoveRecordSchedule()

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

Remove a recording rule.

Parameters
recordid
Returns
status

Definition at line 404 of file mythcontrol.h.

◆ 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 606 of file mythcontrol.h.

◆ StopRecording()

bool Myth::Control::StopRecording ( const Program & program)
inline

Definition at line 273 of file mythcontrol.h.

◆ UndeleteRecording()

bool Myth::Control::UndeleteRecording ( const Program & program)
inline

Definition at line 263 of file mythcontrol.h.

◆ 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 238 of file mythcontrol.h.

◆ UpdateRecordSchedule()

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

Update a recording rule.

Parameters
record
Returns
status

Definition at line 374 of file mythcontrol.h.

◆ WithAuthorization()

Control & Myth::Control::WithAuthorization ( const std::string & user,
const std::string & password )
inline

Definition at line 39 of file mythcontrol.h.

◆ WithSSL()

Control & Myth::Control::WithSSL ( bool yesno)
inline

Definition at line 44 of file mythcontrol.h.

Field Documentation

◆ m_monitor

ProtoMonitor Myth::Control::m_monitor
private

Definition at line 623 of file mythcontrol.h.

◆ m_wsapi

WSAPI Myth::Control::m_wsapi
private

Definition at line 624 of file mythcontrol.h.


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