Squeezeplayer Menus¶
-
exception
LMSTools.menu.
LMSMenuException
¶ Simple exception class for handling errors in the LMSMenuHandler.
-
class
LMSTools.menu.
LMSMenuHandler
(player=None)¶ Parameters: player (LMSPlayer) – instance of LMSPlayer. Class for generating squeezeplayer menu for individual players.
This code is a work in progress and currently has limited functionality.
Menus can be requested via the getHomeMenu or getCustomMenu methods. Subsequent menus are generated by getting the menu command from previous menus and passing it to the getMenu method.
If no player is set when the handler is initiated then it must be set before requesting menus.
-
changePlayer
(player)¶ Parameters: player (LMSPlayer) – instance of LMSPlayer. Change the player for which the menu is being created.
While this may have little relevance on retrieiving menus, it is important if you wish to manipulate the playlist or other player specific items directly from the menu.
-
dump
(menu, filename)¶ Parameters: - menu (dict) – raw json menu
- filename (str) – name of file to save menu
Save the supplied menu to file (useful for debugging purposes).
-
getCustomMenu
(raw)¶ Parameters: raw (dict) – custom menu format (see docs for example) Return type: list Returns: list of menu items Generate menu items from a custom menu.
This can be useful if you want to create a tailored menu rather than use the full default menu generated by the server.
-
getHomeMenu
()¶ Return type: list Returns: list of menu items Generate menu items from default menu.
-
getMenu
(menucmd)¶ Parameters: menucmd (str, list) – command to request next menu from server Return type: list Returns: list of menu items Generate menu from the supplied menu command.
-
-
class
LMSTools.menuitems.
AudioMenuItem
(player=None, menuitem=None, base=None)¶ Audio menu item. Basically the same as a playlist.
-
add
()¶ Add the selected item to your playlist.
-
cmd_add
¶ Return type: str Returns: command string to add selected item to playlist
-
cmd_play
¶ Return type: str Returns: command string to play selected item
-
cmd_play_next
¶ Return type: str Returns: command string to play selected item after currently playing item
-
go
()¶ Return type: list Returns: command list for submenu Go to submenu i.e. list of tracks in playlist.
-
play
()¶ Play the selected item.
-
play_next
()¶ Play the selected item after the currently playing item.
-
show_items_cmd
¶ Return type: str Returns: command string to show submenu items
-
-
class
LMSTools.menuitems.
NextMenuItem
(player=None, menuitem=None, base=None)¶ Menu item which has no other purpose than to create a new submenu.
-
cmd
¶ Return type: str Returns: command string for next menu Get command string for submenu.
-
-
class
LMSTools.menuitems.
PlaylistMenuItem
(player=None, menuitem=None, base=None)¶ A playlist menu item is one that can be played directly from this link but can also provide a submenu of all the tracks in the playlist.
-
add
()¶ Add the selected item to your playlist.
-
cmd_add
¶ Return type: str Returns: command string to add selected item to playlist
-
cmd_play
¶ Return type: str Returns: command string to play selected item
-
cmd_play_next
¶ Return type: str Returns: command string to play selected item after currently playing item
-
go
()¶ Return type: list Returns: command list for submenu Go to submenu i.e. list of tracks in playlist.
-
play
()¶ Play the selected item.
-
play_next
()¶ Play the selected item after the currently playing item.
-
show_items_cmd
¶ Return type: str Returns: command string to show submenu items
-
-
class
LMSTools.menuitems.
SearchMenuItem
(player=None, menuitem=None, base=None)¶ Menu item where a search term is required.
-
cmd_search
¶ Return type: str Returns: raw command string You will need to replace __TAGGEDINPUT__ with your search term before building a menu with this command.
-
search
(query)¶ Parameters: query (str) – search terms Return type: list Returns: command to generate search results
-