Developer Documentation

The documentation in this section describes the internal workings of Troi. Developers wishing to use Troi shouldn’t need to know about these modules, but if you wish to extend the core functionality of Troi, this documentation is for you!

Note: There are some modules in troi directory that are not covered here – those are important for end users, so thos are defined in the main section of our docs.

troi.cli

This module is the entry point for the troi command line interface.

troi.core

Troi core module that creates and executes the patches:

troi.patch

Troi patch class definition:

troi.playlist

Troi playlist class that creates and serializes playlists:

troi.print_recording

Debugging module for printing out the information associated with recordings:

class troi.print_recording.PrintRecordingList

Print a list of recordings in a sane matter intended to fit on a reasonably sized screen. It prints recording name and artist name always, and year, bpm, listen_count or moods if they are found in the first recording.

print(entity)

Print out a list(Recording) or list(Playlist).

troi.utils

Misc functions needed to run troi:

troi.utils.discover_patches()

Attempt to load patches from the installed patches dir as well as any patches directory in the current dir.

troi.utils.discover_patches_from_dir(module_path, patch_dir, add_dot=False)

Load patches given the appropriate python module path and then file system path. If add_dot = True, add . to the sys.path and then remove it before this function exists.

troi.utils.interleave(lists)

Return a list with all items from the given lists.

troi.utils.recursively_update_dict(source, overrides)

Updates the source dictionary in place and in a recursive fashion. That is unlike dict1.update(dict2) which would simply replace values of keys even in case one of the values is dict, this method will attempt to merge the nested dicts.

Eg: dict1 - {“a”: {“b”: 1}}, dict2 - {“a”: {“c”: 2}} dict1.update(dict2) - {“a”: {“c”: 2}} recursively_update_dict(dict1, dict2) - {“a”: {“b”: 1, “c”: 2}}