Welcome to Squeezebox Controller’s documentation!

Squeezeboxes can be controlled via a Squeezebox Server using the SqueezeboxController class in the squeezebox_controller package documented below.

squeezebox_controller package

Module contents

class squeezebox_controller.SqueezeBoxController(server_ip, server_port=9000, playername_cleanup_func=None, default_player=None, request_lib=<module 'requests' from '/home/docs/checkouts/readthedocs.org/user_builds/squeezebox-controller/envs/latest/lib/python2.7/site-packages/requests/__init__.pyc'>)
add_custom_command(name, func, player_details_cached=True)

Set a function as a named custom command.

Set a named custom command to be invoked with a called to custom_command. The function will receive a helper object as specified and the possible runtime arguments.
Args:
name: string, func: (helper_obj, details) -> Unit, player_details_cached: boolean - if the input details is a dictionary, cache the value with key: player
helper_obj:
Is an dictionary with the following contents… “make_request”: (mac: string, command: [string]) -> Unit, “get_player_info”: (mac: string) -> JSON, “requests”: library object, “base_url”: string, “player_lookup”: dict[string] -> string

details: [optional] the parameter object to pass to the called custom function.

cached_player = None
custom_command(name, details=None)

Run named custom command

Args:
name: string details - passed to custom command
search_and_play(details, *args)

Plays the specified music

Searches for the specified music and loads it on the specified squeezebox

Args:
details: {“player”: string, “term”: string, “type”: string}
  • term is the string to search for
  • type is the search mode: one of search_types.keys()
search_and_play_end(details, *args)

Plays the specified music at end.

Searches for the specified music and loads it on to the end of the specified squeezebox’s playlist.

Args:
details: {“player”: string, “term”: string, “type”: string}
  • term is the string to search for
  • type is the search mode: one of search_types.keys()
search_and_play_next(details, *args)

Plays the specified music next

Searches for the specified music and loads it to play next on the specified squeezebox.

Args:
details: {“player”: string, “term”: string, “type”: string}
  • term is the string to search for
  • type is the search mode: one of search_types.keys()
send_music(details, *args)

Sends music from one squeezebox to another

Sends whatever is playing on the source to the destination squeezebox

Args:
details: {“player”: string, “other”: string, “direction”: string}
  • direction is either TO or FROM
set_volume(details, *args)

Sets volume at specified level

Sets the volume of the specified squeezebox at the specified level

Args:
details: {“player”: string, “percent”: string}
  • percent is 0 to 100
simple_command(details, *args)

Sends a simple squeezebox commands

Sends one of the fixed commands to the specified squeezebox

Args:
details: {“player”: string, “command”: string}
  • player is the player’s name
  • command is one of commands.keys()
simple_query(details, *args)

Performs a simple query on a squeezebox

Performs one of the fixed queries on the specified squeezebox

Args:
details: {“player”: string, “query”: string}
  • query is one of queries.keys()
sleep_in(details, *args)

Sleeps the player after a delay

Sets the specified squeezebox to sleep after the specified time

Args:
details: {“player”: string, “time”: string}
  • time is number of minutes
sync_player(details, *args)

Sends music from one squeezebox to another

Sends whatever is playing on the source to the destination squeezebox

Args:
details: {“player”: string, “other”: string}
exception squeezebox_controller.UserException

Bases: exceptions.Exception

Submodules

This is used within the module to complete the search functionality but can also be used externally if needed.

squeezebox_controller.string_distance module

squeezebox_controller.string_distance.dist(a, b)

Calculates similarity heuristic

Based on edit distance with extras and shortcurts to speed up.

IS reflexive NOT symetric or transistive DOESN’T satisfy triangle property ISN’T always > 0

strings get rewards for identical sequences (polynomial with length) strings get penalities (logarithmic with length) for having to add, subtract or swap character blocks to match target. strings also get (smaller) penalities (logarithmic with length) for transposing blocks to match target.

squeezebox_controller.string_distance.enumerate_regex(regex)
squeezebox_controller.string_distance.try_match(input, options, threshold=5)