|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jmythapi.protocol.impl.Backend
public class Backend
Field Summary | |
---|---|
boolean |
debugging
|
protected ProtocolVersion |
protoVersion
The MythTV-protocol version used to communicate with the backend |
Constructor Summary | |
---|---|
Backend(IBackendConnection backendConnection)
Constructs the backend object from an existing backend connection. |
|
Backend(String hostname)
|
|
Backend(String hostname,
int hostPort)
|
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. |
|
FileTransfer |
annotateFileTransfer(IProgramInfo programInfo,
Boolean useReadAhead,
Integer retries,
Integer timeoutMs)
Announce a new file-transfer connection to the backend. |
|
FileTransfer |
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 clientName)
Announces a new monitor connection to the backend. |
|
boolean |
annotateMonitor(String clientName,
EPlaybackSockEventsMode eventsMode)
Announces a new monitor connection to the backend. |
|
boolean |
annotatePlayback()
Announce a new playback connection to the backend. |
|
boolean |
annotatePlayback(String clientName)
Announce a new playback connection to the backend. |
|
boolean |
annotatePlayback(String clientName,
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 |
close()
|
|
void |
connect()
Establishes a new connection to the backend. |
|
void |
connect(Integer connectionTimeout)
|
|
protected IBackendConnection |
createCommandConnection(String hostname,
int hostPort)
|
|
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. |
|
void |
fireEvent(IMythPacket eventPacket)
|
|
boolean |
forceDeleteRecording(IProgramInfo programInfo)
Deletes a recording-file and recording metadata. |
|
boolean |
forceDeleteRecording(List<String> programInfo)
|
|
boolean |
forgetRecording(IProgramInfo programInfo)
Delets recording history. |
|
boolean |
forgetRecording(List<String> programInfo)
|
|
boolean |
freeTuner(Integer recorderID)
Frees a previously locked tuner. |
|
|
getBasicChannelInfoMap()
|
|
|
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. |
|
Recorder |
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. |
|
IRecorderInfo |
getRecorderNum(List<String> programInfo)
|
|
List<IRecorderInfo> |
getRecorders()
A function to get all available recorders, independently of their busy status. |
|
ProtocolVersion |
getVersionNr()
Gets the protocol-version of an object. |
|
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. |
|
static void |
main(String[] args)
|
|
List<String> |
queryActiveBackends()
Queries the names of all active backends. |
|
RecordingsPending |
queryAllPending()
Gets all programs that will be recorded soon. |
|
RecordingsScheduled |
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. |
|
FileStatus |
queryCheckFile(IProgramInfo programInfo,
Boolean checkSlaves)
Checks if a recording file exists that belongs to the given program. |
|
RecordingsConflicting |
queryConflicting()
Gets all programs that are in conflict which each other. |
|
RecordingsConflicting |
queryConflicting(IProgramInfo programInfo)
Gets all programs that are in conflict with the given program. |
|
RecordingsExpiring |
queryExpiring()
Gets all programs that will expiring soon. |
|
FileStatus |
queryFileExists(IProgramInfo programInfo)
Checks if a recording-file exists for the given program. |
|
FileStatus |
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. |
|
FreeSpace |
queryFreeSpace()
Deprecated. 17 |
|
FreeSpaceList |
queryFreeSpaceList(boolean allhosts)
Returns the free disk space on the connected or on all MythTV backends. |
|
FreeSpaceSummary |
queryFreeSpaceSummary()
Returns the free space on the connected backend. |
|
boolean |
queryGenPixmap(IProgramInfo program)
Generates a preview image of the requested show. |
|
boolean |
queryGenPixmap(IProgramInfo program,
Boolean inSeconds,
Long time,
String fileName,
Integer width,
Integer height)
Generates a preview image of the requested show. |
|
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. |
|
GuideDataThrough |
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 previewImageName,
String storageGroup)
Queries a preview image. |
|
IPixmap |
queryPixmapIfModified(IProgramInfo program,
Date lastModifiedDate,
Long maxFileSize)
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 startTime)
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. |
|
ProgramInfo |
queryRecording(String baseName)
TODO: fallback using a program filter!!!! |
|
IProgramInfoList |
queryRecordings()
Queries for all available recordings. |
|
IProgramInfoList |
queryRecordings(ERecordingsType eRecordingsType)
TODO: sorting for versions >= 65 |
|
Setting |
querySetting(String hostName,
String settingName)
Queries the remote host for a specific setting. |
|
StorageGroupFile |
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. |
|
StorageGroupFileList |
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. |
|
boolean |
queryTranscode(IProgramInfo programInfo)
|
|
IUptime |
queryUptime()
Queries the uptime of the backend. |
|
boolean |
queueTranscode(IProgramInfo recording)
Enqueues the recording for transcoding. |
|
boolean |
queueTranscodeCutlist(IProgramInfo recording)
Enqueues the recording for transcoding and cutlist processing. |
|
boolean |
queueTranscodeStop(IProgramInfo recording)
Stops transcoding of a recording Usage Hint: Use queueTranscode to start transcoding of a recording. |
|
boolean |
reactivateRecording(IProgramInfo programInfo)
Reactivates a inactive recording. |
|
boolean |
reactivateRecording(List<String> programInfo)
|
|
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 recordID)
Force MythTV to reschedule the given recording. |
|
Boolean |
rescheduleRecordingsAndWait(Integer recordID,
long timeout,
TimeUnit unit)
Forces MythTV to reschedule a given recording and waits for an SCHEDULE_CHANGE event. |
|
boolean |
rescheduleRecordingsMatch(Integer recordID,
Integer sourceID,
Integer multiplexID,
Date maxStartTime,
String reason)
|
|
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. |
|
String |
toString()
|
|
boolean |
undeleteRecording(IProgramInfo programInfo)
Undelets a recording-file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public boolean debugging
protected ProtocolVersion protoVersion
Constructor Detail |
---|
public Backend(String hostname)
hostname
- the MythTV-backend hostname to connect topublic Backend(String hostname, int hostPort)
hostname
- the MythTV-backend hostname to connect tohostPort
- the MythTV-backend port to connect topublic Backend(IBackendConnection backendConnection)
backendConnection
- the existing backend connectionMethod Detail |
---|
public IBackendConnection getCommandConnection()
IBackend
getCommandConnection
in interface IBackend
BackendConnection
used by this backend, or null
if
connect()
was not called so far.protected IBackendConnection createCommandConnection(String hostname, int hostPort)
public String getHostName()
IBackend
getHostName
in interface IBackend
public int getHostPort()
IBackend
getHostPort
in interface IBackend
public ProtocolVersion getVersionNr()
IVersionable
getVersionNr
in interface IVersionable
getVersionNr
in interface IBackend
public void setInitialVersionNr(ProtocolVersion protoVersion)
IBackend
setInitialVersionNr
in interface IBackend
protoVersion
- the initial protocol versionpublic boolean isConnected()
IBackend
isConnected
in interface IBackend
true
if a connection was established.public void connect() throws IOException
IBackend
Once the connection is established, the protocol-version is negotiated.
connect
in interface IBackend
IOException
- on communication errorspublic void connect(Integer connectionTimeout) throws IOException
connect
in interface IBackend
IOException
public void disconnect()
IBackend
disconnect
in interface IBackend
public void close() throws IOException
close
in interface Closeable
IOException
public void addEventPacketListener(IMythEventPacketListener listener)
IBackend
addEventPacketListener
in interface IBackend
listener
- the event listenerpublic void removeEventPacketListener(IMythEventPacketListener listener)
IBackend
removeEventPacketListener
in interface IBackend
listener
- the event listenerpublic <Event extends IMythEvent<?>> void addEventListener(Class<Event> eventClass, IMythEventListener<Event> listener)
addEventListener
in interface IBackend
public <Event extends IMythEvent<?>> void removeEventListener(Class<Event> eventClass, IMythEventListener<Event> listener)
removeEventListener
in interface IBackend
public void fireEvent(IMythPacket eventPacket)
fireEvent
in interface IMythEventPacketListener
public boolean annotatePlayback() throws IOException
IBackend
This signals that backend that a new client will start playback and prevents it from shutting down the socket.
annotatePlayback
in interface IBackend
true
if the backend respond with OK
IOException
- on communication errorsANN_PLAYBACK
public boolean annotatePlayback(String clientName) throws IOException
IBackend
This signals that backend that a new client will start playback and prevents it from shutting down the socket.
annotatePlayback
in interface IBackend
clientName
- the name of the client
true
if the backend respond with OK
IOException
- on communication errorsANN_PLAYBACK
public boolean annotatePlayback(String clientName, EPlaybackSockEventsMode eventsMode) throws IOException
IBackend
This signals that backend that a new client will start playback and prevents it from shutting down the socket.
annotatePlayback
in interface IBackend
clientName
- 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
public boolean annotateMonitor() throws IOException
IBackend
This signals that backend that a new client will start querying the backend but does not prevents it from shutting down the socket.
annotateMonitor
in interface IBackend
true
if the backend respond with OK
IOException
- on communication errorsANN_MONITOR
public boolean annotateMonitor(String clientName) throws IOException
IBackend
This signals that backend that a new client will start querying the backend but does not prevents it from shutting down the socket.
annotateMonitor
in interface IBackend
clientName
- the host name of the client
true
if the backend respond with OK
IOException
- on communication errorsANN_MONITOR
public boolean annotateMonitor(String clientName, EPlaybackSockEventsMode eventsMode) throws IOException
IBackend
This signals that backend that a new client will start querying the backend but does not prevents it from shutting down the socket.
annotateMonitor
in interface IBackend
clientName
- 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
public IFileTransfer annotateFileTransfer(IProgramInfo programInfo) throws IOException
IBackend
// 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();
annotateFileTransfer
in interface IBackend
programInfo
- the program, whose file should be transfered
IOException
- on communication errorsIBackend.annotateFileTransfer(String, Boolean, Integer, Integer, String)
,
ANN_FILE_TRANSFER
public FileTransfer annotateFileTransfer(IProgramInfo programInfo, Boolean useReadAhead, Integer retries, Integer timeoutMs) throws IOException
IBackend
It reads the file-name and storage-group from the given program-info object and calls
IBackend.annotateFileTransfer(String, Boolean, Integer, Integer, String)
.
annotateFileTransfer
in interface IBackend
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 errorsIBackend.annotateFileTransfer(String, Boolean, Integer, Integer, String)
,
ANN_FILE_TRANSFER
public FileTransfer annotateFileTransfer(URI fileUrl) throws IOException
IBackend
This method calls URI.getUserInfo()
and URI.getPath()
to determine the storage-group and file name
and calls IBackend.annotateFileTransfer(String, Boolean, Integer, Integer, String)
afterwards.
annotateFileTransfer
in interface IBackend
fileUrl
- the URI to the file to transfer
IOException
- on communication errorsANN_FILE_TRANSFER
public FileTransfer annotateFileTransfer(String fileName, String storageGroup) throws IOException
IBackend
This method internally calls IBackend.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();
annotateFileTransfer
in interface IBackend
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
public FileTransfer annotateFileTransfer(String fileName, Boolean useReadAhead, Integer retries, Integer timeoutMs, String storageGroup) throws IOException
IBackend
This command must be sent as first command after calling IBackend.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();
annotateFileTransfer
in interface IBackend
fileName
- the name of the file to be transfereduseReadAhead
- 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)storageGroup
- the name of the storage-group the file is located in (since 44)
IOException
- on communication errorsANN_FILE_TRANSFER
public Recorder getRecorder(IRecorderInfo recorderInfo) throws IOException
IBackend
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"); }
getRecorder
in interface IBackend
recorderInfo
- informations about the recorder
IOException
- on communication errorspublic IRecorderInfo getNextFreeRecorder() throws IOException
IBackend
getNextFreeRecorder
in interface IBackend
IOException
GET_NEXT_FREE_RECORDER
public IRecorderInfo getNextFreeRecorder(IRecorderInfo currentRecorder) throws IOException
IBackend
getNextFreeRecorder
in interface IBackend
currentRecorder
- the current recorder
null
if no recorder is available.
IOException
- on communication errorsGET_NEXT_FREE_RECORDER
public IRecorderInfo getNextFreeRecorder(Integer currentRecorderID) throws IOException
IBackend
getNextFreeRecorder
in interface IBackend
currentRecorderID
- the current recorder id
null
if no recorder is available.
IOException
- on communication errorsGET_NEXT_FREE_RECORDER
public IRecorderInfo getFreeRecorder() throws IOException
IBackend
recorder
.
This is similar to IBackend.getNextFreeRecorder()
, except that it tries to get a recorder on the local machine if possible.
getFreeRecorder
in interface IBackend
IOException
- on communication errorsGET_FREE_RECORDER
public IRecorderInfo getFreeRecorder(String channelNumber) throws IOException
IBackend
getFreeRecorder
in interface IBackend
channelNumber
- the desired channel
null
IOException
- on communication errorsIRecorder.checkChannel(String)
public List<IRecorderInfo> getRecorders() throws IOException
IBackend
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
getRecorders
in interface IBackend
IOException
- on communication errorsGET_RECORDER_FROM_NUM
,
IBackend.getRecorderForNum(int)
public int[] getRecorderIDs() throws IOException
IBackend
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
getRecorderIDs
in interface IBackend
IOException
- on communication errorsGET_RECORDER_FROM_NUM
,
IBackend.getRecorders()
public IRecorderInfo getRecorderForNum(int recorderId) throws IOException
IBackend
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).
getRecorderForNum
in interface IBackend
recorderId
- the recorder id
null
if no recorder was found.
IOException
- on communication errorsGET_RECORDER_FROM_NUM
public IRecorderInfo getRecorderNum(IProgramInfo programInfo) throws IOException
IBackend
getRecorderNum
in interface IBackend
programInfo
- the recording
null
if no recorder was found.
IOException
- on communication errorsGET_RECORDER_NUM
public IRecorderInfo getRecorderNum(List<String> programInfo) throws IOException
IOException
public int getFreeRecorderCount() throws IOException
IBackend
IBackend.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 ));
getFreeRecorderCount
in interface IBackend
IOException
- on communication errorsGET_FREE_RECORDER_COUNT
public int[] getFreeRecorderIDs() throws IOException
IBackend
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 IBackend.getRecorderForNum(int)
to fetch further information about the recorders.
getRecorderIDs
to get the id of all (busy or idle) recorders.
IBackend.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) ));
getFreeRecorderIDs
in interface IBackend
IOException
- on communication errorsGET_FREE_RECORDER_LIST
public List<IRecorderInfo> getFreeRecorders() throws IOException
IBackend
This method internally uses IBackend.getFreeRecorderIDs()
to determine
all free recorders and IBackend.getRecorderForNum(int)
to fetch the information
for a recorder.
getRecorders
to get all (busy or idel) recorders.
getFreeRecorders
in interface IBackend
IOException
- on communication errorsGET_FREE_RECORDER_LIST
,
GET_RECORDER_FROM_NUM
public boolean hasFreeRecorders() throws IOException
IBackend
This function used getFreeRecorderCount
to determine if there is
at lease one free recorder available.
hasFreeRecorders
in interface IBackend
true
if there is at least one free recorder available
IOException
- on communication errorsGET_FREE_RECORDER_COUNT
public void recordingListChange() throws IOException
recordingListChange
in interface IBackend
IOException
- on communication errorsBACKEND_MESSAGE_RECORDING_LIST_CHANGE
public void liveTvChainUpdate(String chainId) throws IOException
IBackend
liveTvChainUpdate
in interface IBackend
chainId
- TODO
IOException
- on communication errorsBACKEND_MESSAGE_LIVETV_CHAIN
public IProgramInfoList queryRecordings() throws IOException
IBackend
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
IBackend.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
queryRecordings
in interface IBackend
IOException
- on communication errorsQUERY_RECORDINGS
,
QUERY_ISRECORDING
,
QUERY_GETALLPENDING
public IProgramInfoList queryRecordings(ERecordingsType eRecordingsType) throws IOException
queryRecordings
in interface IBackend
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
public boolean queryGenPixmap(IProgramInfo program) throws IOException
IBackend
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."); }
queryGenPixmap
in interface IBackend
program
- the recording, for which a preview image should be generated
IOException
- on communication errorsQUERY_GENPIXMAP
public boolean queryGenPixmap(IProgramInfo program, Boolean inSeconds, Long time, String fileName, Integer width, Integer height) throws IOException
IBackend
queryPixmapLastModified
to query the last modified date of the pixmap.queryPixmap
to download the pixmap file.queryGenPixmap2(...)
.
queryGenPixmap
in interface IBackend
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
public boolean queryGenPixmap2(String token, IProgramInfo program) throws IOException
IBackend
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.
queryGenPixmap2
in interface IBackend
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 errorsQUERY_GENPIXMAP2
public boolean queryGenPixmap2(String token, IProgramInfo program, Boolean inSeconds, Long time, String fileName, Integer width, Integer height) throws IOException
IBackend
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.
queryGenPixmap2
in interface IBackend
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 errorsQUERY_GENPIXMAP2
public IPixmap queryPixmap(String previewImageName, String storageGroup) throws IOException
IBackend
This function uses IBackend.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.
queryPixmap
in interface IBackend
previewImageName
- 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
public IPixmap queryPixmap(IProgramInfo program) throws IOException
IBackend
queryPixmapLastModified
to determine the last-modified date of the pixmap.queryGenPixmap2
to generate the pixmap.queryPixmap
do download a pixmap with a different name.IBackend.annotateFileTransfer(String, String)
to download the preview image.
For later versions IBackend.queryPixmapIfModified(IProgramInfo, Date, Long)
is used.
queryPixmap
in interface IBackend
program
- the recording whose pixmap should be returned
null
IOException
- on communication errorsIMythCommand.QUERY_PIXMAP_GET_IF_MODIFIED
,
IMythCommand.ANN_FILE_TRANSFER
public Date queryPixmapLastModified(IProgramInfo program) throws IOException
IBackend
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 ));
queryPixmapLastModified
in interface IBackend
program
- the recording whose pixmap should be checked.
IOException
- on communication errorsQUERY_PIXMAP_LASTMODIFIED
public IPixmap queryPixmapIfModified(IProgramInfo program, Date lastModifiedDate, Long maxFileSize) throws IOException
IBackend
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.
queryPixmapIfModified
in interface IBackend
program
- the recording whose pixmap should be returnedlastModifiedDate
- the last modified date or null
if the preview image should be downloadedmaxFileSize
- 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
public boolean deleteRecording(Integer channelID, Date recordingStartTime) throws IOException
IBackend
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.queryRecording(Integer, Date)
,
and IBackend.deleteRecording(IProgramInfo)
is called afterwards.
deleteRecording
in interface IBackend
channelID
- the channel id of the recordingrecordingStartTime
- the recording-start-time
true
on success
IOException
- on communication errorsDELETE_RECORDING
public boolean deleteRecording(IProgramInfo programInfo, Boolean forceMetadatDelete, Boolean forgetHistory) throws IOException
IBackend
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
deleteRecording
in interface IBackend
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
public boolean deleteRecording(Integer channelID, Date recordingStartTime, Boolean forceMetadatDelete, Boolean forgetHistory) throws IOException
IBackend
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
deleteRecording
in interface IBackend
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
public boolean deleteRecording(IProgramInfo programInfo) throws IOException
IBackend
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(), )); }
deleteRecording
in interface IBackend
programInfo
- the recording to be deleted.
true
if the backend respond with -1
.
IOException
- on communication errorsDELETE_RECORDING
public boolean undeleteRecording(IProgramInfo programInfo) throws IOException
IBackend
This function undeletes a previously deleted recording.
AutoExpireInsteadOfDelete
is set to 1
in the MythTV settings table.
undeleteRecording
in interface IBackend
programInfo
- the recording to undelete
true
on success
IOException
- on communication errorsUNDELETE_RECORDING
public boolean forgetRecording(IProgramInfo programInfo) throws IOException
IBackend
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.
forgetRecording
in interface IBackend
programInfo
- the recording to forget
true
on success
IOException
- on communication errors.FORGET_RECORDING
public boolean forgetRecording(List<String> programInfo) throws IOException
IOException
public boolean forceDeleteRecording(IProgramInfo programInfo) throws IOException
IBackend
This command forces the backend to delete a recording and its metadata.
See IBackend.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.
forceDeleteRecording
in interface IBackend
programInfo
- the recording to delete
true
on success
IOException
- on communication errorsFORCE_DELETE_RECORDING
public boolean forceDeleteRecording(List<String> programInfo) throws IOException
IOException
public boolean reactivateRecording(IProgramInfo programInfo) throws IOException
IBackend
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
.
reactivateRecording
in interface IBackend
IOException
- on communication errorsREACTIVATE_RECORDING
public boolean reactivateRecording(List<String> programInfo) throws IOException
IOException
public boolean rescheduleAllRecordings() throws IOException
IBackend
This should be called if you have manually inserted a recording into the record table.
rescheduleAllRecordings
in interface IBackend
true
if rescheduling command was received successfully.
IOException
- on communication errorsRESCHEDULE_RECORDINGS
public boolean rescheduleRecordings(Integer recordID) throws IOException
IBackend
This should be called if you have manually inserted a recording into the record table.
rescheduleRecordings
in interface IBackend
recordID
- 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
public boolean rescheduleRecordingsMatch(Integer recordID, Integer sourceID, Integer multiplexID, Date maxStartTime, String reason) throws IOException
rescheduleRecordingsMatch
in interface IBackend
IOException
RESCHEDULE_RECORDINGS
public Boolean rescheduleAllRecordingsAndWait(long timeout, TimeUnit unit) throws IOException, InterruptedException, IllegalStateException
IBackend
SCHEDULE_CHANGE
event.
EPlaybackSockEventsMode.NORMAL
or EPlaybackSockEventsMode.NON_SYSTEM
, otherwise an IllegalStateException
is thrown.
rescheduleAllRecordingsAndWait
in interface IBackend
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
.public Boolean rescheduleRecordingsAndWait(Integer recordID, long timeout, TimeUnit unit) throws IOException, InterruptedException, IllegalStateException
IBackend
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 )); }
rescheduleRecordingsAndWait
in interface IBackend
recordID
- 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
.public Boolean rescheduleRecordingsMatchAndWait(Integer recordID, Integer sourceID, Integer multiplexID, Date maxStartTime, String reason, long timeout, TimeUnit unit) throws IOException, InterruptedException, IllegalStateException
rescheduleRecordingsMatchAndWait
in interface IBackend
IOException
InterruptedException
IllegalStateException
public IBasicFreeSpace getFreeSpaceOverview() throws IOException
IBackend
Protocol [min,max) | Used function | |
---|---|---|
Min | Max | |
00 | 17 | IBackend.queryFreeSpace() |
17 | 32 | IBackend.queryFreeSpaceList(boolean) |
32 | - | IBackend.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() ));
getFreeSpaceOverview
in interface IBackend
IOException
- on communication errorsIBackend.queryFreeSpace()
,
IBackend.queryFreeSpaceList(boolean)
,
IBackend.queryFreeSpaceSummary()
,
QUERY_FREESPACE
,
QUERY_FREE_SPACE_LIST
,
QUERY_FREE_SPACE_SUMMARY
public FreeSpace queryFreeSpace() throws IOException
IBackend
IBackend.queryFreeSpaceSummary()
is used.
queryFreeSpace
in interface IBackend
IOException
- on communication errorsQUERY_FREESPACE
public FreeSpaceList queryFreeSpaceList(boolean allhosts) throws IOException
IBackend
// 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
queryFreeSpaceList
in interface IBackend
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
public FreeSpaceSummary queryFreeSpaceSummary() throws IOException
IBackend
queryFreeSpaceSummary
in interface IBackend
IOException
- on communication errorsQUERY_FREE_SPACE_SUMMARY
public ILoad queryLoad() throws IOException
IBackend
queryLoad
in interface IBackend
IOException
- on communication errorsQUERY_LOAD
public IUptime queryUptime() throws IOException
IBackend
queryUptime
in interface IBackend
IOException
- on communication errorsQUERY_UPTIME
public IMemStats queryMemStats() throws IOException
IBackend
queryMemStats
in interface IBackend
IOException
- on communication errorsQUERY_MEMSTATS
public GuideDataThrough queryGuideDataThrough() throws IOException
IBackend
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 ));
queryGuideDataThrough
in interface IBackend
IOException
- on communication errorsQUERY_GUIDEDATATHROUGH
public IRecordingStatus queryIsRecording() throws IOException
IBackend
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() ));
queryIsRecording
in interface IBackend
IOException
- on communication errorsQUERY_ISRECORDING
public RecordingsPending queryAllPending() throws IOException
IBackend
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)
queryAllPending
in interface IBackend
IRecordings.size()
returns 0
,
no scheduled programs were found.
IOException
- on communication errorsQUERY_GETALLPENDING
public RecordingsScheduled queryAllScheduled() throws IOException
IBackend
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
queryAllScheduled
in interface IBackend
IRecordings.size()
returns 0
,
no scheduled programs were found.
IOException
- on communication errorsQUERY_GETALLSCHEDULED
public RecordingsExpiring queryExpiring() throws IOException
IBackend
queryAllScheduled
to get all scheduled recordings.queryAllPending
to get all pending recordings.queryConflicting
to get all conflicting recordings.queryRecordings
to get all finished recordings.IBackend.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.
queryExpiring
in interface IBackend
IRecordings.size()
returns 0
,
no expiring programs were found.
IOException
- on communication errorsQUERY_GETEXPIRING
public RecordingsConflicting queryConflicting() throws IOException
IBackend
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)
queryConflicting
in interface IBackend
IRecordings.size()
returns 0
,
no conflicts were found
IOException
- on communication errorsQUERY_GETCONFLICTING
public RecordingsConflicting queryConflicting(IProgramInfo programInfo) throws IOException
IBackend
queryConflicting
if you need to check all pending recordings for conflicts.
queryConflicting
in interface IBackend
programInfo
- the program to check
IRecordings.size()
returns 0
,
no conflicts were found
IOException
- on communication errorsQUERY_GETCONFLICTING
public boolean isActiveBackend() throws IOException
IBackend
This function internally uses IBackend.queryHostname()
to determine the hostname of the
connected backend and thereafter calls IBackend.isActiveBackend(String)
with this hostname.
isActiveBackend
in interface IBackend
true
if the given backend is active.
IOException
- on communication errorsQUERY_IS_ACTIVE_BACKEND
public boolean isActiveBackend(String hostname) throws IOException
IBackend
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") ));
isActiveBackend
in interface IBackend
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
public List<String> queryActiveBackends() throws IOException
IBackend
This function returns the names of all currently active backends.
queryActiveBackends
in interface IBackend
IOException
- on communication errorsQUERY_ACTIVE_BACKENDS
public boolean refreshBackend() throws IOException
IBackend
refreshBackend
in interface IBackend
true
if the backend has reload the backend-settings successfully.
IOException
- on communication errorspublic FileStatus queryCheckFile(IProgramInfo programInfo, Boolean checkSlaves) throws IOException
IBackend
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."); }
queryCheckFile
in interface IBackend
programInfo
- the given programcheckSlaves
- specifies if all slaves should be checked too. (Since 32)
null
IOException
- on communication errorsQUERY_CHECKFILE
public FileStatus queryFileExists(IProgramInfo programInfo) throws IOException
IBackend
queryCheckFile
is used instead.
queryFileExists
in interface IBackend
programInfo
- the program for which the file should be searched
null
IOException
- on communication errorsIBackend.queryFileExists(String, String)
,
QUERY_FILE_EXISTS
public FileStatus queryFileExists(URI fileUrl) throws IOException
IBackend
This method calls URI.getUserInfo()
and URI.getPath()
to determine the storage-group and file-name
and calls IBackend.queryFileExists(String, String)
afterwards.
queryFileExists
in interface IBackend
fileUrl
- the remote file
null
IOException
- on communication errorsQUERY_FILE_EXISTS
,
IBackend.queryFileExists(String, String)
public FileStatus queryFileExists(String fileName, String storageGroup) throws IOException
IBackend
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."); }
queryFileExists
in interface IBackend
fileName
- the remote file namestorageGroup
- the storage group name, or null
to search in the default group
null
IOException
- on communication errorsQUERY_FILE_EXISTS
public String queryFileHash(IProgramInfo programInfo) throws IOException
IBackend
queryFileHash
in interface IBackend
programInfo
- the program referencing a file, for which the file hash should be generated.
75aa72141cd08662
IOException
- on communication errorsIBackend.queryFileHash(String, String, String)
,
QUERY_FILE_HASH
public String queryFileHash(String fileName, String storageGroup) throws IOException
IBackend
OpenSubtitlesHasher
could be used.
queryFileHash
in interface IBackend
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
public String queryFileHash(URI fileUrl) throws IOException
IBackend
This method calls URI.getUserInfo()
, URI.getHost()
and URI.getPath()
to determine the storage-group, host-name and file-name
and calls IBackend.queryFileHash(String, String, String)
afterwards.
OpenSubtitlesHasher
could be used.
queryFileHash
in interface IBackend
fileUrl
- the remote file
75aa72141cd08662
IOException
- on communication errorsQUERY_FILE_HASH
public String queryFileHash(String fileName, String storageGroup, String hostName) throws IOException
IBackend
OpenSubtitlesHasher
could be used.
queryFileHash
in interface IBackend
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
public StorageGroupFile queryStorageGroupFile(String hostName, String storageGroup, String fileName) throws IOException
IBackend
IBackend.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"); }
queryStorageGroupFile
in interface IBackend
hostName
- the backend host to query. if null
the result of IBackend.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
public IStorageGroupFileList queryStorageGroupFileList(String hostName, String storageGroup, String path) throws IOException
IBackend
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); } } } }
queryStorageGroupFileList
in interface IBackend
hostName
- the backend host to query.
If this is null
IBackend.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 errorspublic StorageGroupFileList queryStorageGroupFileList(String hostName, String storageGroup, String path, boolean fileNamesOnly) throws IOException
IBackend
queryStorageGroupFileList
in interface IBackend
hostName
- the backend host to query.
If this is null
IBackend.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 errorspublic ITimezone queryTimeZone() throws IOException
IBackend
queryTimeZone
in interface IBackend
IOException
- on communication errorsQUERY_TIME_ZONE
public boolean goToSleep() throws IOException
IBackend
goToSleep
in interface IBackend
true
if the backend went to sleep or false
otherwise
IOException
- on communication errorsGO_TO_SLEEP
public String queryHostname() throws IOException
IBackend
IBackend.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);
queryHostname
in interface IBackend
IOException
- on communication errorsQUERY_HOSTNAME
public Boolean blockShutdown() throws IOException
IBackend
This function prevents a backend from shutting down until a the next call of IBackend.allowShutdown()
.
blockShutdown
in interface IBackend
true
if the backed has accepted the request
IOException
- on communication errorsBLOCK_SHUTDOWN
public Boolean allowShutdown() throws IOException
IBackend
This function allows a backend to shut down again after a previous call of IBackend.blockShutdown()
.
allowShutdown
in interface IBackend
true
if the backed has accepted the request
IOException
- on communication errorsALLOW_SHUTDOWN
public void shutdownNow() throws IOException
IBackend
shutdownNow
in interface IBackend
IOException
- on communication errorsSHUTDOWN_NOW
public Setting querySetting(String hostName, String settingName) throws IOException
IBackend
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.
querySetting
in interface IBackend
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 errorspublic boolean setSetting(String hostName, String settingName, String settingValue) throws IOException
IBackend
querySetting
to read backend settings.clearSettingsCache
to notify the backend about changed settings.
setSetting
in interface IBackend
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
public void clearSettingsCache() throws IOException
IBackend
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.
clearSettingsCache
in interface IBackend
IOException
- on communication errorsBACKEND_MESSAGE_CLEAR_SETTINGS_CACHE
public ITunerInfo lockTuner() throws IOException
IBackend
ATTENTION: This only works if your frontend is on the same machine as one of the available tuners.
freeTuner
to unlock a tuner.
lockTuner
in interface IBackend
IOException
- on communication errorsIBackend.lockTuner(Integer)
,
LOCK_TUNER
public ITunerInfo lockTuner(Integer recorderID) throws IOException
IBackend
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.
lockTuner
in interface IBackend
recorderID
- the ID of the recorder to lock
IOException
- on communication errorsLOCK_TUNER
public boolean freeTuner(Integer recorderID) throws IOException
IBackend
lockTuner
to lock a tuner.
freeTuner
in interface IBackend
recorderID
- the ID of the recorder to free
true
if the recorder was freed successfully or false
otherwise
IOException
- on communication errorsFREE_TUNER
public IProgramInfo fillProgramInfo(IProgramInfo programInfo) throws IOException
IBackend
fillProgramInfo
in interface IBackend
programInfo
- the recording, whose information should be updated.
IOException
- on communication errorsFILL_PROGRAM_INFO
public IProgramInfo fillProgramInfo(IProgramInfo programInfo, String playBackHostname) throws IOException
IBackend
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
.
fillProgramInfo
in interface IBackend
programInfo
- the recording, whose information should be updated.playBackHostname
- the name of the playback host
IOException
- on communication errorsFILL_PROGRAM_INFO
public Integer checkRecording(IProgramInfo programInfo) throws IOException
IBackend
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 )); }
checkRecording
in interface IBackend
programInfo
- the given program
null
IOException
- on communication errorsCHECK_RECORDING
public Integer stopRecording(IProgramInfo programInfo) throws IOException
IBackend
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 )); } }
stopRecording
in interface IBackend
programInfo
- the recording to be stopped.
-1
if the recording is not found.
IOException
- on communication errors.STOP_RECORDING
public IRecorderInfo getRecorderForProgram(IProgramInfo programInfo) throws IOException
IBackend
null
, if it is not being recorded.
This method combines IBackend.checkRecording(IProgramInfo)
and IBackend.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() )); }
getRecorderForProgram
in interface IBackend
programInfo
- the given program
null
IOException
- on communication errorsIBackend.checkRecording(IProgramInfo)
,
IBackend.getRecorderForNum(int)
public ProgramInfo queryRecording(String baseName) throws IOException
queryRecording
in interface IBackend
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
public IProgramInfo queryRecording(IBasicChannelInfo channel, Date startTime) throws IOException
IBackend
This function internally uses IBasicChannelInfo.getChannelID()
to get the channel-id of the recording
and calls IBackend.queryRecording(Integer, Date)
afterwards.
IBackend.queryRecording(String)
to query a recording by base name.
queryRecording
in interface IBackend
channel
- the channel of the recordingstartTime
- the recording starting-time, e.g. 2010-08-11T13:37:47
.
null
if no matching recording was found
IOException
- on communication errorsIBackend.queryRecording(Integer, Date)
,
QUERY_RECORDING
public IProgramInfo queryRecording(Integer channelID, Date recordingStartTime) throws IOException
IBackend
IBackend.queryRecording(String)
to query a recording by base name.
IBackend.queryRecordings()
is called to fetch all recordings,
and a program-filter
is used afterwards to determine the desired recording.
queryRecording
in interface IBackend
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 errorsIBackend.queryRecording(IBasicChannelInfo, Date)
,
QUERY_RECORDING
public <C extends IBasicChannelInfo> Map<Integer,C> getBasicChannelInfoMap() throws IOException
IOException
public <C extends IBasicChannelInfo> List<C> getBasicChannelInfos() throws IOException
IBackend
28
an IBasicChannelInfo
object is returned, otherwise an IRecorderChannelInfo
object is returned.
getBasicChannelInfos
in interface IBackend
C
- the return type. is is either a IBasicChannelInfo
or an IRecorderChannelInfo
IOException
- on communication errorsIBackend.getChannelInfos()
,
IBackend.getRecorders()
,
IRecorder.getBasicChannelInfos()
public List<IRecorderChannelInfo> getChannelInfos() throws IOException
IBackend
This method internally uses IBackend.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 ...
getChannelInfos
in interface IBackend
IOException
- on communication errorsIBackend.getRecorders()
,
IRecorder.getBasicChannelInfos()
public boolean setChannelInfo(String oldChannelNumber, IRecorderChannelInfo channelInfo) throws IOException
IBackend
getChannelInfos
to get infos about all known channels.IRecorder.getChannelInfo
to get the info for a single channel
setChannelInfo
in interface IBackend
oldChannelNumber
- the old channel numberchannelInfo
- the new channel info
true
if channel data was changed successfully.
IOException
- on communication errorsSET_CHANNEL_INFO
public List<IRecorderNextProgramInfo> getNextProgramInfos(Date date) throws IOException
IBackend
This method internally uses IBackend.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
getNextProgramInfos
in interface IBackend
date
- the start time
IOException
- on communication errorsIBackend.getRecorders()
,
IRecorder.getNextProgramInfos(Date)
public Map<String,String> getChannelLogoMap(IRecorderNextProgramInfo.Props keyProp) throws IOException
IBackend
This method interally uses IBackend.getNextProgramInfos(Date)
to determine the path to
all channel logos.
getChannelLogoMap
in interface IBackend
keyProp
- the property of the program-info object that should be used as key for the map.IRecorderNextProgramInfo.Props#CHANNEL_ID
is used.
IOException
public boolean scanVideos() throws IOException
IBackend
scanVideos
in interface IBackend
true
if the backend respond with OK
IOException
- on communication errorsSCAN_VIDEOS
,
IVideoList
,
IVideoListNoChange
,
IVideoListChange
public boolean queryTranscode(IProgramInfo programInfo) throws IOException
IOException
public URI downloadFile(URI url, String storageGroup, String fileName) throws IOException
IBackend
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();
downloadFile
in interface IBackend
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
public URI downloadFileNow(URI url, String storageGroup, String fileName) throws IOException
IBackend
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();
downloadFileNow
in interface IBackend
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
public boolean deleteFile(URI fileUrl) throws IOException
IBackend
This method calls URI.getUserInfo()
and URI.getPath()
to determine the storage-group and file-name
and calls IBackend.deleteFile(String, String)
afterwards.
IBackend.deleteRecording(IProgramInfo)
if a recording should be deleted.
deleteFile
in interface IBackend
fileUrl
- the url to the remote file
true
if the file was deleted successfully, or false
otherwise
IOException
- on communication errorsDELETE_FILE
public boolean deleteFile(String fileName, String storageGroup) throws IOException
IBackend
deleteRecording
if a recording should be deleted.
deleteFile
in interface IBackend
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
public Long queryBookmark(IProgramInfo program) throws IOException
IBackend
This function uses IProgramInfo.getChannelID()
and IProgramInfo.getRecordingStartTime()
to determine
the channel-id and recording-start-time and calls IBackend.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 )); } }
queryBookmark
in interface IBackend
program
- the recording
IOException
- on communication errorsQUERY_BOOKMARK
public Long queryBookmark(Integer channelID, Date recordingStartTime) throws IOException
IBackend
setBookmark
to set the bookmark of a recording.
queryBookmark
in interface IBackend
channelID
- the channel-ID of the recordingrecordingStartTime
- the recording-start-time of the recording
IOException
- on communication errorsQUERY_BOOKMARK
public boolean setBookmark(IProgramInfo recording, Long bookmarkPosition) throws IOException
IBackend
This function uses IProgramInfo.getChannelID()
and IProgramInfo.getRecordingStartTime()
to determine
the channel-id and recording-start-time of the recording and calls IBackend.setBookmark(Integer, Date, Long)
afterwards.
queryBookmark
to get the bookmark of a recording.
setBookmark
in interface IBackend
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
public boolean setBookmark(Integer channelID, Date recordingStartTime, Long bookmarkPosition) throws IOException
IBackend
queryBookmark
to get the bookmark of a recording.
setBookmark
in interface IBackend
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
public boolean queueTranscode(IProgramInfo recording) throws IOException
IBackend
queueTranscodeStop
to stop transcoding of a recording.
queueTranscode
in interface IBackend
recording
- the recording to transcode
true
on success
IOException
- on communication errorsQUEUE_TRANSCODE
public boolean queueTranscodeCutlist(IProgramInfo recording) throws IOException
IBackend
queueTranscodeStop
to stop transcoding of a recording.
queueTranscodeCutlist
in interface IBackend
recording
- the recording to transcode
true
on success
IOException
- on communication errorsQUEUE_TRANSCODE_CUTLIST
public boolean queueTranscodeStop(IProgramInfo recording) throws IOException
IBackend
queueTranscode
to start transcoding of a recording.queueTranscodeCutlist
to start transcoding and cutlist processing of a recording.
queueTranscodeStop
in interface IBackend
recording
- the recording for which transcoding should be stopped
true
on success
IOException
- on communication errorsQUEUE_TRANSCODE_STOP
public String toString()
toString
in class Object
public static void main(String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |