diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-11-21 13:49:47 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-11-21 13:49:47 +1100 |
| commit | d70ec9bf447f7a46e347c3bc5ad58fd88aff46a2 (patch) | |
| tree | ab75c1663934d7408fad36d134a0cfd4f4cb089b /src/lua/stubs | |
| parent | f34b6405884c4073158c3f36158c6351fa135a0f (diff) | |
| download | tangara-fw-d70ec9bf447f7a46e347c3bc5ad58fd88aff46a2.tar.gz | |
Add lua functions to get database content
Diffstat (limited to 'src/lua/stubs')
| -rw-r--r-- | src/lua/stubs/database.lua | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/lua/stubs/database.lua b/src/lua/stubs/database.lua new file mode 100644 index 00000000..97359ab1 --- /dev/null +++ b/src/lua/stubs/database.lua @@ -0,0 +1,59 @@ +--- Module for accessing and updating data about the user's library of tracks. +-- @module database + +local database = {} + +--- Returns a list of all indexes in the database. +-- @treturn Array(Index) +function database.indexes() end + +--- An iterator is a userdata type that behaves like an ordinary Lua iterator. +-- @type Iterator +local Iterator = {} + +--- A TrackId is a unique identifier, representing a playable track in the +--- user's library. +-- @type TrackId +local TrackId = {} + +--- A record is an item within an Index, representing some value at a specific +--- depth. +-- @type Record +local Record = {} + +--- Gets the human-readable text representing this record. The `__tostring` +--- metatable function is an alias of this function. +-- @treturn string +function Record:title() end + +--- Returns the value that this record represents. This may be either a track +--- id, for records which uniquely identify a track, or it may be a new +--- Iterator representing the next level of depth for the current index. +--- +--- For example, each Record in the "All Albums" index corresponds to an entire +--- album of tracks; the 'contents' of such a Record is an iterator returning +--- each track in the album represented by the Record. The contents of each of +--- the returned 'track' Records would be a full Track, as there is no further +--- disambiguation needed. +-- @treturn TrackId|Iterator(Record) +function Record:contents() end + +--- An index is heirarchical, sorted, view of the tracks within the database. +--- For example, the 'All Albums' index contains, first, a sorted list of every +--- album name in the library. Then, at the second level of the index, a sorted +--- list of every track within each album. +-- @type Index +local Index = {} + +--- Gets the human-readable name of this index. This is typically something +--- like "All Albums", or "Albums by Artist". The `__tostring` metatable +--- function is an alias of this function. +-- @treturn string +function Index:name() end + +--- Returns a new iterator that can be used to access every record within the +--- first level of this index. +-- @treturn Iterator(Record) +function Index:iter() end + +return database |
