|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IBackend
This interface is the main interface when communicating with a MythTV-backend. It allows to connect and to send commands to a MythTV-backend.
See the usage examples for a list of things you can do with a backend.
commands
.IBackendConnection
,
or you can use the more convenient functions provided by this backend class.
Depending on the protocol version, different commands with different request arguments and response values are supported.
MythProtoVersion
annotation. Additionally the lower bound of the version range is documented with the @since
javadoc
tag, whereas the upper bound is documented with the @deprecated
tag.
Extended Version Ranges:
Please note that many functions are usable (maybe with some restrictions) beyond the given protocol range,
if an alternative set of functions can be used to achieve the same result. If such an "extended" version-range is
available for a function, this is mentioned as "fallback-from"- and "fallback-to"-version in the functions javadoc.
Supported Versions:
Which protocol versions are in general supported by the jMythAPI can be seen in the enumeration ProtocolVersion
.
IBackend backend = BackendFactory.createBackend(...)
backend.connect()
backend.annotatePlayback(...)
backend.annotateMonitor(...)
recorders
.
Use the backend:
Afterwards you can use any function provided by this interface to query and control your backend.
See the usage examples for some examples.
Disconnect from the backend:
To disconnect from the backend, backend.close()
needs to be called.
The following example shows how a connection can be established to a MythTV-backend and how a list of all pending recordings can be queried:
// create a backend object IBackend backend = BackendFactory.createBackend("mythbox"); // connect to the backend backend.connect(); System.out.println("The backend is speeking protocol version: " + backend.getVersionNr()); // register as a playback client backend.annotatePlayback(); // query pending recordings IRecordingsPending pendingRecordings = backend.queryAllPending(); System.out.println(String.format("MythTV has %d pending records", pendingRecordings.size())); for (IProgramInfo recording : pendingRecordings) { System.out.println(recording); } // close backend connection backend.disconnect();
An example how to connect to the next free recorder
and to fetch all channels
available on this recorder.
// create a backend object IBackend backend = BackendFactory.createBackend("mythbox"); backend.connect(); backend.annotatePlayback(); // searching for the next free recorder IRecorderInfo recorderInfo = backend.getNextFreeRecorder(); if(recorderInfo == null) { System.out.println("No free recorder available"); } else { // connect to the recorder IRecorder recorder = backend.getRecorder(recorderInfo); System.out.println("Connected to recorder " + recorder); // get all channels available on this recorder List<IRecorderChannelInfo> channels = recorder.getChannelInfos(); for(IRecorderChannelInfo channel : channels) { System.out.println(String.format("Channel %d: %s",channel.getChannelID(),channel.getChannelName())); } // close recorder connection recorder.close(); } // close backend connection backend.disconnect();
link
)link
)link
)link
)link
)link
)link
)link
)link
)link
)link
)link
)link
,link
)link
)link
)link
)link
)link
)link
)link
)link
)link
)link
)recorders
:
All supported protocol version
Method Summary | ||
---|---|---|
|
addEventListener(Class<Event> eventClass,
IMythEventListener<Event> listener)
|
|
void |
addEventPacketListener(IMythEventPacketListener listener)
Registers a new event listener. |
|
Boolean |
allowShutdown()
Allows a backend to shutdown. |
|
IFileTransfer |
annotateFileTransfer(IProgramInfo programInfo)
Announce a new file-transfer connection to the backend. |
|
IFileTransfer |
annotateFileTransfer(IProgramInfo programInfo,
Boolean useReadAhead,
Integer retries,
Integer timeoutMs)
Announce a new file-transfer connection to the backend. |
|
IFileTransfer |
annotateFileTransfer(String fileName,
Boolean useReadAhead,
Integer retries,
Integer timeoutMs,
String storageGroup)
Announce a new file-transfer connection to the backend. |
|
FileTransfer |
annotateFileTransfer(String fileName,
String storageGroup)
Announce a new file-transfer connection to the backend. |
|
FileTransfer |
annotateFileTransfer(URI fileUrl)
Announce a new file-transfer connection to the backend. |
|
boolean |
annotateMonitor()
Announces a new monitor connection to the backend. |
|
boolean |
annotateMonitor(String clientHostName)
Announces a new monitor connection to the backend. |
|
boolean |
annotateMonitor(String clientHostName,
EPlaybackSockEventsMode eventsMode)
Announces a new monitor connection to the backend. |
|
boolean |
annotatePlayback()
Announce a new playback connection to the backend. |
|
boolean |
annotatePlayback(String clientHostName)
Announce a new playback connection to the backend. |
|
boolean |
annotatePlayback(String clientHostName,
EPlaybackSockEventsMode eventsMode)
Announce a new playback connection to the backend. |
|
Boolean |
blockShutdown()
Prevents a backend from shutting down. |
|
Integer |
checkRecording(IProgramInfo programInfo)
Checks if the given program is currently being recorded. |
|
void |
clearSettingsCache()
Forces the backend to clear its settings cache. |
|
void |
connect()
Establishes a new connection to the backend. |
|
void |
connect(Integer connectionTimeout)
|
|
boolean |
deleteFile(String fileName,
String storageGroup)
Delete a remote file. |
|
boolean |
deleteFile(URI fileUrl)
Delete a remote file. |
|
boolean |
deleteRecording(Integer channelID,
Date recordingStartTime)
Deletes a recording-file. |
|
boolean |
deleteRecording(Integer channelID,
Date recordingStartTime,
Boolean forceMetadatDelete,
Boolean forgetHistory)
Delets a recording file, recording metadata and recording history. |
|
boolean |
deleteRecording(IProgramInfo programInfo)
Deletes a recording file. |
|
boolean |
deleteRecording(IProgramInfo programInfo,
Boolean forceMetadatDelete,
Boolean forgetHistory)
Delets a recording file, recording metadata and recording history. |
|
void |
disconnect()
Disconnects from the backend. |
|
URI |
downloadFile(URI url,
String storageGroup,
String fileName)
Downloads a file to the backend. |
|
URI |
downloadFileNow(URI url,
String storageGroup,
String fileName)
Downloads a file to the backend. |
|
IProgramInfo |
fillProgramInfo(IProgramInfo programInfo)
Fills in the pathname and file size fields of the given recording. |
|
IProgramInfo |
fillProgramInfo(IProgramInfo programInfo,
String playBackHostname)
Fills in the pathname and file size fields of the given recording. |
|
boolean |
forceDeleteRecording(IProgramInfo programInfo)
Deletes a recording-file and recording metadata. |
|
boolean |
forgetRecording(IProgramInfo programInfo)
Delets recording history. |
|
boolean |
freeTuner(Integer recorderID)
Frees a previously locked tuner. |
|
|
getBasicChannelInfos()
Get a list of all available channels on all available recorders. |
|
List<IRecorderChannelInfo> |
getChannelInfos()
Get a list of all available channels on all available recorders. |
|
Map<String,String> |
getChannelLogoMap(IRecorderNextProgramInfo.Props keyProp)
Gets a map containing the path to all channel logos. |
|
IBackendConnection |
getCommandConnection()
Get the connection that was established to the backend. |
|
IRecorderInfo |
getFreeRecorder()
A function to get the next free recorder . |
|
IRecorderInfo |
getFreeRecorder(String channelNumber)
Gets the next free recorder that is capable to display the requested channel. |
|
int |
getFreeRecorderCount()
Function to determine the amount of free recorders. |
|
int[] |
getFreeRecorderIDs()
Gets the IDs of all free recorders. |
|
List<IRecorderInfo> |
getFreeRecorders()
Gets the recorder-info objects of all free recorders. |
|
IBasicFreeSpace |
getFreeSpaceOverview()
Gets the free space on the backend. |
|
String |
getHostName()
Get the host name of the backend the client is connected to. |
|
int |
getHostPort()
Get the connection port. |
|
IRecorderInfo |
getNextFreeRecorder()
A function to get an info about the next free recorder. |
|
IRecorderInfo |
getNextFreeRecorder(Integer currentRecorderID)
A function to get the next free recorder. |
|
IRecorderInfo |
getNextFreeRecorder(IRecorderInfo currentRecorder)
A function to get the next free recorder. |
|
List<IRecorderNextProgramInfo> |
getNextProgramInfos(Date date)
Gets the next programs of all known channels. |
|
IRecorder |
getRecorder(IRecorderInfo recorderInfo)
Connects to the specified recorder. |
|
IRecorderInfo |
getRecorderForNum(int recorderId)
Returns the recorder-info for the recorder, specified by id. |
|
IRecorderInfo |
getRecorderForProgram(IProgramInfo programInfo)
Checks if the given program is currently being recorded and returns the recorder-info for the recorder or null , if it is not being recorded. |
|
int[] |
getRecorderIDs()
Returns the IDs of all available recorders. |
|
IRecorderInfo |
getRecorderNum(IProgramInfo programInfo)
Determines the recorder, which is currently recording the given program. |
|
List<IRecorderInfo> |
getRecorders()
A function to get all available recorders, independently of their busy status. |
|
ProtocolVersion |
getVersionNr()
Get the MythTV protocol-version the backend is speaking. |
|
boolean |
goToSleep()
Signals a slave backend to go to sleep. |
|
boolean |
hasFreeRecorders()
Determines if there are any free recorders. |
|
boolean |
isActiveBackend()
Checks if the current backend is active. |
|
boolean |
isActiveBackend(String hostname)
Checks if the given backend is active. |
|
boolean |
isConnected()
Queries the current connection status. |
|
void |
liveTvChainUpdate(String chainId)
XXX: is this event really required for a client? |
|
ITunerInfo |
lockTuner()
Asks the backend to lock the next free tuner. |
|
ITunerInfo |
lockTuner(Integer recorderID)
Asks the backend to lock the given tuner. |
|
List<String> |
queryActiveBackends()
Queries the names of all active backends. |
|
IRecordingsPending |
queryAllPending()
Gets all programs that will be recorded soon. |
|
IRecordingsScheduled |
queryAllScheduled()
Gets all scheduled recordings. |
|
Long |
queryBookmark(Integer channelID,
Date recordingStartTime)
Queries the bookmark position for a given recording. |
|
Long |
queryBookmark(IProgramInfo program)
Queries the bookmark position for a given recording. |
|
IFileStatus |
queryCheckFile(IProgramInfo programInfo,
Boolean checkSlaves)
Checks if a recording file exists that belongs to the given program. |
|
IRecordingsConflicting |
queryConflicting()
Gets all programs that are in conflict which each other. |
|
IRecordingsConflicting |
queryConflicting(IProgramInfo programInfo)
Gets all programs that are in conflict with the given program. |
|
IRecordingsExpiring |
queryExpiring()
Gets all programs that will expiring soon. |
|
IFileStatus |
queryFileExists(IProgramInfo programInfo)
Checks if a recording-file exists for the given program. |
|
IFileStatus |
queryFileExists(String fileName,
String storageGroup)
Checks if a the named file exists in the named storage group. |
|
FileStatus |
queryFileExists(URI fileUrl)
Checks if given file exists on the backend. |
|
String |
queryFileHash(IProgramInfo programInfo)
Queries a unique hash-value for the recording-file of the given program. |
|
String |
queryFileHash(String fileName,
String storageGroup)
Queries a unique hash-value for the given file stored in the given storage group. |
|
String |
queryFileHash(String fileName,
String storageGroup,
String hostName)
Queries a unique hash-value for the given file stored in the given storage group. |
|
String |
queryFileHash(URI fileUrl)
Queries a unique hash-value for the given remote file. |
|
IFreeSpace |
queryFreeSpace()
Deprecated. 17 (fallback-to: -1), replaced by queryFreeSpaceList and queryFreeSpaceSummary |
|
IFreeSpaceList |
queryFreeSpaceList(boolean allhosts)
Returns the free disk space on the connected or on all MythTV backends. |
|
IFreeSpaceSummary |
queryFreeSpaceSummary()
Returns the free space on the connected backend. |
|
boolean |
queryGenPixmap(IProgramInfo program)
Deprecated. 61 (fallback-to: -1), replaced by queryGenPixmap2 |
|
boolean |
queryGenPixmap(IProgramInfo program,
Boolean inSeconds,
Long time,
String fileName,
Integer width,
Integer height)
Deprecated. 61 (fallback-to: -1), replaced by queryGenPixmap2 |
|
boolean |
queryGenPixmap2(String token,
IProgramInfo program)
Generates a preview image of the requested show. |
|
boolean |
queryGenPixmap2(String token,
IProgramInfo program,
Boolean inSeconds,
Long time,
String fileName,
Integer width,
Integer height)
Generates a preview image of the requested show. |
|
IGuideDataThrough |
queryGuideDataThrough()
Queries the guide-date status of the backend. |
|
String |
queryHostname()
Gets the hostname of the backend. |
|
IRecordingStatus |
queryIsRecording()
Queries the current recording status of the backend. |
|
ILoad |
queryLoad()
Queries the current load of the backend. |
|
IMemStats |
queryMemStats()
Queries the current memory state of the backend. |
|
IPixmap |
queryPixmap(IProgramInfo program)
Queries a preview image. |
|
IPixmap |
queryPixmap(String fileName,
String storageGroup)
Queries a preview image. |
|
IPixmap |
queryPixmapIfModified(IProgramInfo program,
Date lastModifiedDate,
Long fileSize)
Queries a preview image. |
|
Date |
queryPixmapLastModified(IProgramInfo program)
Queries the last-modified date of the pixmap of a given recording. |
|
IProgramInfo |
queryRecording(IBasicChannelInfo channel,
Date recordingStartTime)
Get a single recording by its channel and recording start-time. |
|
IProgramInfo |
queryRecording(Integer channelID,
Date recordingStartTime)
Get a single recording by its channel-id and start-time. |
|
IProgramInfo |
queryRecording(String baseName)
Get the ProgramInfo for a single recording specified by the recordings base-name. |
|
IProgramInfoList |
queryRecordings()
Queries for all available recordings. |
|
IProgramInfoList |
queryRecordings(ERecordingsType eRecordingsType)
Queries for recordings with the given recording-type. |
|
ISetting |
querySetting(String hostName,
String settingName)
Queries the remote host for a specific setting. |
|
IStorageGroupFile |
queryStorageGroupFile(String hostName,
String storageGroup,
String fileName)
Queries the a single file from the remote storage group. |
|
IStorageGroupFileList |
queryStorageGroupFileList(String hostName,
String storageGroup,
String path)
Queries the a list of files from the remote storage group. |
|
IStorageGroupFileList |
queryStorageGroupFileList(String hostName,
String storageGroup,
String path,
boolean fileNamesOnly)
Queries the a list of files from the remote storage group. |
|
ITimezone |
queryTimeZone()
Queries the timezone of the backend. |
|
IUptime |
queryUptime()
Queries the uptime of the backend. |
|
boolean |
queueTranscode(IProgramInfo recording)
Deprecated. 23 |
|
boolean |
queueTranscodeCutlist(IProgramInfo recording)
Deprecated. 23 |
|
boolean |
queueTranscodeStop(IProgramInfo recording)
Deprecated. 23 |
|
boolean |
reactivateRecording(IProgramInfo programInfo)
Deprecated. 19 |
|
void |
recordingListChange()
|
|
boolean |
refreshBackend()
Forces the backend to reload the backend settings. |
|
|
removeEventListener(Class<Event> eventClass,
IMythEventListener<Event> listener)
|
|
void |
removeEventPacketListener(IMythEventPacketListener listener)
Unregisters a event listener. |
|
boolean |
rescheduleAllRecordings()
Force MythTV to reschedule all recordings. |
|
Boolean |
rescheduleAllRecordingsAndWait(long timeout,
TimeUnit unit)
Forces MythTV to reschedule all recordings and thereafter to wait for an SCHEDULE_CHANGE event. |
|
boolean |
rescheduleRecordings(Integer recordingId)
Deprecated. 73 (fallback-to: -1), use rescheduleRecordingsMatch(Integer, Integer, Integer, Date, String) instead. |
|
Boolean |
rescheduleRecordingsAndWait(Integer recordingId,
long timeout,
TimeUnit unit)
Deprecated. 73 (fallback-to: -1) |
|
boolean |
rescheduleRecordingsMatch(Integer recordID,
Integer sourceID,
Integer multiplexID,
Date maxStartTime,
String reason)
Deprecated. 73 (fallback-to: -1), use rescheduleRecordingsMatch(Integer, Integer, Integer, Date, String) instead. |
|
Boolean |
rescheduleRecordingsMatchAndWait(Integer recordID,
Integer sourceID,
Integer multiplexID,
Date maxStartTime,
String reason,
long timeout,
TimeUnit unit)
|
|
boolean |
scanVideos()
Trigger a scan of all video folders. |
|
boolean |
setBookmark(Integer channelID,
Date recordingStartTime,
Long bookmarkPosition)
Sets the bookmark position for the given recording. |
|
boolean |
setBookmark(IProgramInfo recording,
Long bookmarkPosition)
Sets the bookmark position for the given recording. |
|
boolean |
setChannelInfo(String oldChannelNumber,
IRecorderChannelInfo channelInfo)
Changes detailed infos about the given channel. |
|
void |
setInitialVersionNr(ProtocolVersion protoVersion)
Sets the initial protocol-version that should be used for handshake. |
|
boolean |
setSetting(String hostName,
String settingName,
String settingValue)
Sets the given setting on the remote host. |
|
void |
shutdownNow()
Forces a slave backend to shutdown now. |
|
Integer |
stopRecording(IProgramInfo programInfo)
Stop a currently active recording. |
|
boolean |
undeleteRecording(IProgramInfo programInfo)
Undelets a recording-file. |
Methods inherited from interface java.io.Closeable |
---|
close |
Method Detail |
---|
IBackendConnection getCommandConnection()
null
if no connection was established so farString getHostName()
int getHostPort()
ProtocolVersion getVersionNr()
void setInitialVersionNr(ProtocolVersion protoVersion)
protoVersion
- the initial protocol versionvoid connect() throws IOException
Once the connection is established, the protocol-version is negotiated.
IOException
- on communication errorsvoid connect(Integer connectionTimeout) throws IOException
IOException
void disconnect()
boolean isConnected()
true
if a connection was established.boolean annotatePlayback() throws IOException
This signals that backend that a new client will start playback and prevents it from shutting down the socket.
boolean annotatePlayback(String clientHostName) throws IOException
This signals that backend that a new client will start playback and prevents it from shutting down the socket.
boolean annotatePlayback(String clientHostName, EPlaybackSockEventsMode eventsMode) throws IOException
This signals that backend that a new client will start playback and prevents it from shutting down the socket.
clientHostName
- the name of this clienteventsMode
- the type of events the client is interested in.
true
if the backend respond with OK
IOException
- on communication errorsANN_PLAYBACK
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 00 | ||
Removed | -1 |
boolean annotateMonitor() throws IOException
This signals that backend that a new client will start querying the backend but does not prevents it from shutting down the socket.
boolean annotateMonitor(String clientHostName) throws IOException
This signals that backend that a new client will start querying the backend but does not prevents it from shutting down the socket.
boolean annotateMonitor(String clientHostName, EPlaybackSockEventsMode eventsMode) throws IOException
This signals that backend that a new client will start querying the backend but does not prevents it from shutting down the socket.
clientHostName
- the name of this clienteventsMode
- the type of events the client is interested in.
true
if the backend respond with OK
IOException
- on communication errorsANN_MONITOR
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 22 | 2005-11-15 | Changelog, SVN-Rev.: 7883 |
Removed | -1 |
IFileTransfer annotateFileTransfer(IProgramInfo programInfo) throws IOException
// getting previously recorded programs IProgramInfoList programs = backend.queryRecordings(); // getting the recording to transfer (we just use the first recording) IProgramInfo program = programs.get(0); // annotate a new file transfer IFileTransfer transfer = backend.annotateFileTransfer(program); if (transfer.isOpen()) { // set fast timeout transfer.setTimeout(true); // copy data File tempFile = File.createTempFile("fileTransfer", ".mpg"); transfer.transferTo(tempFile); } // close file transfer transfer.close();
programInfo
- the program, whose file should be transfered
IOException
- on communication errorsannotateFileTransfer(String, Boolean, Integer, Integer, String)
,
ANN_FILE_TRANSFER
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 00 | ||
Removed | -1 |
IFileTransfer annotateFileTransfer(IProgramInfo programInfo, Boolean useReadAhead, Integer retries, Integer timeoutMs) throws IOException
It reads the file-name and storage-group from the given program-info object and calls
annotateFileTransfer(String, Boolean, Integer, Integer, String)
.
programInfo
- the program, whose file should be transfereduseReadAhead
- if the backend should read ahead the requested location via a separate thread (since 29)retries
- how many retries should be done before giving up (since 29, deprecated 60)timeoutMs
- the timeout to wait for data in milliseconds (since 60)
IOException
- on communication errorsannotateFileTransfer(String, Boolean, Integer, Integer, String)
,
ANN_FILE_TRANSFER
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 00 | ||
Changed | 29 | 2006-04-01 | Changelog, SVN-Rev.: 9592 |
Changed | 60 | 2010-09-03 | Changelog, SVN-Rev.: 26101 |
Removed | -1 |
FileTransfer annotateFileTransfer(URI fileUrl) throws IOException
This method calls URI.getUserInfo()
and URI.getPath()
to determine the storage-group and file name
and calls annotateFileTransfer(String, Boolean, Integer, Integer, String)
afterwards.
FileTransfer annotateFileTransfer(String fileName, String storageGroup) throws IOException
This method internally calls annotateFileTransfer(String, Boolean, Integer, Integer, String)
.
IBackend backend = ...; // an already connected backend IProgramInfo program = ...; // a previously recorded program // the storage group and name of the recording preview image String storagGroup = program.getStorageGroup(); String previewFileName = program.getPreviewImageName(); // transfering the recording preview image to the client File targetFile = File.createTempFile("preview", ".png"); IFileTransfer transfer = backend.annotateFileTransfer(previewFileName,storagGroup); transfer.transferTo(targetFile); transfer.close();
fileName
- the name of the file to be transferedstorageGroup
- the name of the storage-group the file is located in (since 44)
IOException
- on communication errorsANN_FILE_TRANSFER
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 00 | ||
Changed | 44 | 2009-02-12 | Changelog, SVN-Rev.: 19978 |
Removed | -1 |
IFileTransfer annotateFileTransfer(String fileName, Boolean useReadAhead, Integer retries, Integer timeoutMs, String storageGroup) throws IOException
This command must be sent as first command after calling connect()
.
IBackend backend = ...; // an already connected backend IProgramInfo program = ...; // a previously recorded program // the storage group and name of the recording preview image String storagGroup = program.getStorageGroup(); String previewFileName = program.getPreviewImageName(); // transfering the recording preview image to the client File targetFile = File.createTempFile("preview", ".png"); IFileTransfer transfer = backend.annotateFileTransfer(previewFileName, Boolean.TRUE, -1, 2000, storagGroup); transfer.transferTo(targetFile); transfer.close();
fileName
- the name of the file to be transferedstorageGroup
- the name of the storage-group the file is located in (since 44)useReadAhead
- if the backend should read ahead the requested location via a separate thread. If null
then true
is used. (since 29)retries
- how many retries should be done before giving up. If null
then -1
is used. (since 29, deprecated 60)timeoutMs
- the timeout to wait for data in milliseconds. If null
then 2000
is used. (since 60)
IOException
- on communication errorsANN_FILE_TRANSFER
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 00 | ||
Changed | 29 | 2006-04-01 | Changelog, SVN-Rev.: 9592 |
Changed | 44 | 2009-02-12 | Changelog, SVN-Rev.: 19978 |
Changed | 60 | 2010-09-03 | Changelog, SVN-Rev.: 26101 |
Removed | -1 |
IRecorder getRecorder(IRecorderInfo recorderInfo) throws IOException
This method and returns a recorder object which allows to send command to the recorder.
IBackend backend = ....; // an already connected backend // getting the next free recorder IRecorderInfo recorderInfo = backend.getNextFreeRecorder(); if(recorderInfo != null) { // connect to the recorder IRecorder recorder = backend.getRecorder(recorderInfo); // send commands to the recorder ... // e.g., getting all available channel List<IBasicChannelInfo> channels = recorder.getBasicChannelInfos(); for(IBasicChannelInfo channel : channels) { System.out.println(String.format("Channel %d: %s",channel.getChannelID(),channel.getChannelSign())); } } else { System.out.println("No free recorder available"); }
IRecorderInfo getNextFreeRecorder() throws IOException
IRecorderInfo getNextFreeRecorder(Integer currentRecorderID) throws IOException
currentRecorderID
- the current recorder id
null
if no recorder is available.
IOException
- on communication errorsGET_NEXT_FREE_RECORDER
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 03 | 2004-02-05 | Changelog, SVN-Rev.: 3112 |
Removed | -1 |
IRecorderInfo getNextFreeRecorder(IRecorderInfo currentRecorder) throws IOException
currentRecorder
- the current recorder
null
if no recorder is available.
IOException
- on communication errorsGET_NEXT_FREE_RECORDER
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 03 | 2004-02-05 | Changelog, SVN-Rev.: 3112 |
Removed | -1 |
IRecorderInfo getFreeRecorder() throws IOException
recorder
.
This is similar to getNextFreeRecorder()
, except that it tries to get a recorder on the local machine if possible.
IRecorderInfo getFreeRecorder(String channelNumber) throws IOException
channelNumber
- the desired channel
null
IOException
- on communication errorsIRecorder.checkChannel(String)
List<IRecorderInfo> getRecorders() throws IOException
This function uses getRecorderForNum
, starting with recorder-index 1
,
to determine all available recorders.
getFreeRecorders
to only get free recorders.
IBackend backend = ...; // an already connected backend // determine all available recorders List<IRecorderInfo> recorderInfos = backend.getRecorders(); // print out the recorder connection infos System.out.println(String.format("%d recorders found:",recorderInfos.size())); for(IRecorderInfo recorderInfo : recorderInfos) { System.out.println(String.format( "%02d: %s:%d", recorderInfo.getRecorderID(), recorderInfo.getHostName(), recorderInfo.getHostPort() )); }
3 recorders found: 01: 192.168.10.202:6543 02: 192.168.10.202:6543 03: 192.168.10.202:6543
int[] getRecorderIDs() throws IOException
This method returns all recorders, independently of their busy status.
The returned IDs can be used as argument for function getRecorderForNum
to
fetch further information about the recorders.
getFreeRecorderIDs
to only get the IDs of all free recorders.
IBackend backend = ...; // an already connected backend // get the IDs of all available (busy or idle) recorders int[] allRecorderIDs = backend.getRecorderIDs(); System.out.println(String.format( "%d recorders are available:", allRecorderIDs.length )); for(int recorderId : allRecorderIDs) { // get the recorder info IRecorderInfo recorderInfo = backend.getRecorderForNum(recorderId); // connect to the recorder IRecorder recorder = backend.getRecorder(recorderInfo); // get the recorder status boolean isRecording = recorder.isRecording(); System.out.println(String.format( "Recorder %d is currently %s", recorderId, isRecording?"busy":"idle" )); }
3 recorders are available: Recorder 1 is currently busy Recorder 2 is currently idle Recorder 3 is currently idle
IRecorderInfo getRecorderForNum(int recorderId) throws IOException
IBackend backend = ...; // an already connected backend // getting recorder info by recorder-id IRecorderInfo recorderInfo = backend.getRecorderForNum(recorderId); // connect to the recorder IRecorder recorder = backend.getRecorder(recorderInfo); // getting the currently active recorder input and channel String recorderInput = recorder.getInput(); IBasicChannelInfo recorderChannel = recorder.getCurrentChannel(); System.out.println(String.format( "Recorder %d is using input: %s (channel: %s).", recorderId, recorderInput, recorderChannel.getChannelSign() ));
Recorder 1 is using input: Tuner 1 (channel: PRO7).
IRecorderInfo getRecorderNum(IProgramInfo programInfo) throws IOException
programInfo
- the recording
null
if no recorder was found.
IOException
- on communication errorsGET_RECORDER_NUM
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 00 | ||
Removed | -1 |
int getFreeRecorderCount() throws IOException
getFreeRecorderIDs()
is called to determine
the amount of free recorders.
IBackend backend = ...; // an already connected backend // get the amount of free recorders int freeRecorderCount = backend.getFreeRecorderCount(); System.out.println(String.format( "%d free recorders found.", freeRecorderCount ));
IOException
- on communication errorsGET_FREE_RECORDER_COUNT
Version | Date | Additional Version Info | |
---|---|---|---|
Fallback | 03 | 2004-02-05 | The function can be can be used with restrictions starting with version 3. |
Added | 09 | 2004-06-04 | Changelog, SVN-Rev.: 3838 |
Removed | -1 |
int[] getFreeRecorderIDs() throws IOException
This function returns a list of free recorders IDs, or an empty list if none. The returned IDs can be used as argument for function getRecorderForNum(int)
to fetch further information about the recorders.
getRecorderIDs
to get the id of all (busy or idle) recorders.
getNextFreeRecorder(Integer)
to determine the IDs of all free recorders.
IBackend backend = ...; // an already connected backend // query the IDs of all free recorders int[] freeRecorderIDs = backend.getFreeRecorderIDs(); System.out.println(String.format( "The following recorders are ready to use: %s", Arrays.toString(freeRecorderIDs) ));
IOException
- on communication errorsGET_FREE_RECORDER_LIST
Version | Date | Additional Version Info | |
---|---|---|---|
Fallback | 03 | 2004-02-05 | The function can be can be used with restrictions starting with version 3. |
Added | 17 | 2005-05-24 | Changelog, SVN-Rev.: 6482 |
Removed | -1 |
boolean hasFreeRecorders() throws IOException
This function used getFreeRecorderCount
to determine if there is
at lease one free recorder available.
List<IRecorderInfo> getFreeRecorders() throws IOException
This method internally uses getFreeRecorderIDs()
to determine
all free recorders and getRecorderForNum(int)
to fetch the information
for a recorder.
getRecorders
to get all (busy or idel) recorders.
void recordingListChange() throws IOException
IOException
- on communication errorsBACKEND_MESSAGE_RECORDING_LIST_CHANGE
void liveTvChainUpdate(String chainId) throws IOException
IProgramInfoList queryRecordings() throws IOException
queryAllScheduled
to get all scheduled recordings.queryAllPending
to get all pending recordings.queryConflicting
to get all conflicting recordings.queryExpiring
to get all expiring recordings.recording-status
was not set properly by the MythTV-backend. For this protocol versions, this function additionally uses
queryAllPending()
to determine, which of the returned recordings are still in progress.
// query all available recordings IProgramInfoList allRecordings = backend.queryRecordings(); // print the channel, length, file-size and title of all recordings System.out.println("Channel | Length | Size | Title"); for(IProgramInfo program : allRecordings) { // print out the found recodings System.out.println(String.format( "%-5s | %3d min | %8s | %s", program.getChannelSign(), program.getDuration(), EncodingUtils.getFormattedFileSize(Locale.ENGLISH,program.getFileSize()), program.getFullTitle() )); }
The above example will output, e.g.
Channel | Length | Size | Title ATV+ | 55 min | 3.51 GB | Dr. Quinn - Ärztin aus Leidenschaft - Für das Leben der Cheyenne RTL2 | 30 min | 2.34 GB | King of Queens - Wer schön sein will ... RTL2 | 30 min | 2.34 GB | King of Queens - Das Haus am See
IProgramInfoList queryRecordings(ERecordingsType eRecordingsType) throws IOException
queryAllScheduled
to get all scheduled recordings.queryAllPending
to get all pending recordings.queryConflicting
to get all conflicting recordings.queryExpiring
to get all expiring recordings.recording-status
was not set properly by the MythTV-backend. For this protocol versions, this function additionally uses
queryAllPending()
to determine, which of the returned recordings are still in progress.
eRecordingsType
- the type of the requested recordings. Use null
or ERecordingsType.Play
to query all available recordings.
IOException
- on communication errorsQUERY_RECORDINGS
,
QUERY_ISRECORDING
,
QUERY_GETALLPENDING
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 00 | ||
Changed | 19 | 2005-10-09 | Changelog, SVN-Rev.: 7427 |
Removed | -1 |
boolean queryGenPixmap(IProgramInfo program) throws IOException
queryGenPixmap2
queryPixmapLastModified
to query the last modified date of the pixmap.queryPixmap
to download the pixmap file.queryGenPixmap2(...)
.
IBackend backend = ....; // an already connected backend IProgramInfo program = ...; // a previously recorded program // generate the preview image if (backend.queryGenPixmap(program) { // getting the preview image name String imageName = program.getPreviewImageName(); // create a temp file to store the preview image File targetFile = File.createTempFile("preview", ".png"); // copy the png to the client IFileTransfer transfer = backend.annotateFileTransfer(imageName, null, null, null); transfer.transferTo(targetFile); transfer.close(); // load the image BufferedImage image = ImageIO.read(targetFile); System.out.println(String.format( "Image %s has a size of %dx%d", targetFile.getName(), image.getWidth(), image.getHeight() )); } else { Sytem.error.println("Preview image generation failed."); }
program
- the recording, for which a preview image should be generated
IOException
- on communication errorsQUERY_GENPIXMAP
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 00 | ||
Changed | 60 | 2010-09-03 | Changelog, SVN-Rev.: 26101 |
Removed | 61 | 2010-09-03 | Changelog, SVN-Rev.: 26106 |
Fallback | -1 | The function can be can be used with restrictions till version 77. |
boolean queryGenPixmap(IProgramInfo program, Boolean inSeconds, Long time, String fileName, Integer width, Integer height) throws IOException
queryGenPixmap2
queryPixmapLastModified
to query the last modified date of the pixmap.queryPixmap
to download the pixmap file.queryGenPixmap2(...)
.
program
- the recording, to grab a preview image frominSeconds
- if true time is in seconds, otherwise it is in frames (since 37)time
- the seconds or frames into the video to seek before capturing a frame (since 37)fileName
- the filename to use (since 37)width
- the preview image width (since 37)height
- the preview image height (since 37)
IOException
- on communication errorsQUERY_GENPIXMAP
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 00 | ||
Changed | 37 | 2008-01-14 | Changelog, SVN-Rev.: 15437 |
Removed | 61 | 2010-09-03 | Changelog, SVN-Rev.: 26106 |
Fallback | -1 | The function can be can be used with restrictions till version 77. |
boolean queryGenPixmap2(String token, IProgramInfo program) throws IOException
queryPixmapLastModified
to query the last modified date of the pixmap.queryPixmap
to download the pixmap.queryGenPixmap2
to generate an alternative pixmap.
Listen to the event IPixmapGenerated
to receive a notification about the finished generation of the pixmap.
queryGenPixmap
is called instead.
token
- a unique token that is assigned to the generation job.program
- the recording, for which a preview image should be generated
true
on success
IOException
- on communication errorsqueryGenPixmap
QUERY_GENPIXMAP2
Version | Date | Additional Version Info | |
---|---|---|---|
Fallback | 00 | The function can be can be used with restrictions starting with version 0. | |
Added | 61 | 2010-09-03 | Changelog, SVN-Rev.: 26106 |
Removed | -1 |
boolean queryGenPixmap2(String token, IProgramInfo program, Boolean inSeconds, Long time, String fileName, Integer width, Integer height) throws IOException
queryPixmapLastModified
to query the last modified date of the pixmap.queryPixmap
to download the pixmap file.
Listen to the event IPixmapGenerated
to receive a notification about the finished generation of the pixmap.
queryGenPixmap
is called instead.
token
- a unique token that is assigned to the generation job.program
- the recording, for which a preview image should be generatedinSeconds
- if true time is in seconds, otherwise it is in framestime
- the seconds or frames into the video to seek before capturing a framefileName
- the filename to usewidth
- the preview image widthheight
- the preview image height
true
on success
IOException
- on communication errorsqueryGenPixmap
QUERY_GENPIXMAP2
Version | Date | Additional Version Info | |
---|---|---|---|
Fallback | 00 | The function can be can be used with restrictions starting with version 0. | |
Added | 61 | 2010-09-03 | Changelog, SVN-Rev.: 26106 |
Removed | -1 |
Date queryPixmapLastModified(IProgramInfo program) throws IOException
queryGenPixmap2
to generate the pixmap.queryPixmap
to download the pixmap.IBackend backend = ...; // an already connected backend IProgramInfo program = ...; // a previously recorded program // get the pixmal last modified date Date lastMod = backend.queryPixmapLastModified(program); System.out.println(String.format( "Pixmap of program '%s' was last modified at '%tc'.", program.getTitle(), lastMod ));
program
- the recording whose pixmap should be checked.
IOException
- on communication errorsQUERY_PIXMAP_LASTMODIFIED
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 17 | 2005-05-24 | Changelog, SVN-Rev.: 6482 |
Removed | -1 |
IPixmap queryPixmap(IProgramInfo program) throws IOException
queryPixmapLastModified
to determine the last-modified date of the pixmap.queryGenPixmap2
to generate the pixmap.queryPixmap
do download a pixmap with a different name.annotateFileTransfer(String, String)
to download the preview image.
For later versions queryPixmapIfModified(IProgramInfo, Date, Long)
is used.
program
- the recording whose pixmap should be returned
null
IOException
- on communication errorsIMythCommand.QUERY_PIXMAP_GET_IF_MODIFIED
,
IMythCommand.ANN_FILE_TRANSFER
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 00 | ||
Changed | 49 | 2009-10-01 | Changelog, SVN-Rev.: 22164 |
Removed | -1 |
IPixmap queryPixmap(String fileName, String storageGroup) throws IOException
This function uses annotateFileTransfer(String, String)
to download the preview image file with the given name.
See queryPixmapLastModified
if you just want to determine the last-modified date of the pixmap.
See queryGenPixmap2
on how to generate the pixmap.
fileName
- the name of the pixmap filestorageGroup
- the storage group of the pixmap. If null
then Default
is used.
null
IOException
- on communication errorsIMythCommand.ANN_FILE_TRANSFER
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 00 | ||
Removed | -1 |
IPixmap queryPixmapIfModified(IProgramInfo program, Date lastModifiedDate, Long fileSize) throws IOException
This command can be used to download a previously generated preview image.
Optionally it can be specified that the preview image should only be returned:
queryPixmapLastModified
if you just want to determine the last-modified date of the pixmap.queryGenPixmap2
to generate the pixmap.queryPixmapLastModified
to determine
the last modified timestamp of the image, and calls annotateFileTransfer
afterwards to download the image.
program
- the recording whose pixmap should be returnedlastModifiedDate
- the last modified date or null
if the preview image should be downloadedfileSize
- the maximum file size. If this is 0
only the last modified timestamp is returned.null
if you do not care about the size.
null
if the size was exceeded or if an error has occured.
IOException
- on communication errorsQUERY_PIXMAP_GET_IF_MODIFIED
Version | Date | Additional Version Info | |
---|---|---|---|
Fallback | 17 | 2005-05-24 | The function can be can be used with restrictions starting with version 17. |
Added | 49 | 2009-10-01 | Changelog, SVN-Rev.: 22164 |
Removed | -1 |
boolean deleteRecording(IProgramInfo programInfo) throws IOException
This function marks a recording for deletion, following the existing deletion rules, but does not delete the recording-metadata and -history.
forceDeleteRecording
for also deleting the recording metadata.forgetRecording
for also deleting the recording history.
IBackend backend = ...; // an already connected backend IProgramInfo program = ...; // a previously recorded program // delete the recording if(backend.deleteRecording(program)) { System.out.println(String.format( "Recording '%s' successfully deleted.", program.getTitle(), )); }
boolean deleteRecording(IProgramInfo programInfo, Boolean forceMetadatDelete, Boolean forgetHistory) throws IOException
This function marks a recording for deletion, following the existing deletion rules. Optionally this function can delete the metadata of a recording and the recording history.
forgetRecording
forceDeleteRecording
(since 16)deleteRecording
programInfo
- the recordingforceMetadatDelete
- forces deletion of recording metadata (since 56)forgetHistory
- forces deletion of recording history (since 59)
true
on success
IOException
- on communication errorsDELETE_RECORDING
Version | Date | Additional Version Info | |
---|---|---|---|
Fallback | 16 | 2005-05-03 | The function can be can be used with restrictions starting with version 16. |
Added | 41 | 2008-09-25 | Changelog, SVN-Rev.: 18419 |
Changed | 56 | 2009-12-29 | Changelog, Changelog, MythBuntu-Release: 10.04, MythTV-Release: 0.23, SVN-Rev.: 23028, SVN-Rev.: 23012 |
Changed | 59 | 2010-08-26 | Changelog, SVN-Rev.: 25858 |
Removed | -1 |
boolean deleteRecording(Integer channelID, Date recordingStartTime) throws IOException
This function marks a recording for deletion, following the existing deletion rules, but does not delete the recording metadata and history.
forceDeleteRecording
for also deleting the recording metadata.forgetRecording
for also deleting the recording history.queryRecording(Integer, Date)
,
and deleteRecording(IProgramInfo)
is called afterwards.
channelID
- the channel id of the recordingrecordingStartTime
- the recording-start-time
true
on success
IOException
- on communication errorsDELETE_RECORDING
Version | Date | Additional Version Info | |
---|---|---|---|
Fallback | 00 | The function can be can be used with restrictions starting with version 0. | |
Added | 41 | 2008-09-25 | Changelog, SVN-Rev.: 18419 |
Removed | -1 |
boolean deleteRecording(Integer channelID, Date recordingStartTime, Boolean forceMetadatDelete, Boolean forgetHistory) throws IOException
This function marks a recording-file for deletion, following the existing deletion rules. Optionally this function can delete the metadata of a recording and the recording history.
queryRecording
forgetRecording
forceDeleteRecording
(since 16)deleteRecording
channelID
- the channel id of the recordingrecordingStartTime
- the recording start timeforceMetadatDelete
- forces deletion of recording metadata (since 56)forgetHistory
- forces deletion of recording history (since 59)
true
on success
IOException
- on communication errorsDELETE_RECORDING
Version | Date | Additional Version Info | |
---|---|---|---|
Fallback | 16 | 2005-05-03 | The function can be can be used with restrictions starting with version 16. |
Added | 41 | 2008-09-25 | Changelog, SVN-Rev.: 18419 |
Changed | 56 | 2009-12-29 | Changelog, Changelog, MythBuntu-Release: 10.04, MythTV-Release: 0.23, SVN-Rev.: 23028, SVN-Rev.: 23012 |
Changed | 59 | 2010-08-26 | Changelog, SVN-Rev.: 25858 |
Removed | -1 |
boolean undeleteRecording(IProgramInfo programInfo) throws IOException
This function undeletes a previously deleted recording.
AutoExpireInsteadOfDelete
is set to 1
in the MythTV settings table.
boolean forgetRecording(IProgramInfo programInfo) throws IOException
This function deletes the history of a recording but not the recording itself.
The recording is marked as never duplicates, so it can be re-recorded.
This is similar to the option "Forget Old" on MythWeb.
forceDeleteRecording
to also delete the recording-file and recording-metadata.deleteRecording
to only delete the recording.
boolean forceDeleteRecording(IProgramInfo programInfo) throws IOException
This command forces the backend to delete a recording and its metadata.
See forgetRecording(IProgramInfo)
to also delete the recording-history.
forgetRecording
to just delete the recording history.deleteRecording
to just delete the recording but not the recording metadata.
boolean reactivateRecording(IProgramInfo programInfo) throws IOException
This function allows inactive recordings to be reactivated.
This can be used fro things like restarting a program that was stopped or deleted in progress or starting a program after correcting a low disk space or tuner busy condition.
reactivate
property in database table oldrecorded
.
boolean rescheduleAllRecordings() throws IOException
This should be called if you have manually inserted a recording into the record table.
Boolean rescheduleAllRecordingsAndWait(long timeout, TimeUnit unit) throws IOException, InterruptedException, IllegalStateException
SCHEDULE_CHANGE
event.
EPlaybackSockEventsMode.NORMAL
or EPlaybackSockEventsMode.NON_SYSTEM
, otherwise an IllegalStateException
is thrown.
true
if rescheduling command was transmitted and the rescheduling was done successfully, or
null
if the specified waiting time elapses before the rescheduling process finished.
IOException
- on communication errors
InterruptedException
- if interrupted while waiting.
IllegalStateException
- if the connection was not annotated with the proper events-listening-mode
.Version | Date | Additional Version Info | |
---|---|---|---|
Added | 15 | 2005-03-23 | Changelog, MythTV-Release: 0.18, SVN-Rev.: 5833 |
Removed | -1 |
boolean rescheduleRecordings(Integer recordingId) throws IOException
rescheduleRecordingsMatch(Integer, Integer, Integer, Date, String)
instead.
This should be called if you have manually inserted a recording into the record table.
recordingId
- the ID of the recording to reschedule (see IProgramInfo.getRecordingId()
.null
or -1
forces the backend to reschedule all recordings.0
if the change isn't specific to a single record entry
(e.g. channel or record type priorities)
true
if rescheduling command was transmitted successfully.
IOException
- on communication errorsRESCHEDULE_RECORDINGS
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 15 | 2005-03-23 | Changelog, MythTV-Release: 0.18, SVN-Rev.: 5833 |
Removed | 73 | 2012-04-11 | Changelog |
Fallback | -1 | The function can be can be used with restrictions till version 77. |
boolean rescheduleRecordingsMatch(Integer recordID, Integer sourceID, Integer multiplexID, Date maxStartTime, String reason) throws IOException
rescheduleRecordingsMatch(Integer, Integer, Integer, Date, String)
instead.
recordID
- sourceID
- multiplexID
- maxStartTime
- reason
-
IOException
RESCHEDULE_RECORDINGS
Version | Date | Additional Version Info | |
---|---|---|---|
Fallback | 15 | 2005-03-23 | The function can be can be used with restrictions starting with version 15. |
Added | 73 | 2012-04-11 | Changelog |
Removed | -1 |
Boolean rescheduleRecordingsAndWait(Integer recordingId, long timeout, TimeUnit unit) throws IOException, InterruptedException, IllegalStateException
SCHEDULE_CHANGE
event.
EPlaybackSockEventsMode.NORMAL
or EPlaybackSockEventsMode.NON_SYSTEM
,
otherwise an IllegalStateException
is thrown.
IBackend backend = ...; // an already connected backend Integer recordingId = ...; // the id of a modfied scheduling rule // signal the backend to reschedule the recording and wait for // the rescheduling process to finish. long timeoutSeconds = 5; Boolean rescheduled = backend.rescheduleRecordingsAndWait(recordingId,timeoutSeconds,TimeUnit.SECONDS); if(rescheduled == null) { System.err.println(String.format( "The backend did not finish rescheduling for recording-id %d within %d %s", recordingId, Long.valueOf(timeoutSeconds),TimeUnit.SECONDS )); } else if (!rescheduled.booleanValue()) { System.err.println(String.format( "Unable to transmit the reschedule-recordings command for recording-id %d to the backend.", recordingId )); } else { System.err.println(String.format( "Rescheduling for recording-id %d was done successfully.", recordingId )); }
recordingId
- the ID of the recording to reschedule (see IProgramInfo.getRecordingId()
.
null
or -1
forces the backend to reschedule all recordings.
true
if rescheduling command was transmitted and the rescheduling was done successfully, or
null
if the specified waiting time elapses before the rescheduling process finished.
IOException
- on communication errors
InterruptedException
- if interrupted while waiting.
IllegalStateException
- if the connection was not annotated with the proper events-listening-mode
.Version | Date | Additional Version Info | |
---|---|---|---|
Added | 15 | 2005-03-23 | Changelog, MythTV-Release: 0.18, SVN-Rev.: 5833 |
Removed | 73 | 2012-04-11 | Changelog |
Fallback | -1 | The function can be can be used with restrictions till version 77. |
Boolean rescheduleRecordingsMatchAndWait(Integer recordID, Integer sourceID, Integer multiplexID, Date maxStartTime, String reason, long timeout, TimeUnit unit) throws IOException, InterruptedException, IllegalStateException
IOException
InterruptedException
IllegalStateException
IBasicFreeSpace getFreeSpaceOverview() throws IOException
Protocol [min,max) | Used function | |
---|---|---|
Min | Max | |
00 | 17 | queryFreeSpace() |
17 | 32 | queryFreeSpaceList(boolean) |
32 | - | queryFreeSpaceSummary() |
// the connected backend IBackend backend = ...; // query the used space IBasicFreeSpace freeSpaceOverview = backend.getFreeSpaceOverview(); System.out.println(String.format( "MythTV has used %d space out of %d.", freeSpaceOverview.getTotalSpace(), freeSpaceOverview.getUsedSpace() ));
IOException
- on communication errorsqueryFreeSpace()
,
queryFreeSpaceList(boolean)
,
queryFreeSpaceSummary()
,
QUERY_FREESPACE
,
QUERY_FREE_SPACE_LIST
,
QUERY_FREE_SPACE_SUMMARY
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 00 | ||
Changed | 17 | 2005-05-24 | Changelog, SVN-Rev.: 6482 |
Changed | 32 | 2006-11-30 | Changelog, SVN-Rev.: 12151 |
Removed | -1 |
IFreeSpace queryFreeSpace() throws IOException
queryFreeSpaceList
and queryFreeSpaceSummary
queryFreeSpaceSummary()
is used.
IFreeSpaceList queryFreeSpaceList(boolean allhosts) throws IOException
// query freespace for all hosts IFreeSpaceList freeSpaceList = backend.queryFreeSpaceList(true); // print the summary System.out.println(String.format( "MythTV has used %s space out of %s used on %d storage groups.", EncodingUtils.getFormattedFileSize(freeSpaceList.getUsedSpace()), EncodingUtils.getFormattedFileSize(freeSpaceList.getTotalSpace()), freeSpaceList.size() )); // print details for each storage group for (IFreeSpaceListEntry entry : freeSpaceList) { System.out.println(String.format( "- %s : %s space out of %s used", entry.getDirectories(), EncodingUtils.getFormattedFileSize(entry.getUsedSpace()), EncodingUtils.getFormattedFileSize(entry.getTotalSpace()) )); }
MythTV has used 3,17 GB space out of 3,72 GB used on 2 storage groups. - [mythbox:/mnt/data/mythpinky] : 3,14 GB space out of 3,58 GB used - [mythbox:/var/lib/mythtv/livetv, mythbox:/var/lib/mythtv/recordings] : 28,00 MB space out of 137,93 MB used
allhosts
- if the disk space status of all backends should be returned. if this is false
only the current connected backend is returned.
IOException
- on communication errorsQUERY_FREE_SPACE_LIST
,
QUERY_FREE_SPACE
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 17 | 2005-05-24 | Changelog, SVN-Rev.: 6482 |
Removed | -1 |
IFreeSpaceSummary queryFreeSpaceSummary() throws IOException
ILoad queryLoad() throws IOException
IUptime queryUptime() throws IOException
IMemStats queryMemStats() throws IOException
IGuideDataThrough queryGuideDataThrough() throws IOException
IGuideDataThrough data = backend.queryGuideDataThrough(); System.out.println(String.format( "There's guide data until %1$tF %1$tT (%2$d days).", data.getDate(), EncodingUtils.getMinutesDiff(new Date(), data.getDate()) / 60 / 24 ));
IRecordingStatus queryIsRecording() throws IOException
IBackend backend = ...; // an already connected backend // query recording status IRecordingStatus recordingStatus = backend.queryIsRecording(); System.out.println(String.format( "MythTV has %d active recordings. %d are Live-TV recordings.", recordingStatus.getActiveRecordings(), recordingStatus.getLiveTVRecordings() ));
IRecordingsPending queryAllPending() throws IOException
queryAllScheduled
to get all scheduled recordings.queryConflicting
to get all conflicting recordings.queryRecordings
to get all finished recordings.queryExpiring
to get all expiring recordings.IBackend backend = ....; // an already connected backend // get all pending recordings IRecordingsPending pendingRecords = backend.queryAllPending(); for (IProgramInfo program : pendingRecords) { // we are only interrested in recordings with "WILL_RECORD" status IProgramRecordingStatus recStatus = program.getRecordingStatus(); if(recStatus != null && !recStatus.hasStatus(Status.WILL_RECORD)) continue; // print out the found recodings System.out.println(String.format( "%1$tF %1$tT - %2$s (%3$s)", program.getStartDateTime(), program.getTitle(), program.getChannelSign() )); }
The above example will output, e.g.
MythTV has 4 pending records 2011-04-17 18:10:00 - Die Simpsons (PRO7) 2011-04-17 20:15:00 - 10.000 BC (PRO7) 2011-04-18 22:15:00 - Roter Drache (ZDF) 2011-04-21 20:15:00 - Dr. House (ORF1)
IRecordingsScheduled queryAllScheduled() throws IOException
queryAllPending
to get all pending recordings.queryConflicting
to get all conflicting recordings.queryRecordings
to get all finished recordings.queryExpiring
to get all expiring recordings.IBackend backend = ....; // an already connected backend // getting all recording schedules IRecordingsScheduled scheduledRecords = backend.queryAllScheduled(); System.out.println(String.format("MythTV has %d recording schedules:", scheduledRecords.size())); System.out.println(String.format( "%-35s | %-4s | %-7s | %-15s | %-22s | %-15s", "Title","Prio","Channel","Recording Group","Type","Storage Group" )); // print all scheduled recordings for (IProgramInfo program : scheduledRecords) { System.out.println(String.format( "%-35s | %4d | %-7s | %-15s | %-22s | %-15s", program.getTitle(), program.getRecordingPriority(), program.getChannelSign(), program.getRecordingGroup(), program.getRecordingType(), program.getStorageGroup() )); }
The above example will output, e.g.
MythTV has 6 recording schedules: Title | Prio | Channel | Recording Group | Type | Storage Group 10.000 BC | 0 | PRO7 | Default | 6=> {FIND_ONE_RECORD} | Default Die Simpsons | 0 | PRO7 | Default | 3=> {CHANNEL_RECORD} | Default Dr. House | 0 | ORF1 | Default | 5=> {WEEKSLOT_RECORD} | Default Fantastic Four: Rise of the Silver | 0 | ORF1 | Default | 6=> {FIND_ONE_RECORD} | Default Geisterhaus (Title Suche) | 0 | PRO7 | Default | 6=> {FIND_ONE_RECORD} | Default Stieg Larsson (Title Suche) | 5 | PRO7 | Default | 4=> {ALL_RECORD} | Default
IRecordingsExpiring queryExpiring() throws IOException
queryAllScheduled
to get all scheduled recordings.queryAllPending
to get all pending recordings.queryConflicting
to get all conflicting recordings.queryRecordings
to get all finished recordings.queryRecordings()
is used and the expiring recordings
are filtered using the program-flag-filter
.
// fetch all expiring recordings IRecordingsExpiring expiringRecords = backend.queryExpiring(); long spaceUsed = 0; // print names of expiring recordings System.out.println("Expiring records:"); for(IProgramInfo program : expiringRecords) { spaceUsed += program.getFileSize().longValue(); System.out.println("- " + program.getFullTitle()); } // print disk space used by expiring recordings System.out.println(String.format( "%s used by %d expiring recordings.", EncodingUtils.getFormattedFileSize(spaceUsed), expiringRecords.size() ));
The above example will output, e.g.
Expiring records: - King of Queens - E-Mail für dich - King of Queens - Wilde Bullen - WALL-E - Der Letzte räumt die Erde auf 9,82 GB used by 3 expiring recordings.
IRecordings.size()
returns 0
,
no expiring programs were found.
IOException
- on communication errorsQUERY_GETEXPIRING
Version | Date | Additional Version Info | |
---|---|---|---|
Fallback | 00 | The function can be can be used with restrictions starting with version 0. | |
Added | 23 | 2006-01-10 | Changelog, SVN-Rev.: 8553 |
Removed | -1 |
IRecordingsConflicting queryConflicting() throws IOException
queryAllScheduled
to get all scheduled recordings.queryAllPending
to get all pending recordings.queryRecordings
to get all finished recordings.queryExpiring
to get all expiring recordings.pending recordings
and use a status-filter
to get all conflicting recordings.
// query all conflicting recordings IRecordingsConflicting conflictingRecordings = backend.queryConflicting(); if(!conflictingRecordings.isEmpty()) { System.out.println(String.format( "%d conflicting records:", conflictingRecordings.size() )); // print all conflicting recordings for(IProgramInfo program : conflictingRecordings) { System.out.println(String.format( "+-- %1$tF %1$tT - %2$s (%3$s)", program.getStartDateTime(), program.getFullTitle(), program.getChannelSign() )); // fetch all recordings the current recording is in conflict with IRecordingsConflicting others = backend.queryConflicting(program); for(IProgramInfo other : others) { System.out.println(String.format( " | %1$tF %1$tT - %2$s (%3$s)", other.getStartDateTime(), other.getFullTitle(), other.getChannelSign() )); } } }
1 conflicting records: +-- 2012-01-10 09:30:00 - Scrubs - Meine Sitcom (PRO7) | 2012-01-10 09:30:00 - Mitten im Leben! (RTL) | 2012-01-10 09:30:00 - Das Traumhotel (ARD)
IRecordings.size()
returns 0
,
no conflicts were found
IOException
- on communication errorsQUERY_GETCONFLICTING
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 00 | ||
Changed | 57 | 2010-05-16 | Changelog, Changelog, SVN-Rev.: 24694, SVN-Rev.: 23636 |
Removed | -1 |
IRecordingsConflicting queryConflicting(IProgramInfo programInfo) throws IOException
queryConflicting
if you need to check all pending recordings for conflicts.
programInfo
- the program to check
IRecordings.size()
returns 0
,
no conflicts were found
IOException
- on communication errorsQUERY_GETCONFLICTING
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 00 | ||
Removed | -1 |
boolean isActiveBackend() throws IOException
This function internally uses queryHostname()
to determine the hostname of the
connected backend and thereafter calls isActiveBackend(String)
with this hostname.
boolean isActiveBackend(String hostname) throws IOException
This function can be used on master backends to checks the activation status of
slave backends, which has been connected to the master using ANN SlaveBackend
.
IBackend backend = ...; // an already connected backend // the hostname of a backend to check String slaveBackendName = "mythbox2"; // checking the is-active status boolean isActiveBackend = backend.isActiveBackend(slaveBackendName); System.out.println(String.format( "The backend '%s' is currently ", slaveBackendName, (isActiveBackend?"active":"idle") ));
hostname
- the hostname of the backend. This must be the hostname of the mythtv box,
using the IP-address seems not to work
true
if the given backend is active.
IOException
- on communication errorsQUERY_IS_ACTIVE_BACKEND
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 00 | ||
Removed | -1 |
List<String> queryActiveBackends() throws IOException
This function returns the names of all currently active backends.
boolean refreshBackend() throws IOException
IFileStatus queryFileExists(IProgramInfo programInfo) throws IOException
queryCheckFile
is used instead.
programInfo
- the program for which the file should be searched
null
IOException
- on communication errorsqueryFileExists(String, String)
,
QUERY_FILE_EXISTS
Version | Date | Additional Version Info | |
---|---|---|---|
Fallback | 00 | The function can be can be used with restrictions starting with version 0. | |
Added | 49 | 2009-10-01 | Changelog, SVN-Rev.: 22164 |
Removed | -1 |
FileStatus queryFileExists(URI fileUrl) throws IOException
This method calls URI.getUserInfo()
and URI.getPath()
to determine the storage-group and file-name
and calls queryFileExists(String, String)
afterwards.
fileUrl
- the remote file
null
IOException
- on communication errorsQUERY_FILE_EXISTS
,
queryFileExists(String, String)
Version | Date | Additional Version Info | |
---|---|---|---|
Fallback | 00 | The function can be can be used with restrictions starting with version 0. | |
Added | 49 | 2009-10-01 | Changelog, SVN-Rev.: 22164 |
Removed | -1 |
IFileStatus queryFileExists(String fileName, String storageGroup) throws IOException
IFileTransfer.isOpen()
is used to determine the file exists status.
IBackend backend = ....; // an already connected backend IProgramInfo program = ....; // a previously recorded program // query if the preview image exists String previewImageName = program.getPreviewImageName(); IFileStatus fileStatus = backend.queryFileExists(previewImageName,"Default"); if (fileStatus.fileExists()) { System.out.println("Preview image found: " + fileStatus.getFilePath()); } else { System.out.println("Preview image not found."); }
fileName
- the remote file namestorageGroup
- the storage group name, or null
to search in the default group
null
IOException
- on communication errorsQUERY_FILE_EXISTS
Version | Date | Additional Version Info | |
---|---|---|---|
Fallback | 00 | The function can be can be used with restrictions starting with version 0. | |
Added | 49 | 2009-10-01 | Changelog, SVN-Rev.: 22164 |
Removed | -1 |
IFileStatus queryCheckFile(IProgramInfo programInfo, Boolean checkSlaves) throws IOException
queryFileExists
to check the existance of a non recording file,
e.g. a preview-image or a channel-logo.
IBackend backend = ....; // an already connected backend IProgramInfo recording = ....; // a previously recorded program // check if the file exists IFileStatus fileStatus = backend.queryCheckFile(recording); if(fileStatus.fileExists()) { System.out.println("Recording file found."); } else { System.out.println("Recording file not found."); }
programInfo
- the given programcheckSlaves
- specifies if all slaves should be checked too. (Since 32)
null
IOException
- on communication errorsQUERY_CHECKFILE
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 00 | ||
Changed | 32 | 2006-11-30 | Changelog, SVN-Rev.: 12151 |
Removed | -1 |
String queryFileHash(IProgramInfo programInfo) throws IOException
programInfo
- the program referencing a file, for which the file hash should be generated.
75aa72141cd08662
IOException
- on communication errorsqueryFileHash(String, String, String)
,
QUERY_FILE_HASH
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 51 | 2009-11-23 | Changelog, SVN-Rev.: 22892 |
Removed | -1 |
String queryFileHash(URI fileUrl) throws IOException
This method calls URI.getUserInfo()
, URI.getHost()
and URI.getPath()
to determine the storage-group, host-name and file-name
and calls queryFileHash(String, String, String)
afterwards.
OpenSubtitlesHasher
could be used.
String queryFileHash(String fileName, String storageGroup) throws IOException
OpenSubtitlesHasher
could be used.
fileName
- the remote file namestorageGroup
- the storage group name, or null
if the default group should be used
75aa72141cd08662
IOException
- on communication errorsQUERY_FILE_HASH
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 51 | 2009-11-23 | Changelog, SVN-Rev.: 22892 |
Removed | -1 |
String queryFileHash(String fileName, String storageGroup, String hostName) throws IOException
OpenSubtitlesHasher
could be used.
fileName
- the remote file namestorageGroup
- the storage group name, or null
if the default group should be usedhostName
- the name of the backend, storing the file. (since 69).
If this is null
the current backend will be queried.
75aa72141cd08662
IOException
- on communication errorsQUERY_FILE_HASH
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 51 | 2009-11-23 | Changelog, SVN-Rev.: 22892 |
Changed | 69 | 2011-07-11 | Changelog |
Removed | -1 |
IStorageGroupFile queryStorageGroupFile(String hostName, String storageGroup, String fileName) throws IOException
queryFileExists(String, String)
is used to determine the proper absolute path.
IBackend backend = ...; // an already connected backend IProgramInfo program = ...; // a previously recorded program // getting all required parameters String hostName = program.getHostName(); String storageGroup = program.getStorageGroup(); String previewFileName = program.getPreviewImageName(); // query infos about the recording preview image IStorageGroupFile previewFile = backend.queryStorageGroupFile(hostName,storageGroup,previewFileName); if(previewFile != null) { System.out.println(String.format( "Preview image path: '%s', last-modified date: '%tF', file-size: '%d'.", previewFile.getFilePath(), previewFile.getLastModified(), previewFile.getSize() )); } else { System.err.println("Preview image not found"); }
hostName
- the backend host to query. if null
the result of queryHostname()
is used to determine the hostname.storageGroup
- the storage group name. If null
Default
is used.fileName
- the file name to search for. Till 58 this path must be an absolute path.
null
IOException
- on communication errorsQUERY_SG_FILEQUERY
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 44 | 2009-02-12 | Changelog, SVN-Rev.: 19978 |
Changed | 58 | 2010-07-17 | Changelog, Changelog, Changelog, SVN-Rev.: 25362, SVN-Rev.: 25229 |
Removed | -1 |
IStorageGroupFileList queryStorageGroupFileList(String hostName, String storageGroup, String path) throws IOException
IBackend backend = ....; // an already connected backend // query all files stored in the storage-group "Default" String hostName = backend.queryHostname(); IStorageGroupFileList fileList = backend.queryStorageGroupFileList(hostName, "Default", "/", true); if(fileList != null) { // loop through all found files for(IStorageGroupFile file : fileList) { // fetch the program info for all found recordings final String fileName = file.getFilePath(); // e.g. 1064_20110403184000.mpg if(fileName.matches("\\d+_\\d+\\.mpg")) { // fetch the program info for the recording file IProgramInfo program = backend.queryRecording(fileName); if(program != null) { System.out.println(program); } } } }
hostName
- the backend host to query.
If this is null
queryHostname()
is used to determine the hostname.storageGroup
- the storage group name. If this is null
Default
is used.path
- the path to query
null
IOException
- on communication errorsVersion | Date | Additional Version Info | |
---|---|---|---|
Added | 44 | 2009-02-12 | Changelog, SVN-Rev.: 19978 |
Removed | -1 |
IStorageGroupFileList queryStorageGroupFileList(String hostName, String storageGroup, String path, boolean fileNamesOnly) throws IOException
hostName
- the backend host to query.
If this is null
queryHostname()
is used to determine the hostname.storageGroup
- the storage group name. If this is null
Default
is used.path
- the path to queryfileNamesOnly
- if only the file names should be returned. (since 49)
null
IOException
- on communication errorsVersion | Date | Additional Version Info | |
---|---|---|---|
Added | 44 | 2009-02-12 | Changelog, SVN-Rev.: 19978 |
Changed | 49 | 2009-10-01 | Changelog, SVN-Rev.: 22164 |
Removed | -1 |
ITimezone queryTimeZone() throws IOException
boolean goToSleep() throws IOException
String queryHostname() throws IOException
getHostName()
is returned.
IBackend backend = ...; // an already connected backend // query the backends host name String backendHostName = backend.queryHostname(); System.out.println("We are connected to backend: " + backendHostName);
IOException
- on communication errorsQUERY_HOSTNAME
Version | Date | Additional Version Info | |
---|---|---|---|
Fallback | 00 | The function can be can be used with restrictions starting with version 0. | |
Added | 50 | 2009-10-02 | Changelog, MythTV-Release: 0.22, SVN-Rev.: 22170 |
Removed | -1 |
Boolean blockShutdown() throws IOException
This function prevents a backend from shutting down until a the next call of allowShutdown()
.
Boolean allowShutdown() throws IOException
This function allows a backend to shut down again after a previous call of blockShutdown()
.
void shutdownNow() throws IOException
ISetting querySetting(String hostName, String settingName) throws IOException
The backend will look in the MySQL database table 'settings', and attempt to return the value for the given setting. It seems only settings with the hostname set can be retrieved by this call.
setSetting
to change backend settings.
hostName
- the name of the host, the setting belongs to. This can not be null
.settingName
- the name of the setting to query
null
if the setting was not found.
IOException
- on communication errorsVersion | Date | Additional Version Info | |
---|---|---|---|
Added | 17 | 2005-05-24 | Changelog, SVN-Rev.: 6482 |
Removed | -1 |
boolean setSetting(String hostName, String settingName, String settingValue) throws IOException
querySetting
to read backend settings.clearSettingsCache
to notify the backend about changed settings.
hostName
- the name of the host, the setting belongs tosettingName
- the name of the setting to changesettingValue
- the new setting value
true
if the setting-value was changed successfully.
IOException
- on communication errorsSET_SETTING
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 17 | 2005-05-24 | Changelog, SVN-Rev.: 6482 |
Removed | -1 |
void clearSettingsCache() throws IOException
This command should be used after changing any backend settings and forces the backend to reload settings from the database (for example, using MythWeb or Mythtv-setup).
setSetting
to change backend settings.querySetting
to read backend settings.
ITunerInfo lockTuner() throws IOException
ATTENTION: This only works if your frontend is on the same machine as one of the available tuners.
freeTuner
to unlock a tuner.
ITunerInfo lockTuner(Integer recorderID) throws IOException
ATTENTION: This only works if your frontend is on the same machine as the tuner you are trying to lock.
freeTuner
to unlock a tuner.
boolean freeTuner(Integer recorderID) throws IOException
lockTuner
to lock a tuner.
IProgramInfo fillProgramInfo(IProgramInfo programInfo) throws IOException
programInfo
- the recording, whose information should be updated.
IOException
- on communication errorsFILL_PROGRAM_INFO
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 00 | ||
Removed | -1 |
IProgramInfo fillProgramInfo(IProgramInfo programInfo, String playBackHostname) throws IOException
Calling this function converts the path
property from
e.g. /var/lib/mythtv/livetv/1004_20120113085933.mpg
to myth://192.168.10.207:6543/1004_20120113085933.mpg
and additionally updates the file size
.
programInfo
- the recording, whose information should be updated.playBackHostname
- the name of the playback host
IOException
- on communication errorsFILL_PROGRAM_INFO
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 00 | ||
Removed | -1 |
Integer checkRecording(IProgramInfo programInfo) throws IOException
This function return the number of the recorder or null
, if the program is not being recorded.
IProgramInfo.getHostName()
,
this function uses QUERY_REMOTEENCODER_MATCHES_RECORDING
to determine the recorder that is recording this program.
IBackend backend = ...; // an already connected backend // get all currently running recordings IProgramInfoList recordings = backend.queryRecordings(ERecordingsType.Recording); for(IProgramInfo recording : recordings) { // getting the ID of the recorder recording the program Integer recorderId = backend.checkRecording(recording); System.out.println(String.format( "Recording '%s' (%s) is currently recorded by recorder-ID: %d", recording.getTitle(),recording.getChannelSign(), recorderId )); }
Integer stopRecording(IProgramInfo programInfo) throws IOException
IBackend backend = ...; // an already connected backend // get all currently running recordings IProgramInfoList recordings = backend.queryRecordings(ERecordingsType.Recording); for(IProgramInfo recording : recordings) { // search for a recording called "Wetter-Panorama" if(recording.getTitle().equals("Wetter-Panorama")) { // stop the recording Integer recorderId = backend.stopRecording(recording); System.out.println(String.format( "Recording of program '%s' (%s) stopped on recorder %d.", recording.getTitle(), recording.getChannelSign(), recorderId )); } }
programInfo
- the recording to be stopped.
-1
if the recording is not found.
IOException
- on communication errors.STOP_RECORDING
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 00 | ||
Changed | 19 | 2005-10-09 | Changelog, SVN-Rev.: 7427 |
Removed | -1 |
IRecorderInfo getRecorderForProgram(IProgramInfo programInfo) throws IOException
null
, if it is not being recorded.
This method combines checkRecording(IProgramInfo)
and getRecorderForNum(int)
.
IBackend backend = ...; // an already connected backend // get all currently running recordings IProgramInfoList recordings = backend.queryRecordings(ERecordingsType.Recording); for(IProgramInfo recording : recordings) { // determine the used recorder IRecorderInfo recorder = backend.getRecorderForProgram(recording); System.out.println(String.format( "Recording '%s' (%s) is currently recorded by: %s", recording.getTitle(),recording.getChannelSign(), recorder.toString() )); }
IProgramInfo queryRecording(String baseName) throws IOException
queryRecording(Integer, Date)
to query a recording by channel id and rec-start-time.
baseName
- the base-name of the recorded program-file, e.g. 1057_20100811133747.mpg
.
null
if no matching recording was found
IOException
- on communication errorsQUERY_RECORDING
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 32 | 2006-11-30 | Changelog, SVN-Rev.: 12151 |
Removed | -1 |
IProgramInfo queryRecording(IBasicChannelInfo channel, Date recordingStartTime) throws IOException
This function internally uses IBasicChannelInfo.getChannelID()
to get the channel-id of the recording
and calls queryRecording(Integer, Date)
afterwards.
queryRecording(String)
to query a recording by base name.
channel
- the channel of the recordingrecordingStartTime
- the recording starting-time, e.g. 2010-08-11T13:37:47
.
null
if no matching recording was found
IOException
- on communication errorsqueryRecording(Integer, Date)
,
QUERY_RECORDING
Version | Date | Additional Version Info | |
---|---|---|---|
Fallback | 00 | The function can be can be used with restrictions starting with version 0. | |
Added | 32 | 2006-11-30 | Changelog, SVN-Rev.: 12151 |
Removed | -1 |
IProgramInfo queryRecording(Integer channelID, Date recordingStartTime) throws IOException
queryRecording(String)
to query a recording by base name.
queryRecordings()
is called to fetch all recordings,
and a program-filter
is used afterwards to determine the desired recording.
channelID
- the channel-ID, e.g. 1057
recordingStartTime
- the recording starting-time, e.g. 2010-08-11T13:37:47
null
if no matching recording was found
IOException
- on communication errorsqueryRecording(IBasicChannelInfo, Date)
,
QUERY_RECORDING
Version | Date | Additional Version Info | |
---|---|---|---|
Fallback | 00 | The function can be can be used with restrictions starting with version 0. | |
Added | 32 | 2006-11-30 | Changelog, SVN-Rev.: 12151 |
Removed | -1 |
<C extends IBasicChannelInfo> List<C> getBasicChannelInfos() throws IOException
28
an IBasicChannelInfo
object is returned, otherwise an IRecorderChannelInfo
object is returned.
C
- the return type. is is either a IBasicChannelInfo
or an IRecorderChannelInfo
IOException
- on communication errorsgetChannelInfos()
,
getRecorders()
,
IRecorder.getBasicChannelInfos()
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 00 | ||
Removed | -1 |
List<IRecorderChannelInfo> getChannelInfos() throws IOException
This method internally uses getRecorders()
to get a list of all known recorders and
calls IRecorder.getChannelInfos()
for all recorders.
IRecorder.getChannelInfo
to get the info for a single channelsetChannelInfo
to change the info for a single channel.IBackend backend = ...; // an already connected backend List<IRecorderChannelInfo> channels = backend.getChannelInfos(); for(IRecorderChannelInfo channel : channels) { System.out.println(String.format( "%2s | %-15s | %s", channel.getChannelNumber(), channel.getChannelSign(), channel.getChannelName() )); }
The above example will output, e.g.
1 | PRO7 | Pro7 2 | SAT.1 | SAT.1 3 | RTL | RTL 4 | RTL2 | RTL 2 5 | ARD | ARD 6 | ZDF | ZDF 7 | KABE1 | Kabel 1 ...
boolean setChannelInfo(String oldChannelNumber, IRecorderChannelInfo channelInfo) throws IOException
getChannelInfos
to get infos about all known channels.IRecorder.getChannelInfo
to get the info for a single channel
oldChannelNumber
- the old channel numberchannelInfo
- the new channel info
true
if channel data was changed successfully.
IOException
- on communication errorsSET_CHANNEL_INFO
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 28 | 2006-03-28 | Changelog, SVN-Rev.: 9524 |
Removed | -1 |
List<IRecorderNextProgramInfo> getNextProgramInfos(Date date) throws IOException
This method internally uses getRecorders()
to get a list of all known recorders and
calls IRecorder.getNextProgramInfos(Date)
for all recorders.
IBackend backend = ...; // an already connected backend Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY,20); cal.set(Calendar.MINUTE,15); // fetch the programs of all channels today at 8:15 PM List<IRecorderNextProgramInfo> nextPrograms = backend.getNextProgramInfos(cal.getTime()); for(IRecorderNextProgramInfo nextProgram : nextPrograms) { if(!nextProgram.isValid()) continue; // if there is no valid program info for a channel System.out.println(String.format( "%tT | %tT | %-15s | %s", nextProgram.getStartDateTime(), nextProgram.getEndDateTime(), nextProgram.getChannelSign(), nextProgram.getTitle() )); }
The above example will output, e.g.
20:15:01 | 23:05:01 | RTL | Harry Potter und der Stein der Weisen 20:15:01 | 21:15:01 | SAT.1 | Navy CIS 20:15:01 | 21:45:01 | ARD | Tatort 20:15:01 | 21:45:01 | ZDF | Rosamunde Pilcher: Englischer Wein 20:15:01 | 21:45:01 | SWBW | SonntagAbend 19:45:01 | 21:15:01 | BR3 | Kreuzwege 18:25:00 | 20:15:00 | PULS4 | American Pie Presents Band Camp 20:15:01 | 22:20:01 | PRO7 | Wall-E - Der Letzte räumt die Erde auf 20:15:01 | 22:55:01 | ATV+ | The Missing 20:15:01 | 22:10:01 | RTL2 | Ungeklärte Morde - Dem Täter auf der Spur 20:15:01 | 22:45:01 | ARTE | Fitzcarraldo 20:15:01 | 21:00:01 | 3SAT | Neues aus der Anstalt 20:15:01 | 21:50:01 | ORF2 | Tatort 20:15:01 | 21:40:01 | ORF1 | WALL-E - Der Letzte räumt die Erde auf 20:15:01 | 22:45:01 | VOX | Das perfekte Promi Dinner 20:15:01 | 21:15:01 | SUPRT | Abgefahren - Der lange Weg zum Führerschein 20:15:01 | 20:45:01 | KABE1 | Two and a Half Men
Map<String,String> getChannelLogoMap(IRecorderNextProgramInfo.Props keyProp) throws IOException
This method interally uses getNextProgramInfos(Date)
to determine the path to
all channel logos.
keyProp
- the property of the program-info object that should be used as key for the map.IRecorderNextProgramInfo.Props#CHANNEL_ID
is used.
IOException
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 00 | ||
Removed | -1 |
boolean scanVideos() throws IOException
URI downloadFile(URI url, String storageGroup, String fileName) throws IOException
The file is downloaded asynchronously. The backend sends IDownloadFileUpdate
and IDownloadFileFinished
-events
to inform the client about the downloading status.
// allow the client to receive events backend.annotateMonitor("mythClient",EPlaybackSockEventsMode.NORMAL); Semaphore downloadFinished = new Semaphore(0); // register as event listeners backend.addEventListener(IDownloadFileUpdate.class,new IMythEventListener<IDownloadFileUpdate>() { public void fireEvent(IDownloadFileUpdate event) { System.out.println(String.format( "%s of %s (%f%%) downloaded from '%s'.", EncodingUtils.getFormattedFileSize(event.getBytesReceived()), EncodingUtils.getFormattedFileSize(event.getBytesTotal()), event.getReceivedPercent(), event.getRemoteURI() )); } }); backend.addEventListener(IDownloadFileFinished.class,new IMythEventListener<IDownloadFileFinished>() { public void fireEvent(IDownloadFileFinished event) { System.out.println(String.format( "Download of '%s' (%s) finished", event.getRemoteURI(), EncodingUtils.getFormattedFileSize(event.getBytesTotal()) )); // signal that the download has finished downloadFinished.release(); } }); // force the backend to download the file URI remoteFileUri = URI.create("http://upload.wikimedia.org/wikipedia/de/7/7c/ORF-Logo.svg"); String localFileName = "ORF-Logo.svg"; URI localFileUri = backend.downloadFile( remoteFileUri, null, localFileName ); // waiting for the download to finish downloadFinished.acquire(); // transfer the file to the client IFileTransfer transfer = backend.annotateFileTransfer(localFileUri); File localFile = new File(localFileName); transfer.transferTo(localFile); transfer.close();
url
- the remote resource to downloadstorageGroup
- the storage group the remote resource should be stored intofileName
- the name of the file to store the remote file into
IOException
- on communication errorsDOWNLOAD_FILE
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 58 | 2010-07-17 | Changelog, Changelog, Changelog, SVN-Rev.: 25362, SVN-Rev.: 25229 |
Removed | -1 |
URI downloadFileNow(URI url, String storageGroup, String fileName) throws IOException
The remote file is downloaded synchronously by the backend.
backend.annotateMonitor(); // force the backend to download the file URI remoteFileUri = URI.create("http://upload.wikimedia.org/wikipedia/de/7/7c/ORF-Logo.svg"); String localFileName = "ORF-Logo.svg"; URI localFileUri = backend.downloadFileNow( remoteFileUri, null, localFileName ); // transfer the file to the client IFileTransfer transfer = backend.annotateFileTransfer(localFileUri); File localFile = new File(localFileName); transfer.transferTo(localFile); transfer.close();
url
- the remote resource to downloadstorageGroup
- the storage group the remote resource should be stored intofileName
- the name of the file to store the remote file into
IOException
- on communication errorsDOWNLOAD_FILE_NOW
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 58 | 2010-07-17 | Changelog, Changelog, Changelog, SVN-Rev.: 25362, SVN-Rev.: 25229 |
Removed | -1 |
boolean deleteFile(URI fileUrl) throws IOException
This method calls URI.getUserInfo()
and URI.getPath()
to determine the storage-group and file-name
and calls deleteFile(String, String)
afterwards.
deleteRecording(IProgramInfo)
if a recording should be deleted.
fileUrl
- the url to the remote file
true
if the file was deleted successfully, or false
otherwise
IOException
- on communication errorsDELETE_FILE
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 46 | 2009-08-08 | Changelog, SVN-Rev.: 21158 |
Removed | -1 |
boolean deleteFile(String fileName, String storageGroup) throws IOException
deleteRecording
if a recording should be deleted.
fileName
- the name of the remote filestorageGroup
- the storage-group the remote file is stored in.
true
if the file was deleted successfully, or false
otherwise
IOException
- on communication errorsDELETE_FILE
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 46 | 2009-08-08 | Changelog, SVN-Rev.: 21158 |
Removed | -1 |
Long queryBookmark(IProgramInfo program) throws IOException
This function uses IProgramInfo.getChannelID()
and IProgramInfo.getRecordingStartTime()
to determine
the channel-id and recording-start-time and calls queryBookmark(Integer, Date)
afterwards.
setBookmark
to set the bookmark of a recording.
// getting a list of recordings IProgramInfoList recordings = backend.queryRecordings(); // print the bookmark position for all recordings with bookmarks System.out.println("Rercordings with bookmarks: "); for(IProgramInfo recording : recordings) { // determine if the recording has a bookmark set boolean hasBookmark = recording.getProgramFlags().isSet(Flags.FL_BOOKMARK); if(hasBookmark) { // query the bookmark position Long bookmark = backend.queryBookmark(recording); System.out.println(String.format( "- %s (bookmark: frame %d)", recording.getFullTitle(), bookmark )); } }
Long queryBookmark(Integer channelID, Date recordingStartTime) throws IOException
setBookmark
to set the bookmark of a recording.
channelID
- the channel-ID of the recordingrecordingStartTime
- the recording-start-time of the recording
IOException
- on communication errorsQUERY_BOOKMARK
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 17 | 2005-05-24 | Changelog, SVN-Rev.: 6482 |
Removed | -1 |
boolean setBookmark(IProgramInfo recording, Long bookmarkPosition) throws IOException
This function uses IProgramInfo.getChannelID()
and IProgramInfo.getRecordingStartTime()
to determine
the channel-id and recording-start-time of the recording and calls setBookmark(Integer, Date, Long)
afterwards.
queryBookmark
to get the bookmark of a recording.
recording
- the recording for which the bookmark should be setbookmarkPosition
- the bookmark position in frames
true
if the bookmark was set or false
otherwise
IOException
- on communication errorsSET_BOOKMARK
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 17 | 2005-05-24 | Changelog, SVN-Rev.: 6482 |
Removed | -1 |
boolean setBookmark(Integer channelID, Date recordingStartTime, Long bookmarkPosition) throws IOException
queryBookmark
to get the bookmark of a recording.
channelID
- the channel ID of the recordingrecordingStartTime
- the recording-start-timebookmarkPosition
- the bookmark position in frames
true
if the bookmark was set or false
otherwise
IOException
- on communication errorsSET_BOOKMARK
Version | Date | Additional Version Info | |
---|---|---|---|
Added | 17 | 2005-05-24 | Changelog, SVN-Rev.: 6482 |
Removed | -1 |
boolean queueTranscode(IProgramInfo recording) throws IOException
queueTranscodeStop
to stop transcoding of a recording.
boolean queueTranscodeCutlist(IProgramInfo recording) throws IOException
queueTranscodeStop
to stop transcoding of a recording.
boolean queueTranscodeStop(IProgramInfo recording) throws IOException
queueTranscode
to start transcoding of a recording.queueTranscodeCutlist
to start transcoding and cutlist processing of a recording.
void addEventPacketListener(IMythEventPacketListener listener)
listener
- the event listenervoid removeEventPacketListener(IMythEventPacketListener listener)
listener
- the event listener<Event extends IMythEvent<?>> void addEventListener(Class<Event> eventClass, IMythEventListener<Event> listener)
<Event extends IMythEvent<?>> void removeEventListener(Class<Event> eventClass, IMythEventListener<Event> listener)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |