|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Class Summary | |
---|---|
AudioItem | <ArtistName>{text}</ArtistName> <AlbumTitle>{text}</AlbumTitle> <SongTitle>{text}</SongTitle> <AlbumYear>{date}</AlbumYear> <MusicGenre>{text}</MusicGenre> <SourceBitRate>{bits-per-second}</SourceBitRate> <SourceSampleRate>{samples-per-second}</SourceSampleRate> <Duration>{msecs}</Duration> <RecordLabel>{text}</RecordLabel> |
Container | an HMO Container representation which contains meta information and a list of items that may be Containers or Audio or Video or Image information. |
ContainerItem | <TotalItems>{count}</TotalItems> <TotalSize>{bytes}</TotalSize> <TotalDuration>{msecs}</TotalDuration> |
ContainerRequest | Class to set up a request for a container and parse the results back for us. |
HMOSession | Class to track a client session against an HMO server, e.g. |
ImageItem | <CaptureDate>{date}</CaptureDate> <SourceWidth>{pixels}</SourceWidth> <SourceHeight>{pixels}</SourceHeight> <SourceColors>{count}</SourceColors> <SourceResolution>{dpi}<SourceResolution> <Caption>{text}</Caption> <Keywords>{comma-delimited-text}</Keywords> |
Item | Superclass of all Items in HMO listing. |
ItemFactory | |
Link | |
LinkFactory | |
VideoItem | Undocumented Video Item type for HMO, based on "ContentType=video/x-tivo-raw-tts". |
The HMOClient package is designed to encapsulize interaction from Java with an
HMO server such as a Tivo (containing Video items) or another computer serving
images and music.
Video items are not documented in the HMO specification but have been implemented
by observation of results.
Example of processing against a TiVo:
try { // Do a whole bunch of junk to make an https connection to the // TiVo with a specific login/password, an invalid/unknown // hostname (just IP), and an untrusted certificate signer. Authenticator.setDefault( new MyAuthenticator("tivo",mediaKey) ); TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { public java.security.cert.X509Certificate[] getAcceptedIssuers() { return null; } public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) { } public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) { } } }; SSLContext sc = SSLContext.getInstance("SSL"); sc.init(null, trustAllCerts, new java.security.SecureRandom()); SSLSocketFactory socketFactory = sc.getSocketFactory(); HttpsURLConnection.setDefaultSSLSocketFactory(socketFactory); if(HttpsURLConnection.getDefaultSSLSocketFactory() !=socketFactory) { throw new Exception("UNABLE TO SET SSLSocketFactory!"); } MyHostVerifier mhv = new MyHostVerifier(); HttpsURLConnection.setDefaultHostnameVerifier( mhv ); if(HttpsURLConnection.getDefaultHostnameVerifier() != mhv) { throw new Exception("UNABLE TO SET HostnameVerifier!"); } // authenticator takes care of user/pass URL url = new URL("https://"+host); // Set up the HMO session and get the root. HMOSession hmo = new HMOSession(url); ContainerRequest req1 = hmo.newRootRequest(); Container root = req1.execute( 0, 1 ); Item rootsChild = (Item)root.getItems().get( 0 ); // make a real request from the root (now playing). // get the 5 most recently created items check which are in progress if(rootsChild.isContainer()) { ContainerRequest req = rootsChild.newContainerRequest(); req.addReverseOrder( ContainerRequest.ORDER_CREATION_DATE ); req.setRecursive( true ); Container first5 = req.execute( 0, 5 ); Throwable loadError = first5.getLoadError(); if(loadError != null) { if(loadError instanceof Exception) { throw (Exception)loadError; } else { throw new Exception(loadError.getMessage(),loadError); } } List items = first5.getItems(); if(items != null) { for( Iterator iter = items.iterator() ; iter.hasNext() ; ) { Object obj = iter.next(); if(obj instanceof VideoItem) { VideoItem item = (VideoItem)obj; if(item.isInProgress()) { ... } } } } } } catch(Exception e) { app.getFactory().log( ILogger.LOG_WARNING, e.toString() ); }
|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |