MME commandline client
mmecli
mmecli [-c cpname] [-d dbname] [-est]
[-i interval] [-r mask] command command_args
ARM, PowerPC, SH, x86
- -a
- Send asynchronous commands. Default is synchronous commands.
- -c cpname
- Set the MME control context to connect to. By default, mmecli uses /dev/mme.
- -d dbname
- Set the database device name. By default, mmecli connects to the database defined by the QDBC_DBNAME environment variable.
- -e
- Run in event mode (not interactive). In this mode, mmecli runs in the background and prints out received events to the standard output. This may be useful for monitoring or debugging other MME client applications.
- -i interval
- Set the time notification interval in milliseconds. By default this is 100 milliseconds.
- -r mask
- Register for events mask value. By default this is 0xFFFF.
- -s
- Script mode (interactive). See below.
- -t
- Report MME_EVENT_TIME. If this option isn't set, this event is ignored.
The mmecli is a command-line client to the MME that allows you to issue commands corresponding to MME API function calls, and view events generated by the system. You must have the MME and required applications running to use mmecli. The source of mmecli is provided in the QNX Aviage multimedia suite as well, and contains examples of how to call most of the MME API functions.
Script mode can be used to run mmecli in a shell script.
All typical mmecli commands can be issued, as well as some additional script-specific commands. Before commands are evaluated, they are passed through a pre-processor that can expand placeholders with values (see the table below). Lines beginning with the # character are considered comments, and are ignored.
If any command fails, mmecli stops evaluating any more commands and exits with a failure return code.
The table below lists script mode placeholders:
Placeholder |
Meaning |
%t |
The last created tracksession. |
%f |
The fid value returned by the last getfid command. |
%c |
The current control context ID. |
%b |
The last created bookmark ID. |
%r0 - %r9 |
User registers. |
%z |
The last created zone ID, or the last zone ID returned by play_get_zone. |
%V |
The volume received from the last getvolume command. |
%M |
The mute value received from the last getvolume command. |
%B |
The balance value received from the last getvolume command. |
 |
If you want to use a % character in script mode, you need to escape it by using %%. |
These commands are available only in script mode:
- .waitforevent event [event2...]
- This command cause the mmecli to block waiting for any of the specified events to arrive. Events are categorized as “good” (prefixed with a +) or “bad” (prefixed with a -). When a good event arrives, mmecli unblocks and resumes executing the script. When a bad event arrives, mmecli unblocks and exits with a failure.
Because events are queued, its important that you flush the event queue for events you are waiting for that have been previously delivered. See the .flushevents command to do this.
You can wait for all events available in the MME's event header file (<event.h>). Use the full event name, minus the MME_EVENT_ prefix.
Example:
.waitforevent +TRKSESSION -PLAY_ERROR
- .flushevents
- Flush all events from the client queue. This command returns after all events are flushed.
- .echo [message]
- This command prints a message to stdout. This is useful for debugging.
- .qdb command
- Execute a query against the database. This command succeeds as long as the underlying qdb_*() calls succeed. The resulting statement is printed.
- .qdb_require_rows command
- Execute a query against the database. If no rows are resulting from a
request, then the command fails.
- .setint 0-9 value
- Sets the specified register (r0 to r9) to the specified integer value.
- .delay millisecond_value
- Delays execution for the specified number of millieseconds.
- .expecterror [errno]
- Expect an error on the next command. This will cause mmecli to treat the next command with inverted logic: if it returns -1, it passes, but if it returns ≥, it fails. Optionally, errno can be set also as a requirement when you are expecting a particular errno back. If any errno other than the one specified is returned, then the command fails.
The mmecli supports the following commands.
 |
