lua: update API README

The LUA API has changed a little. Update README accordingly.

Signed-off-by: Thomas Guillem <thomas@gllm.fr>
This commit is contained in:
Romain Vimont 2019-02-18 14:58:19 +01:00 committed by Thomas Guillem
parent 3159dad5eb
commit 3b46a2c42c
1 changed files with 44 additions and 15 deletions

View File

@ -108,11 +108,11 @@ h:handler( url, user, password, callback, data ) -- add a handler for given url.
h:file( url, mime, user, password, callback, data ) -- add a file for given url with given mime type. If user and password are non nil, they will be used to authenticate connecting clients. callback will be called to handle connections. The callback function takes 2 arguments: data and request. It returns the reply as a string.
h:redirect( url_dst, url_src ): Redirect all connections from url_src to url_dst.
Input
-----
input.is_playing(): Return true if input exists.
input.add_subtitle(url): Add a subtitle file (by path) to the current input
input.item(): Get the current input item. Input item methods are:
Player
------
player.is_playing(): Return true if input exists.
player.add_subtitle(url): Add a subtitle file (by path) to the current input
player.item(): Get the current input item. Input item methods are:
:uri(): Get item's URI.
:name(): Get item's name.
:duration(): Get item's duration in seconds or negative value if unavailable.
@ -138,6 +138,40 @@ input.item(): Get the current input item. Input item methods are:
.send_bitrate
.played_abuffers
.lost_abuffers
player.get_time(): Get the current time, in microseconds
player.get_position(): Get the current position, as a float between 0 and 1
player.get_rate(): Get the playing rate
player.set_rate(f): Set the playing rate
player.increment_rate(): Increment rate by 1 step
player.decrement_rate(): Decrement rate by 1 step
player.get_video_tracks(): Get the list of video tracks. Each item contains:
.id: the track id
.name: the track name
.selected: a boolean indicating whether the track is currently selected
player.get_audio_tracks(): Get the list of audio tracks (items have the same format as in get_video_tracks())
player.get_spu_tracks(): Get the list of SPU tracks (items have the same format as in get_video_tracks())
player.toggle_video_track(): Select/deselect a video track
player.toggle_audio_track(): Select/deselect an audio track
player.toggle_audio_track(): Select/deselect an SPU track
player.get_titles_count(): Get the number of titles for the current media
player.get_title_index(): Get the current title index
player.title_prev(): Go to the previous title
player.title_next(): Go to the next title
player.title_goto(i): Go to title at index i
player.get_chapters_count(): Get the number of chapter for the current title
player.get_chapter_index(): Get the current chapter index
player.chapter_prev(): Go to the previous chapter
player.chapter_next(): Go to the next chapter
player.chapter_goto(i): Go to chapter at index i
player.next_video_frame(): Go to the next video frame
player.seek_by_pos_absolute(f): Seek to an absolute position (a float between 0 and 1)
player.seek_by_pos_relative(f): Seek the position by a relative amount
player.seek_by_time_absolute(us): Seek to an absolute time (in microseconds)
player.seek_by_time_relative(us): Seek the time by a relative amount (in microseconds)
player.get_audio_delay(): Get the audio delay, as a float in seconds
player.set_audio_delay(s): Set the audio delay, as a float in seconds
player.get_subtitle_delay(): Get the subtitle delay, as a float in seconds
player.set_subtitle_delay(s): Set the subtitle delay, as a float in seconds
Input/Output
------------
@ -231,7 +265,7 @@ net.opendir( path ): List a directory's contents.
Objects
-------
object.input(): Get the current input object.
object.player(): Get the player object.
object.playlist(): Get the playlist object.
object.libvlc(): Get the libvlc object.
object.aout(): Get the audio output object.
@ -260,8 +294,11 @@ playlist.play(): Play.
playlist.pause(): Pause.
playlist.stop(): Stop.
playlist.clear(): Clear the playlist.
playlist.get_repeat(): Get current repeat mode.
playlist.repeat_( [status] ): Toggle item repeat or set to specified value.
playlist.get_loop(): Get current loop mode.
playlist.loop( [status] ): Toggle playlist loop or set to specified value.
playlist.get_random(): Get current random mode.
playlist.random( [status] ): Toggle playlist random or set to specified value.
playlist.goto( id ): Go to specified track.
playlist.add( ... ): Add a bunch of items to the playlist.
@ -316,9 +353,8 @@ playlist.get( [what, [tree]] ): Get the playlist.
.path:
.duration: (-1 if unknown)
.nb_played:
.children: A table of children playlist items.
playlist.search( name ): filter the playlist items with the given string
playlist.current(): return the current playlist item id
playlist.current_item(): return the current playlist item (same structure as player.item())
playlist.sort( key ): sort the playlist according to the key.
Key must be one of the followings values: 'id', 'title', 'title nodes first',
'artist', 'genre', 'random', 'duration',
@ -333,13 +369,6 @@ FIXME: add methods to get an item's meta, options, es ...
Services discovery
------------------
Interfaces and extensions can use the following SD functions:
sd.get_services_names(): Get a table of all available service discovery
modules. The module name is used as key, the long name is used as value.
sd.add( name ): Add service discovery.
sd.remove( name ): Remove service discovery.
Services discovery scripts can use the following SD functions:
sd.add_node( ... ): Add a node to the service discovery.