# LuaBee Functions

## Playback functions:

```
number Position = GetPosition()
```

Gets the second of playback of the current file.

```
bool Success = SetPosition(number: seconds)
```

Sets the second of playback of the current file.

```
bool ShuffleState = GetShuffle()
```

Gets the shuffle state.

```
bool Result = SetShuffle(bool: status)
```

Sets the shuffle state.

```
bool AutoDJEnabled = GetAutoDJ()
```

Gets the ***`AUTO-DJ`*** state.

```
bool Muted = GetMute()
```

Gets the mute state.

```
bool Result = SetMute(bool: enable)
```

Sets the mute state.

```
PlayTrackURL(string: file/url)
```

Plays track by URL or filename.

```
SetPlayState(string: state)
```

Sets play state for current playing track view [play state constants](https://lainez.gitbook.io/luabee/untitled#playback-states) for list of available constants.

**These functions bellow added in 1.1.1 version and will not work on earlier versions:**

```
SetAutoDJ(bool: state)
```

Sets ***`AUTO-DJ`*** state

## File operation functions

```
table Files = GetFileList(string: rule)
```

Gets the file list by rule e.g `GetFileList("domain=Library")`.

```
string tag = GetFileTag(string: file, string: metadataConstant)
```

Gets the tag values from filename see [metadata constants](https://lainez.gitbook.io/luabee/untitled#metadata) for list of available constants.

```
bool result = CommitTagIntoFile(string: file)
```

Commits changes into file made using the function `SetFileTag`

```
SetFileTag(string: file, string: metadataConstant, string: value)
```

Sets tag value in track by file. see [metadata constants](https://lainez.gitbook.io/luabee/untitled#metadata) for list of available constants.

## GUI Functions

```
AddElementInContextMenu(string: address, string: name, function: handler)
```

Adds element in context menu.

## Playlist functions

**These functions bellow added in 1.2.1 version and will not work on earlier versions:**

```
bool result = CreatePlaylist(string: playlistfilename, string: playlistName, table: filenames)
```

Creates playlist.

```
bool result = PlaylistSetFiles(string: playlistfilename, table: filenames)
```

Override all playlist file index.

```
bool result = RemoveFileFromPlaylist(string: filename, number: index)
```

Removes file from playlist by index.

```
bool result = DeletePlaylist(string: filename)
```

Removes playlist from disk