Note that where a command takes an SQL statement, or a parameter that contains more than one word, the string should be enclosed by either single (') or double (") quotation markses. Quotation marks within a string must be escaped. For example, if you want to create a new tracksession with the statement
select fid from library where filename = 'chord.wav', you would need to use this command:
newtrksession l "SELECT fid FROM library WHERE filename = \'chord.wav\'"
|
- audio_get_status
- Get the audio status; see mme_audio_get_status().
- bookmark_create name
- Create a bookmark; see mme_bookmark_create().
- bookmark_delete fid bookmarkid
- Delete a bookmark based on fid or bookmarkid; see mme_bookmark_delete().
- button button
- Respond to button events for navigable tracks; see mme_button().
- charconvert_setup
- Indicate the default character encoding; see mme_charconvert_setup().
- copy add statement
- Add a media copy operation; see mme_mediacopier_add().
- copy clear
- Clear all files from the media copy queue; see mme_mediacopier_remove().
- copy cleanup
- Clean up partially copied or ripped files; see mme_mediacopier_cleanup().
- copy disable
- Disable the mediacopier; see mme_mediacopier_disable().
- copy enable
- Enable the mediacopier; see mme_mediacopier_enable()
- copy mode [background|priority]
- Get the selected media copying or ripping mode. If you specify a mode, the mode is set. See mme_mediacopier_get_mode() and mme_mediacopier_set_mode().
- copy remove statement
- Remove files from the media copy queue; see mme_mediacopier_remove().
- directed_sync_cancel operation_id
- Cancels a specified directed synchronization; see mme_directed_sync_cancel().
- delete_mediastores flags
- Prune unavailable mediastores; see mme_dvd_get_disc_region().
- dvd_get_disc_region msid
- Get the region permissions for a DVD-video; see mme_dvd_get_disc_region().
- dvd_get_status
- Get the status for a DVD; see mme_dvd_get_status().
- get_api_timeout_remaining
- Get the number of milliseconds remaining before the API call times out; see mme_get_api_timeout_remaining().
- getautopause
- Get the autopause mode; see mme_getautopause().
- getccid
- Get the control context ID for the currently connected control context; see mme_getccid().
- getclientcount
- Get the number of clients connected to a control context; see mme_getclientcount().
- getfid
- Get the current playing fid; see mme_play_get_info().
- getlocale
- Get the preferred language code; see mme_getlocale().
- get_logging
- Get the log verbosity levels for specified logging modules; see mme_get_logging().
- getnumsyncing
- Get the number of synchronizing devices; see mme_sync_get_status().
- getrandom
- Get the random playback mode for a control context; see mme_getrandom().
- getrepeat
- Get the repeat playback mode for a control context; see mme_getrepeat().
- getscanmode
- Get the scan mode for a control context; see mme_getscanmode().
- getstatus
- Get the status of the current track; see mme_play_get_status().
- get_title_chapter
- Get DVD title and chapter information for the currently playing DVD track; see mme_get_title_chapter().
- getvolume [outputdeviceid]
- Get the current volume setting; see mme_play_get_output_attr().
- isplayingnavigable
- Indicates whether the playing media can be navigated (with the button command); see the MME_PLAYSUPPORT_NAVIGATION flag in mme_play_info_t.
- isplayingvideo
- Indicates whether the current track has video; see the MME_PLAYSUPPORT_VIDEO in mme_play_info_t.
- lib_column_set msid column value
- Set values in specified table column; see mme_lib_column_set().
- media_get_def_lang
- Get the preferred media playback language; see mme_media_get_def_lang().
- media_set_def_lang lang
- Set the preferred media playback language; see mme_media_set_def_lang().
- metadata_create_session
- Create a new metatdata session; see mme_metadata_create_session().
- metadata_free_session session_id
- End a metadata session; see mme_metadata_free_session().
- metadata_getinfo_current session_id [groups]
- Get metadata for the currently playing track; see mme_metadata_getinfo_current().
- metadata_getinfo_file session_id msid file [groups]
- Get metadata for a specified file, based on the filepath; see mme_metadata_getinfo_file().
- metadata_getinfo_library session_id fid [groups]
- Get metadata for a specified file, based on the file ID; see mme_metadata_getinfo_library().
- metadata_image_cache_clear msid
- Purge images from the image cache; see mme_metadata_image_cache_clear().
- metadata_image_load sessionid md_rid image_index
- Load an image for a file; see mme_metadata_image_load().
- metadata_image_unload sessionid img_rid
- Clear image from temporary storage; see mme_metadata_image_unload().
- metadata_set fid [flags] [numstring] [year] [month] [mday] [track] [disc] [string]
- Set the metadata for a file; see mme_metadata_set().
- ms_clear_accurate msid.
- Mark library entries for the mediastore msid as inaccurate; see mme_ms_clear_accurate().
- ms_metadata_get msid filepath types
- Get metadata from a file; see mme_ms_metadata_get().
- mute [outputdeviceid] mute
- Set the mute state (1=muted, 0=not muted); see mme_play_set_output_attr.
- newtrksession mode statement
- Create a new tracksession based on an SQL statement. The mode can be l for “library” or f for “file”. See mme_newtrksession().
- next
- Skip to the next track; see mme_next().
- output_set_permanent outputdeviceid permanent
- Set the permanency status of an output device (where permanent can be 0=No, 1=Yes). See mme_output_set_permanent().
- pause
- Pause the current playback; see mme_play_set_speed().
- play [fid]
- Play the specified fid, or the current tracksession, if no fid is specified; see mme_play().
- play_at offset
- Start playback at the specified offset; see mme_play_offset().
- play_attach_output zoneid outputdeviceid
- Attach an output to a zone; see mme_play_attach_output().
- play_bookmark bookmarkid
- Start playback from a bookmark; see mme_play_bookmark().
- play_detach_output zoneid outputdeviceid
- Detach an output from a zone; see mme_play_detach_output().
- play_file msid filename
- Play a track on an unsynchronized mediastore; see mme_play_file(). Deprecated: use file-based track sessions; see “Creating and modifying file-based track sessions” in the MME Developer's Guide.
- play_get_speed
- Get playback speed and direction (forward, reverse, pause) for tracks; see mme_play_get_speed().
- play_get_zone
- Get the zone ID used by a control context; see mme_play_get_zone().
- playlist_create msid name
- Create a new playlist; see mme_playlist_create().
- playlist_delete
- Delete a specified playlist; see mme_playlist_delete().
- playlist_generate_similar
- Generate a playlist like an existing playlist; see mme_playlist_generate_similar().
- playlist_set_statement
- Set the SQL statement to create a playlist; see mme_playlist_set_statement().
- playlist_sync
- Synchronize a specified playlist; see mme_playlist_sync().
- play_resume_msid msid
- Set the track session ID to use when resuming playback of a mediastore; see mme_play_resume_msid().
- play_set_speed speed
- Set the playback speed and direction, where speed is expressed in units of 1/1000 of normal speed. See mme_play_set_speed().
- play_set_zone zoneid
- Set the zone ID used by a control context; see mme_play_set_zone().
- prev
- Skip to the previous track; see mme_prev().
- resume
- Resume paused playback; see mme_play_set_speed().
- resync_mediastore msid [folderid] passmask
- Re-synchronize a mediastore; see mme_resync_mediastore.
- rmtrksession trksessionid
- Remove a track session from the database; see mme_rmtrksession().
- seek_title_chapter
- Seek to a specified title and chapter on a track or mediastore; see mme_seek_title_chapter().
- seektotime milliseconds
- Seek to a time in a playing track; see mme_seektotime().
- set_debug verbose debug
- Set MME debug settings; see mme_set_debug().
- set_api_timeout milliseconds
- Set the API timeout, in milliseconds; see mme_set_api_timeout().
- setautopause 0|1
- Set the autopause mode, where 0=off, 1=on; see mme_setautopause().
- setbalance [outputdeviceid] balance
- Set the ouput balance; see mme_play_set_output_attr().
- set_files_permanent 0|1 fid_select
- Set files as permanent (1) or prunable (0); see mme_set_files_permanent().
- setlocale locale
- Set the preferred language for media with unknown language; see mme_setlocale().
- set_logging [name] verbose flags
- Set the verbosity levels for specified logging modules; see mme_set_logging().
- set_msid_resume_trksession msid
- Set the track session ID to use when resuming playback of a mediastore; see mme_set_msid_resume_trksession().
- setpriorityfolder folderid
- Set a priority folder for synchronization; see mme_setpriorityfolder().
- setrandom mode
- Set the random playback mode, where mode can be 0=off, 1=all, 2=albums; see mme_setrandom().
- setrepeat mode
- Set the repeat playback mode, where mode can be 0=off, 1=single, 2=all; see mme_setrepeat().
- setscanmode milliseconds
- Set the scan mode and time; see mme_setscanmode().
- settrksession trksessionid
- Set the current track session; see mme_settrksession().
- setvolume [outputdeviceid] volume
- Set the output volume; see mme_play_set_output_attr().
- shutdown
- Shut down the MME; see mme_shutdown().
- start_device_detection
- Start device and mediastore detection; see mme_start_device_detection().
- stop
- Stop playback; see mme_stop().
- sync_cancel msid
- Cancel mediastore synchronization for the specified mediastore. If msid=0, synchronization is cancelled for all mediastores. See mme_sync_cancel().
- sync_directed msid path passmask [recurse]
- Start a directed synchronization. If recurse=1, a recursive synchronization is performed. See mme_sync_directed().
- sync_file old_fid new_msid [filename]
- Synchronize a specified file; see mme_sync_file.
- sync_get_status msid
- Get the status for the specified msid, or for all mediastores if msid=0; see mme_sync_get_msid_status() and mme_sync_get_status().
- timebase_set
- Set the database time values to increase monotonically; see mme_timebase_set().
- trksession_append_files
- Append tracks to a file-based track session; see mme_trksession_append_files().
- trksession_get_info
- Get information about the current track session; see mme_trksession_get_info().
- trksession_resume_state
- Resume playing a track session at the last saved position; see mme_trksession_resume_state().
- trksession_save_state
- Save the playing position of the current track session; see mme_trksession_save_state().
- trksessionview_get_current
- Get information about the current track in the track session; see mme_trksession_get_current().
- trksessionview_get_info track title
- Get information about the specified track in the track session; see mme_trksession_get_info().
- trksessionview_metadata_get track title types
- Get metadata for a track in a track session; see trksessionview_metadata_get().
- trksessionview_read [offset] [nfids] [type]
- Update the information in the trksessionview table; see mme_trksessionview_readx().
- The type option determines the type of track session to read. Omit the option or set it to 0 (zero) for library-based track sessions (the default); or set it to 1 (one) for file-based track sessions.
- trksessionview_update track title
- Update the information in the trksessionview table; see mme_trksessionview_update().
- trksessionview_writedb
- Write the MME track session view to the database; see mme_trksessionview_writedb().
- video_get_angle_info title
- Get the video angle; see mme_video_get_angle_info().
- video_get_audio_info title
- Get the audio information for video playback; see mme_video_get_audio_info()
- video_get_info
- Get information about a video; see mme_video_get_info().
- video_get_status
- Get the video status; see mme_video_get_status().
- video_get_subtitle_info title
- Get subtitle information for a video title; see mme_video_get_subtitle_info().
- video_set_angle_info title index
- Set the video angle; see mme_video_set_angle().
- video_set_audio title index
- Set the audio stream for video playback; see mme_video_set_audio().
- video_set_subtitle title index
- Set the subtitle for video playback; see mme_video_set_subtitle().
- zone_create name
- Create an output zone; see mme_zone_create().
- zone_delete zoneid
- Delete an output zone; see mme_zone_delete().
This is an example shell script that uses the mmecli script mode to play all the available media (you will need to change /path_to/mmecli to the path to mmecli on your system):
#!/path_to/mmecli -s
.echo "START: play all script"
.echo "Creating new track session"
.flushevents
newtrksession l 'SELECT fid FROM library ORDER BY fid'
settrksession %t
.waitforevent +TRKSESSION
.echo "BEGIN: Testing .setint"
.setint 0 %t
.echo "END: Register 0 == %r0"
.echo "BEGIN: Playing at beginning"
play 0
# track change is ok, play error is not
.waitforevent +TRACKCHANGE -PLAY_ERROR
getfid
.echo "Playing fid %f"
.echo "Verifying that fid %f is in the nowplaying table"
.qdb_require_rows "SELECT fid FROM nowplaying WHERE fid=%f AND ccid=%c;"
.echo "Metadata for currently playing track"
.qdb "SELECT * FROM nowplaying WHERE ccid=%c;"
.echo "STOP: done play all script"
mme,
mmexplore,
mmplexplore