jreceiver.common.rpc
Interface Menus

All Superinterfaces:
RpcBase

public interface Menus
extends RpcBase

Menu-related queries and updates for a (possibly-remote) JRec server, returning MenuRecs or String-formatted results.

TUNE QUERIES

A 'tune query' is a shorthand means of specifying a filter.

For example, to obtain a list of albums for an artist:

 Menus mnu_rpc = RpcFactory.newMenus();

 TuneQuery tq = new TuneQuery();
 tq.setArtistName("Pink Floyd");

 Vector albums = mnu_rpc.getAlbumMenuRecs(tq, driver_id, 0, Menu.NO_LIMIT);
 Iterator it = albums.iterator();
 while (it.hasNext()) {
    Menu menu = (Menu)it.next();
    System.out.println("album_name=" + menu.getMenuText()
                       + " tune_count=" + menu.getTuneCount());
 }
 
You can even combine several criteria. For example, query the titles for a specific album that start with "An":
 TuneQuery tq = new TuneQuery();
 tq.setArtistName("Pink Floyd");
 tq.setAlbumName("The Wall");
 tq.setTitleName("^An", true);   //true==IS_REG_EXP
 
might return:

Another Brick In The Wall (Part 1)
Another Brick In The Wall (Part 2)
Another Brick In The Wall (Part 3)
Anybody Out There?

Note that you can specify whether match will be exact (default) or a regular expression. The regular expression queries are a powerful feature that allow such things as selecting over a large list. The Rio driver does this to support queries from the remote:

      ^[2abc][5jkl][4ghi].*'
 

...to find all titles where "2", "a", "b" or "c" is the first letter, etc.

Note that the regular-expression capabilities may be limited by the database. See the MySQL documentation of REGEXP.

Once you have the artists, albums, genres or titles you want to play, consult the Tunes.getKeysForQuery() method which is quite similar to the menu interface, but returns tune src_ids. ENCODING Obtain a list of artists, albums, genres or tune titles custom formatted into a large string for use in a menu.

You must specify a formatting patthen. For example, when using encodeAlbums:

     String pattern = "{0,number,#}={1},0,0:{2}\r\n";
 
where {0} will be replaced with the index (starting at begin), {1} will be replaced with the number of tunes for the artist (as stored in the database) and {2} is the artist name.

Version:
$Revision: 1.7 $ $Date: 2002/12/29 00:44:08 $
Author:
Reed Esau

Field Summary
static java.lang.String ENCODE_ALBUMS
           
static java.lang.String ENCODE_ARTISTS
           
static java.lang.String ENCODE_GENRES
           
static java.lang.String ENCODE_TITLES
           
static java.lang.String GET_ALBUM_MENU_RECS
           
static java.lang.String GET_ARTIST_MENU_RECS
           
static java.lang.String GET_GENRE_MENU_RECS
           
static java.lang.String GET_TITLE_MENU_RECS
           
static java.lang.String HANDLER_NAME
           
 
Fields inherited from interface jreceiver.common.rpc.RpcBase
DETECT
 
Method Summary
 java.lang.String encodeAlbums(TuneQuery tune_query, int driver_id, java.lang.String pattern, int rec_offset, int rec_count)
          obtain a list of albums, custom formatted, for use in a menu.
 java.lang.String encodeArtists(TuneQuery tune_query, int driver_id, java.lang.String pattern, int rec_offset, int rec_count)
          obtain a list of artists, custom formatted, for use in a menu.
 java.lang.String encodeGenres(TuneQuery tune_query, int driver_id, java.lang.String pattern, int rec_offset, int rec_count)
          obtain a list of genres, custom formatted, for use in a menu.
 java.lang.String encodeTitles(TuneQuery tune_query, int driver_id, java.lang.String pattern, int rec_offset, int rec_count)
          obtain a list of titles, custom formatted, for use in a menu.
 java.util.Vector getAlbumMenuRecs(TuneQuery tune_query, int driver_id, int rec_offset, int rec_count)
          obtain a list of MenuRecs that specify album/cd names
 java.util.Vector getArtistMenuRecs(TuneQuery tune_query, int driver_id, int rec_offset, int rec_count)
          obtain a list of MenuRecs that specify artist names
 java.util.Vector getGenreMenuRecs(TuneQuery tune_query, int driver_id, int rec_offset, int rec_count)
          obtain a list of MenuRecs that specify genre names
 java.util.Vector getTitleMenuRecs(TuneQuery tune_query, int driver_id, int rec_offset, int rec_count)
          obtain a list of MenuRecs that specify tune titles
 
Methods inherited from interface jreceiver.common.rpc.RpcBase
detect
 

Field Detail

HANDLER_NAME

public static final java.lang.String HANDLER_NAME

GET_ARTIST_MENU_RECS

public static final java.lang.String GET_ARTIST_MENU_RECS

GET_ALBUM_MENU_RECS

public static final java.lang.String GET_ALBUM_MENU_RECS

GET_GENRE_MENU_RECS

public static final java.lang.String GET_GENRE_MENU_RECS

GET_TITLE_MENU_RECS

public static final java.lang.String GET_TITLE_MENU_RECS

ENCODE_ARTISTS

public static final java.lang.String ENCODE_ARTISTS

ENCODE_ALBUMS

public static final java.lang.String ENCODE_ALBUMS

ENCODE_GENRES

public static final java.lang.String ENCODE_GENRES

ENCODE_TITLES

public static final java.lang.String ENCODE_TITLES
Method Detail

getArtistMenuRecs

public java.util.Vector getArtistMenuRecs(TuneQuery tune_query,
                                          int driver_id,
                                          int rec_offset,
                                          int rec_count)
                                   throws RpcException
obtain a list of MenuRecs that specify artist names

getAlbumMenuRecs

public java.util.Vector getAlbumMenuRecs(TuneQuery tune_query,
                                         int driver_id,
                                         int rec_offset,
                                         int rec_count)
                                  throws RpcException
obtain a list of MenuRecs that specify album/cd names

getGenreMenuRecs

public java.util.Vector getGenreMenuRecs(TuneQuery tune_query,
                                         int driver_id,
                                         int rec_offset,
                                         int rec_count)
                                  throws RpcException
obtain a list of MenuRecs that specify genre names

getTitleMenuRecs

public java.util.Vector getTitleMenuRecs(TuneQuery tune_query,
                                         int driver_id,
                                         int rec_offset,
                                         int rec_count)
                                  throws RpcException
obtain a list of MenuRecs that specify tune titles

encodeArtists

public java.lang.String encodeArtists(TuneQuery tune_query,
                                      int driver_id,
                                      java.lang.String pattern,
                                      int rec_offset,
                                      int rec_count)
                               throws RpcException
obtain a list of artists, custom formatted, for use in a menu.

encodeAlbums

public java.lang.String encodeAlbums(TuneQuery tune_query,
                                     int driver_id,
                                     java.lang.String pattern,
                                     int rec_offset,
                                     int rec_count)
                              throws RpcException
obtain a list of albums, custom formatted, for use in a menu.

encodeGenres

public java.lang.String encodeGenres(TuneQuery tune_query,
                                     int driver_id,
                                     java.lang.String pattern,
                                     int rec_offset,
                                     int rec_count)
                              throws RpcException
obtain a list of genres, custom formatted, for use in a menu.

encodeTitles

public java.lang.String encodeTitles(TuneQuery tune_query,
                                     int driver_id,
                                     java.lang.String pattern,
                                     int rec_offset,
                                     int rec_count)
                              throws RpcException
obtain a list of titles, custom formatted, for use in a menu.


Copyright © 2001-2002 Reed Esau, All Rights Reserved.