### Show Installed Mopidy Dependencies Source: https://docs.mopidy.com/latest/_sources/troubleshooting.rst This snippet shows how to list the paths and versions of all dependencies required by Mopidy and its extensions. This is useful for verifying correct versions and installations, applicable for both manual and system service Mopidy setups. ```Shell mopidy deps ``` ```Shell sudo mopidyctl deps ``` -------------------------------- ### Install Mopidy-Spotify Extension on Fedora Source: https://docs.mopidy.com/latest/installation/fedora This command installs the Mopidy-Spotify extension from the RPMFusion-nonfree repository using DNF, allowing Mopidy to integrate with Spotify. ```bash sudo dnf install mopidy-spotify ``` -------------------------------- ### List Installed Mopidy Dependencies Source: https://docs.mopidy.com/latest/troubleshooting This command provides a list of paths and versions for all dependencies required by Mopidy and its extensions. It is crucial for verifying correct versions and installations, especially when multiple versions of a dependency exist on the system. ```Shell mopidy deps ``` ```Shell sudo mopidyctl deps ``` -------------------------------- ### Install Mopidy Core and Dependencies on Fedora Source: https://docs.mopidy.com/latest/installation/fedora This command installs the core Mopidy package and its dependencies, including Mopidy-MPD, from the standard Fedora repositories using the DNF package manager. ```bash sudo dnf install mopidy ``` -------------------------------- ### Install Graphviz for Documentation Generation Source: https://docs.mopidy.com/latest/devenv Install the Graphviz package using apt, required for generating certain graphs within the Sphinx documentation. ```Shell sudo apt install graphviz ``` -------------------------------- ### Install Graphviz for Documentation Graph Generation Source: https://docs.mopidy.com/latest/_sources/devenv.rst Command to install the Graphviz package, which is required to generate certain graphs within the Mopidy documentation. This example uses APT for Debian/Ubuntu systems. ```Shell sudo apt install graphviz ``` -------------------------------- ### Add RPMFusion Repositories to Fedora Source: https://docs.mopidy.com/latest/installation/fedora To access additional Mopidy extensions packaged in RPMFusion, run this command to install both the free and non-free RPMFusion repositories on your Fedora system. ```bash sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm ``` -------------------------------- ### Install Mopidy Extensions Globally from PyPI Source: https://docs.mopidy.com/latest/installation/fedora If a desired Mopidy extension is not available in DNF or RPMFusion repositories, this generic command can be used to install it globally from the Python Package Index (PyPI) using pip. ```bash sudo python3 -m pip install ... ``` -------------------------------- ### Install Mopidy and Dependencies on Debian/Ubuntu Source: https://docs.mopidy.com/latest/installation/debian These commands first update your local package lists to reflect the newly added Mopidy repository, and then proceed to install the Mopidy package along with all its necessary dependencies. This completes the core Mopidy installation process. ```Shell sudo apt update sudo apt install mopidy ``` -------------------------------- ### Install GStreamer and Python Bindings on Fedora Source: https://docs.mopidy.com/latest/installation/pypi Install GStreamer, its plugins, and Python bindings on Fedora Linux, along with Cairo development headers. This setup is essential for Mopidy's audio processing capabilities. ```Shell sudo dnf install -y \ cairo-devel \ gobject-introspection-devel \ python3-gstreamer1 \ gstreamer1-plugins-good \ gstreamer1-plugins-ugly-free ``` -------------------------------- ### Install Build Tools and Python Pip Source: https://docs.mopidy.com/latest/_sources/installation/pypi.rst These commands install essential build tools, Python development headers, and the pip package installer. These are crucial prerequisites for compiling some Mopidy extensions and managing Python packages. ```bash sudo apt install build-essential python3-dev python3-pip ``` ```bash sudo pacman -S base-devel python-pip ``` ```bash sudo dnf install -y gcc python3-devel python3-pip ``` -------------------------------- ### Start Mopidy Service with Homebrew Services Source: https://docs.mopidy.com/latest/_sources/running/service.rst This command starts the Mopidy service using Homebrew's `brew services` utility, ensuring it launches at login and restarts automatically. This is the recommended method for Homebrew installations on macOS. ```Bash brew services start mopidy/mopidy/mopidy ``` -------------------------------- ### Install Mopidy Development Tools Source: https://docs.mopidy.com/latest/devenv These commands navigate into the Mopidy repository and install the development-specific dependencies. The `.[dev]` syntax tells pip to install the extra dependencies defined in the `pyproject.toml` file under the 'dev' group, providing tools necessary for Mopidy development. ```Shell cd ~/mopidy-dev/mopidy/ pip install --upgrade --editable ".[dev]" ``` -------------------------------- ### Mopidy-File Configuration Example Source: https://docs.mopidy.com/latest/ext/file Illustrates the configuration settings for the Mopidy-File extension, including enabling the extension, defining media directories, and setting preferences for file visibility and scanning behavior. ```INI [file] enabled = true media_dirs = $XDG_MUSIC_DIR|Music ~/|Home show_dotfiles = false excluded_file_extensions = .directory .html .jpeg .jpg .log .nfo .pdf .png .txt .zip follow_symlinks = false metadata_timeout = 1000 ``` -------------------------------- ### Install GStreamer and Python Bindings on Gentoo Source: https://docs.mopidy.com/latest/installation/pypi Install GStreamer components, Python bindings, and Cairo on Gentoo using `emerge`. Users should pay attention to USE flags for `gst-plugins-meta` to ensure desired audio plugins like ALSA or MP3 are included. ```Shell emerge -av \ dev-libs/gobject-introspection \ dev-python/gst-python \ media-plugins/gst-plugins-meta \ x11-libs/cairo ``` -------------------------------- ### Mopidy-Stream Configuration Example Source: https://docs.mopidy.com/latest/ext/stream Example configuration for the Mopidy-Stream extension, showing how to enable it, define allowed streaming protocols, set a metadata lookup timeout, and blacklist URIs for metadata fetching. ```Config [stream] enabled = true protocols = http https mms rtmp rtmps rtsp timeout = 5000 metadata_blacklist = ``` -------------------------------- ### Install GStreamer and Python Bindings Source: https://docs.mopidy.com/latest/_sources/installation/pypi.rst These commands install GStreamer (version 1.22.0 or newer) along with its 'good' and 'ugly' plugin sets and Python bindings. Development headers for libcairo2 and libgirepository1.0 are also included, which are necessary for building Python bindings from source. ```bash sudo apt install \ gir1.2-gst-plugins-base-1.0 \ gir1.2-gstreamer-1.0 \ gstreamer1.0-plugins-good \ gstreamer1.0-plugins-ugly \ gstreamer1.0-tools \ libcairo2-dev \ libgirepository1.0-dev \ python3-gst-1.0 ``` ```bash sudo pacman -S \ cairo \ gobject-introspection \ gst-python \ gst-plugins-good \ gst-plugins-ugly ``` ```bash sudo dnf install -y \ cairo-devel \ gobject-introspection-devel \ python3-gstreamer1 \ gstreamer1-plugins-good \ gstreamer1-plugins-ugly-free ``` ```bash emerge -av \ dev-libs/gobject-introspection \ dev-python/gst-python \ media-plugins/gst-plugins-meta \ x11-libs/cairo ``` ```bash brew install \ cairo \ gobject-introspection \ gst-python \ gst-plugins-base \ gst-plugins-good \ gst-plugins-ugly ``` -------------------------------- ### Install Mopidy Extensions Source: https://docs.mopidy.com/latest/_sources/installation/pypi.rst These commands demonstrate how to install Mopidy extensions, such as 'Mopidy-MPD', from PyPI using pip. The first command is for virtual environment installation, and the second is for global system-wide installation, ensuring compatibility with system packages. ```bash python3 -m pip install Mopidy-MPD ``` ```bash sudo python3 -m pip install --break-system-packages Mopidy-MPD ``` -------------------------------- ### Start Mopidy Music Server Source: https://docs.mopidy.com/latest/command Basic command to start the Mopidy music server. ```Shell mopidy ``` -------------------------------- ### Discover GStreamer Metadata for a File Source: https://docs.mopidy.com/latest/troubleshooting This command uses GStreamer's `gst-discoverer-1.0` tool to inspect audio metadata. It can be installed via `sudo apt install gstreamer1.0-plugins-base-apps`. This tool is helpful for comparing Mopidy's metadata output and diagnosing GStreamer-related metadata reading issues. ```shell gst-discoverer-1.0 path_to_your_file ``` -------------------------------- ### Start Mopidy with Multiple Command-Line Option Overrides Source: https://docs.mopidy.com/latest/command Demonstrates how to apply multiple configuration overrides directly from the command line using repeated `--option` flags. ```Shell mopidy -o mpd/enabled=false -o spotify/bitrate=320 ``` -------------------------------- ### Install Build Tools and Pip on Fedora Source: https://docs.mopidy.com/latest/installation/pypi Install the GCC compiler, Python 3 development headers, and pip on Fedora Linux. These are prerequisites for installing Mopidy and its extensions, enabling compilation of necessary components. ```Shell sudo dnf install -y gcc python3-devel python3-pip ``` -------------------------------- ### Install Build Tools and Pip on Arch Linux Source: https://docs.mopidy.com/latest/installation/pypi Install base development tools and the pip package installer on Arch Linux from the official repository. This step provides the necessary environment for Mopidy and its extensions. ```Shell sudo pacman -S base-devel python-pip ``` -------------------------------- ### Clone Mopidy Extension Git Repository Source: https://docs.mopidy.com/latest/devenv Clone a Mopidy extension's Git repository, for example, Mopidy-Spotify, into the development workspace. ```Shell git clone https://github.com/mopidy/mopidy-spotify.git ``` -------------------------------- ### Run Ruff Linter via Tox Source: https://docs.mopidy.com/latest/devenv Execute the Ruff linter using the Tox environment, mimicking the CI setup for Mopidy projects. ```Shell tox -e ruff ``` -------------------------------- ### Basic Mopidy Configuration Example Source: https://docs.mopidy.com/latest/config Illustrates a minimal Mopidy configuration file (`mopidy.conf`) with basic MPD and Scrobbler settings. This example shows how to set the MPD hostname and Scrobbler username/password. ```ini [mpd] hostname = :: [scrobbler] username = alice password = mysecret ``` -------------------------------- ### Install GStreamer and Python Bindings on Debian/Ubuntu Source: https://docs.mopidy.com/latest/installation/pypi Install GStreamer 1.22.0+, its good and ugly plugins, tools, and Python 3 bindings on Debian/Ubuntu. This command also installs development headers for Cairo and GObject Introspection, which are crucial for building Python bindings from source. ```Shell sudo apt install \ gir1.2-gst-plugins-base-1.0 \ gir1.2-gstreamer-1.0 \ gstreamer1.0-plugins-good \ gstreamer1.0-plugins-ugly \ gstreamer1.0-tools \ libcairo2-dev \ libgirepository1.0-dev \ python3-gst-1.0 ``` -------------------------------- ### Search for Mopidy Extensions via APT Source: https://docs.mopidy.com/latest/installation/debian This command allows you to search for available Mopidy extensions within the APT package repositories that have been configured on your system. It helps identify extensions that can be easily installed using the `apt install` command. ```Shell apt search mopidy ``` -------------------------------- ### Run Mopidy Server Source: https://docs.mopidy.com/latest/devenv This command starts the Mopidy server from the command line. It assumes the virtual environment is activated. To stop the server, press Ctrl+C. ```Shell mopidy ``` -------------------------------- ### Install GStreamer and Python Bindings on macOS with Homebrew Source: https://docs.mopidy.com/latest/installation/pypi Install GStreamer, its plugins, Python bindings, and Cairo on macOS using Homebrew. This provides the necessary audio backend and dependencies for Mopidy on Apple systems. ```Shell brew install \ cairo \ gobject-introspection \ gst-python \ gst-plugins-base \ gst-plugins-good \ gst-plugins-ugly ``` -------------------------------- ### Install Mopidy Extension Globally using pip Source: https://docs.mopidy.com/latest/installation/pypi This command installs a Mopidy extension globally on the system. It requires superuser privileges (`sudo`) and uses the `--break-system-packages` flag to allow installation into system directories, which is often necessary on modern Linux distributions but should be used with caution. ```bash sudo python3 -m pip install --break-system-packages Mopidy-MPD ``` -------------------------------- ### Install Mopidy via Homebrew Source: https://docs.mopidy.com/latest/installation/macos Use this command to install the Mopidy music server and its core dependencies, including GStreamer, directly from the Homebrew tap. ```Shell brew install mopidy ``` -------------------------------- ### Install GStreamer and Python Bindings on Arch Linux Source: https://docs.mopidy.com/latest/installation/pypi Install GStreamer components, Python bindings, and Cairo on Arch Linux from the official repository. These packages provide the necessary audio backend and dependencies for Mopidy's functionality. ```Shell sudo pacman -S \ cairo \ gobject-introspection \ gst-python \ gst-plugins-good \ gst-plugins-ugly ``` -------------------------------- ### Install Mopidy Extension via pip Source: https://docs.mopidy.com/latest/installation/debian This command installs a Mopidy extension directly from PyPI using `pip`. This method is typically used for extensions not found in the APT repositories. The `...` placeholder should be replaced with the actual PyPI package name of the extension. ```Shell sudo python3 -m pip install ... ``` -------------------------------- ### Install Mopidy Extension with Pip Source: https://docs.mopidy.com/latest/devenv Install a Mopidy extension, such as Mopidy-Scrobbler, using pip within the active virtual environment. ```Shell pip install Mopidy-Scrobbler ``` -------------------------------- ### Start Mopidy with Custom Configuration File Source: https://docs.mopidy.com/latest/command Command to start Mopidy, specifying an additional configuration file that can override default settings. ```Shell mopidy --config ./my-config.conf ``` -------------------------------- ### Install Mopidy Extension in Editable Mode Source: https://docs.mopidy.com/latest/devenv Install a Mopidy extension from its local source in editable mode, allowing changes to be reflected without reinstallation. ```Shell pip install --editable . ``` -------------------------------- ### Migrate Project Configuration to setup.cfg Source: https://docs.mopidy.com/latest/_sources/changelog.rst The project's build and dependency configuration has been streamlined by migrating from `requirements.txt` and `setup.py` to a declarative configuration within `setup.cfg`. This centralizes metadata and simplifies project setup. ```INI # Example setup.cfg structure for project configuration [metadata] name = Mopidy version = 3.0.0 [options] packages = find: install_requires = Mopidy-MPD Mopidy-Local [options.entry_points] console_scripts = mopidy = mopidy.main:main ``` -------------------------------- ### Upgrade Mopidy Extension with Pip Source: https://docs.mopidy.com/latest/devenv Upgrade an installed Mopidy extension to its latest version using pip. ```Shell pip install --upgrade Mopidy-Scrobbler ``` -------------------------------- ### Mopidy Extensions: Load All Installed Extensions Source: https://docs.mopidy.com/latest/api/ext Finds and returns a list of all installed Mopidy extensions. Each extension is represented by ExtensionData. ```APIDOC mopidy.ext.load_extensions() Returns: list[ExtensionData] ``` -------------------------------- ### Start Mopidy Application from Git Repository Source: https://docs.mopidy.com/latest/_sources/devenv.rst Starts the Mopidy application from any directory, provided the virtual environment is activated. To stop Mopidy, press `Ctrl+C`. Note that Mopidy must be restarted after any code changes to see them live. ```Shell mopidy ``` -------------------------------- ### List Sphinx Documentation Build Targets Source: https://docs.mopidy.com/latest/devenv Run the Sphinx `make` command to display all available documentation build targets. ```Shell make ``` -------------------------------- ### Install Mopidy in Editable Development Mode Source: https://docs.mopidy.com/latest/devenv This command installs Mopidy from the local Git repository into the active virtual environment in 'editable' mode. The '--editable' flag creates a link to the source code, allowing changes to the source files to take effect immediately without reinstallation, which is crucial for active development. ```Shell pip install --upgrade --editable . ``` -------------------------------- ### Mopidy Extension.setup() Method Requirement Source: https://docs.mopidy.com/latest/history/changelog-0 Highlights the requirement for extensions to implement the `mopidy.ext.Extension.setup()` method, causing early failure if not present. ```APIDOC mopidy.ext.Extension.setup(): Type: Method Requirement: Must be implemented by extensions Behavior: Mopidy will fail early if not implemented ``` -------------------------------- ### Install and Upgrade Mopidy on Arch Linux Source: https://docs.mopidy.com/latest/_sources/installation/arch.rst This snippet demonstrates how to install Mopidy from the 'Community' repository using 'pacman' and how to upgrade it to future releases. ```Shell pacman -S mopidy ``` ```Shell pacman -Syu ``` -------------------------------- ### Open Mopidy Documentation HTML in Browser Source: https://docs.mopidy.com/latest/_sources/devenv.rst Commands to open the locally generated HTML documentation in a web browser. Examples are provided for Linux (xdg-open) and macOS (open). ```Shell xdg-open _build/html/index.html ``` ```Shell open _build/html/index.html ``` -------------------------------- ### Change Directory to Mopidy Documentation Source: https://docs.mopidy.com/latest/devenv Navigate to the Mopidy documentation source directory to build or manage documentation. ```Shell cd ~/mopidy-dev/mopidy/docs/ ``` -------------------------------- ### Example: Format User-Agent String for Mopidy HTTP Requests Source: https://docs.mopidy.com/latest/extensiondev This example demonstrates the usage of `mopidy.httpclient.format_user_agent` to construct a comprehensive User-Agent string. It combines your extension's name and version with Mopidy's details, which is crucial for debugging and usage analysis of HTTP requests. ```Python from mopidy import httpclient import mopidy_soundspot httpclient.format_user_agent( f'{mopidy_soundspot.Extension.dist_name}/' f'{mopidy_soundspot.__version__}' ) ``` -------------------------------- ### Load Mopidy LaunchAgent on macOS Source: https://docs.mopidy.com/latest/running/service This command loads the Mopidy LaunchAgent plist file, starting the Mopidy service immediately on macOS. ```bash launchctl load ~/Library/LaunchAgents/mopidy.plist ``` -------------------------------- ### Start Mopidy Service with Homebrew on macOS Source: https://docs.mopidy.com/latest/running/service This command, suggested by `brew info`, starts the Mopidy service via `brew services` and configures it to restart at login on macOS. ```bash brew services start mopidy/mopidy/mopidy ``` -------------------------------- ### Instantiate Mopidy Frontend for Testing Source: https://docs.mopidy.com/latest/extensiondev This code demonstrates how to start a Mopidy frontend instance for testing. It passes the configuration and the initialized core to the frontend, obtaining a proxy object. Remember that most core and frontend methods return `pykka.ThreadingFuture` objects, requiring `.get()` to retrieve actual values. ```Python self.frontend = frontend.MyFrontend.start(config(), self.core).proxy() ``` -------------------------------- ### Install Mopidy Extensions from Arch User Repository (AUR) Source: https://docs.mopidy.com/latest/installation/arch This command demonstrates how to install Mopidy extensions available in the Arch User Repository (AUR) using the `yay` helper. An example for `mopidy-mpd` is provided. ```bash yay -S mopidy-mpd ``` -------------------------------- ### Mopidy Registry Class API Reference Source: https://docs.mopidy.com/latest/api/ext API documentation for the `mopidy.ext.Registry` class, which serves as a central repository for components provided by Mopidy extensions. It is passed to the `setup()` method of extensions and behaves like a dictionary of string keys and lists. ```APIDOC class mopidy.ext.Registry -> None Description: Registry of components provided by Mopidy extensions. Usage: Passed to the setup() method of all extensions. Can be used like a dict of string keys and lists. ``` -------------------------------- ### Build Sphinx HTML Documentation Source: https://docs.mopidy.com/latest/devenv Generate the HTML version of the Mopidy documentation using Sphinx. ```Shell make html ``` -------------------------------- ### Enable Mopidy Service on Debian Source: https://docs.mopidy.com/latest/running/service This command reconfigures the Mopidy package on Debian systems, enabling its service. It's a one-time setup step. ```bash sudo dpkg-reconfigure mopidy ``` -------------------------------- ### Start Mopidy with Command-Line Option Override Source: https://docs.mopidy.com/latest/command Command to start Mopidy and directly change a configuration value using the `--option` flag. ```Shell mopidy --option mpd/enabled=false ``` -------------------------------- ### Run All Mopidy Tests with Tox Source: https://docs.mopidy.com/latest/devenv This command executes the entire Mopidy test suite using `tox`, mirroring the continuous integration setup. It ensures comprehensive testing across various environments, including linting and documentation checks. This command should be run before pushing changes to GitHub. ```Shell tox ``` -------------------------------- ### Build Mopidy Documentation using Sphinx Source: https://docs.mopidy.com/latest/_sources/devenv.rst Steps to navigate to the documentation directory and build the Mopidy documentation. This includes commands to list available build targets and generate an HTML version. ```Shell cd ~/mopidy-dev/mopidy/docs/ ``` ```Shell make ``` ```Shell make html ``` -------------------------------- ### Enable Mopidy Systemd Service Source: https://docs.mopidy.com/latest/running/service This command enables the Mopidy service to automatically start upon system boot on systems using systemd. ```Shell sudo systemctl enable mopidy ``` -------------------------------- ### List configured Git remotes Source: https://docs.mopidy.com/latest/devenv Displays the fetch and push URLs for all remote repositories configured in the local Git clone. ```bash git remote -v ``` -------------------------------- ### Open Sphinx HTML Documentation Source: https://docs.mopidy.com/latest/devenv Open the generated HTML documentation in a web browser, with commands provided for Linux and OS X. ```Shell xdg-open _build/html/index.html ``` ```Shell open _build/html/index.html ``` -------------------------------- ### Load Mopidy launchd Service on macOS Source: https://docs.mopidy.com/latest/_sources/running/service.rst This command loads the `mopidy.plist` configuration file into `launchctl`, immediately starting the Mopidy service on macOS. This is used when Mopidy is not installed via Homebrew. ```Bash launchctl load ~/Library/LaunchAgents/mopidy.plist ``` -------------------------------- ### Mopidy Core: setup() and teardown() Methods Source: https://docs.mopidy.com/latest/changelog These methods, `mopidy.core.Core.setup()` and `mopidy.core.Core.teardown()`, are internal to the Mopidy Core. As of v3.0.2, they have been explicitly hidden from other actors and JSON-RPC API clients to reinforce their internal-only usage, as they were always documented as such. ```APIDOC mopidy.core.Core.setup() Description: Internal method, hidden from external actors and JSON-RPC API clients. mopidy.core.Core.teardown() Description: Internal method, hidden from external actors and JSON-RPC API clients. ``` -------------------------------- ### API: PlaybackProvider.on_source_setup Method Source: https://docs.mopidy.com/latest/_sources/changelog.rst Introduces a new method, `on_source_setup`, within the `mopidy.backend.PlaybackProvider` class. This method allows backend playback providers to configure GStreamer source properties via the `source-setup` callback. ```APIDOC mopidy.backend.PlaybackProvider.on_source_setup ``` -------------------------------- ### Disable Mopidy Extension in Configuration File Source: https://docs.mopidy.com/latest/config Demonstrates how to disable an installed Mopidy extension without uninstalling it. This is achieved by setting the 'enabled' configuration value to 'false' within the extension's section in the 'mopidy.conf' file. This example specifically shows how to disable the MPD extension. ```ini [mpd] enabled = false ``` -------------------------------- ### Verify GStreamer Installation and Plugins Source: https://docs.mopidy.com/latest/audiosinks This command is used to list all installed GStreamer plugins and features. It's a crucial first step to ensure GStreamer is correctly set up on your system before troubleshooting Mopidy audio issues. The output includes a summary of total plugins and features. ```Shell gst-inspect-1.0 ``` -------------------------------- ### Install Python 3 pip on Debian/Ubuntu Source: https://docs.mopidy.com/latest/installation/debian This command installs `pip`, the standard package installer for Python 3. `pip` is essential if you plan to install Mopidy extensions that are not available through the APT repositories and are instead distributed via PyPI. ```Shell sudo apt install python3-pip ``` -------------------------------- ### Install Mopidy from PyPI Source: https://docs.mopidy.com/latest/_sources/installation/pypi.rst These commands install the latest release of Mopidy from PyPI using pip. The first command is for installation within a Python virtual environment, while the second installs Mopidy globally on your system, handling potential system package conflicts. ```bash python3 -m pip install --upgrade mopidy ``` ```bash sudo python3 -m pip install --upgrade --break-system-packages mopidy ``` -------------------------------- ### Clone Mopidy Git Repository Source: https://docs.mopidy.com/latest/devenv These commands navigate into the Mopidy development workspace and then clone the official Mopidy Git repository from GitHub. This provides access to the Mopidy source code for development and testing. ```Shell cd ~/mopidy-dev/ git clone https://github.com/mopidy/mopidy.git ``` -------------------------------- ### Control Mopidy Service on Debian Source: https://docs.mopidy.com/latest/running/service These commands allow starting, stopping, and restarting the Mopidy service on Debian systems using the `service` command. ```bash sudo service mopidy start ``` ```bash sudo service mopidy stop ``` ```bash sudo service mopidy restart ``` -------------------------------- ### Initialize Mopidy Core for Testing Source: https://docs.mopidy.com/latest/extensiondev This snippet demonstrates how to start a full Mopidy core instance for testing purposes. It configures the core with a backend and obtains a proxy object for direct access to its attributes and methods, which is useful for interacting with the core in tests. ```Python self.core = core.Core.start( config, backends=[get_backend(config)], ).proxy() ``` -------------------------------- ### Pull Latest Changes for Git-Installed Extension Source: https://docs.mopidy.com/latest/devenv Update a Mopidy extension installed from a Git repository by pulling the latest changes. ```Shell cd ~/mopidy-dev/mopidy-spotify/ git pull ``` -------------------------------- ### Mopidy Entry Points Configuration Source: https://docs.mopidy.com/latest/devenv This code block shows the structure of the `entry_points.txt` file, which defines how Mopidy's console script and bundled extensions are registered. It illustrates the mapping between the 'mopidy' executable and its main function, and how various extensions are linked to their respective Python modules, enabling Mopidy to discover and load them. ```INI Configuration [console_scripts] mopidy = mopidy.__main__:main [mopidy.ext] file = mopidy.file:Extension http = mopidy.http:Extension m3u = mopidy.m3u:Extension softwaremixer = mopidy.softwaremixer:Extension stream = mopidy.stream:Extension ``` -------------------------------- ### Get Mopidy Command-Line Help Source: https://docs.mopidy.com/latest/_sources/running/terminal.rst To view all available command-line options and commands for Mopidy, run the `mopidy` command with the `--help` flag. This provides a quick reference directly in the terminal. ```bash mopidy --help ``` -------------------------------- ### Install Mopidy Globally on System Source: https://docs.mopidy.com/latest/installation/pypi Install or upgrade the latest Mopidy release globally on the system using pip. The `--break-system-packages` flag is used to bypass system package protection, allowing direct installation into the global Python environment. ```Shell sudo python3 -m pip install --upgrade --break-system-packages mopidy ``` -------------------------------- ### Install Build Tools and Pip on Debian/Ubuntu Source: https://docs.mopidy.com/latest/installation/pypi Install essential development tools, Python 3 development headers, and the pip package installer on Debian or Ubuntu systems. These packages are required for compiling some Mopidy extensions and managing Python packages. ```Shell sudo apt install build-essential python3-dev python3-pip ``` -------------------------------- ### Install or Upgrade Pykka Dependency Source: https://docs.mopidy.com/latest/history/changelog-0 This command installs or upgrades the Pykka library using pip, the Python package installer. Pykka version 0.12 or higher is a required dependency for Mopidy 0.4.0. This step is necessary if Mopidy is not installed via APT. ```Shell sudo pip install -U Pykka ``` -------------------------------- ### Mopidy Extension Class API Reference Source: https://docs.mopidy.com/latest/api/ext Comprehensive API documentation for the `mopidy.ext.Extension` class, detailing its methods and properties for managing extension configuration, component registration, and environment validation. ```APIDOC class mopidy.ext.Extension Methods: (Unnamed method/property): config (dict[str, dict[str, Any]]): the Mopidy config object Returns: Path (pathlib.Path) get_default_config() -> str Description: The extension’s default config as a text string. Returns: str setup(registry: mopidy.ext.Registry) -> None Description: Register the extension’s components in the extension Registry. Parameters: registry: mopidy.ext.Registry - the extension registry Return type: None validate_environment() -> None Description: Checks if the extension can run in the current environment. Raises: ExtensionError Return type: None Returns: None Properties: version: str Description: The extension’s version. Should match the __version__ attribute on the extension’s main Python module and the version registered on PyPI. ``` ```Python def setup(self, registry): from .backend import SoundspotBackend registry.add('backend', SoundspotBackend) ``` -------------------------------- ### Set Up Mopidy Development Environment Source: https://docs.mopidy.com/latest/history/changelog-0 Provides instructions for developers running Mopidy from a Git clone to properly register bundled extensions. This step is crucial for Mopidy to discover its frontends and backends, and it is highly recommended to perform this within a virtual environment. ```Shell python setup.py develop ``` -------------------------------- ### Install Mopidy Extension in Virtual Environment using pip Source: https://docs.mopidy.com/latest/installation/pypi This command installs a Mopidy extension, such as Mopidy-MPD, into the currently active Python virtual environment. It uses `pip` as a module of `python3` to ensure the correct Python interpreter's pip is used, preventing conflicts with system-wide installations. ```bash python3 -m pip install Mopidy-MPD ``` -------------------------------- ### Mopidy-M3U Configuration Parameters Reference Source: https://docs.mopidy.com/latest/ext/m3u Detailed reference for each configuration parameter available in the Mopidy-M3U extension. It covers settings like enabling the extension, specifying playlist and base directories, default encoding for M3U files, and the default file extension for newly created playlists. ```APIDOC m3u/enabled: Description: If the M3U extension should be enabled or not. m3u/playlists_dir: Description: Path to directory with M3U files. Unset by default, in which case the extension’s data dir is used to store playlists. m3u/base_dir: Description: Path to base directory for resolving relative paths in M3U files. If not set, relative paths are resolved based on the M3U file’s location. m3u/default_encoding: Description: Text encoding used for files with extension `.m3u`. Default is `latin-1`. Note that files with extension `.m3u8` are always expected to be UTF-8 encoded. m3u/default_extension: Description: The file extension for M3U playlists created using the core playlist API. Default is `.m3u8`. ``` -------------------------------- ### Install Mopidy Extensions from PyPI Source: https://docs.mopidy.com/latest/installation/macos This command installs Mopidy extensions directly from the Python Package Index (PyPI). It is an alternative method for extensions not available via Homebrew, ensuring compatibility even if Mopidy itself is Homebrew-installed. ```Python python3 -m pip install ... ``` -------------------------------- ### Install Mopidy in Python Virtual Environment Source: https://docs.mopidy.com/latest/installation/pypi Install or upgrade the latest Mopidy release into an active Python virtual environment using pip. This method ensures project isolation and avoids conflicts with system-wide Python packages. ```Shell python3 -m pip install --upgrade mopidy ``` -------------------------------- ### APIDOC: mopidy.audio.utils.setup_proxy Function Source: https://docs.mopidy.com/latest/api/audio Documentation for the `setup_proxy` function, used to configure proxy settings within a GStreamer element. ```APIDOC mopidy.audio.utils.setup_proxy(element, config) -> None Configure a GStreamer element with proxy settings. Parameters: element (Element): element to setup proxy in. config (ProxyConfig): proxy settings to use. Returns: None ``` -------------------------------- ### Install Mopidy Extension via APT Source: https://docs.mopidy.com/latest/installation/debian This command installs a specific Mopidy extension, such as `mopidy-mpd`, directly from the APT repositories. You should replace `mopidy-mpd` with the actual package name of the desired extension found via `apt search`. ```Shell sudo apt install mopidy-mpd ``` -------------------------------- ### Install Mopidy Extensions from PyPI Source: https://docs.mopidy.com/latest/installation/arch This command shows how to install Mopidy extensions directly from the Python Package Index (PyPI) using `pip`. This method is useful for extensions not found in AUR, and Mopidy will detect them even if the core is installed via `pacman`. ```bash sudo python3 -m pip install ... ``` -------------------------------- ### Inspect Mopidy Executable Script Source: https://docs.mopidy.com/latest/devenv This command displays the content of the 'mopidy' executable script located within the virtual environment's bin directory. It illustrates how the installed Mopidy executable points to the source code, enabling direct execution of the development version. ```Shell cat ~/mopidy-dev/.venv/bin/mopidy ``` -------------------------------- ### Run All Mopidy Tests using Tox Source: https://docs.mopidy.com/latest/_sources/devenv.rst Executes all tests configured in `tox.ini`, including linting (`ruff`) and documentation build checks. This command mirrors the CI setup and is highly recommended before pushing changes to GitHub to ensure compatibility. It can take up to a minute to complete depending on system performance. ```Shell tox ``` -------------------------------- ### Test Mopidy Backend URI Schemes and Provider Initialization Source: https://docs.mopidy.com/latest/extensiondev This Python code demonstrates how to test key aspects of a Mopidy backend. The `test_uri_schemes` function verifies that the backend exposes the expected URI schemes, while `test_init_sets_up_the_providers` ensures that the backend correctly initializes its library and playback providers upon instantiation. ```python def test_uri_schemes(config): backend = get_backend(config) assert 'my_scheme' in backend.uri_schemes def test_init_sets_up_the_providers(config): backend = get_backend(config) assert isinstance(backend.library, library.MyLibraryProvider) assert isinstance(backend.playback, playback.MyPlaybackProvider) ``` -------------------------------- ### Create Mopidy Backend Test Configuration and Instance Source: https://docs.mopidy.com/latest/extensiondev This Python snippet provides a `pytest` fixture to generate a mock configuration dictionary suitable for testing Mopidy backends. It also includes a helper function `get_backend` that instantiates a `MyBackend` object with the provided configuration and a mocked audio actor, simplifying backend testing setup. ```python @pytest.fixture def config(): return { 'http': { 'hostname': '127.0.0.1', 'port': '6680' }, 'proxy': { 'hostname': 'host_mock', 'port': 'port_mock' }, 'my_extension': { 'enabled': True, 'param_1': 'value_1', 'param_2': 'value_2', 'param_n': 'value_n' } } def get_backend(config): return backend.MyBackend(config=config, audio=mock.Mock()) ``` -------------------------------- ### Install Mopidy Development Tools with pip Source: https://docs.mopidy.com/latest/_sources/devenv.rst Installs Mopidy with development dependencies from the local Git repository into an active virtual environment. The `.[dev]` suffix ensures that extra development dependencies defined in `pyproject.toml` are installed. This command should be run from the Mopidy root directory. ```Shell cd ~/mopidy-dev/mopidy/ pip install --upgrade --editable ".[dev]" ``` -------------------------------- ### Add Mopidy APT Archive GPG Key Source: https://docs.mopidy.com/latest/installation/debian This command adds the GPG public key for the Mopidy APT archive to your system's keyring. This is a crucial step to ensure the authenticity and integrity of the packages you will install from the archive, preventing untrusted packages from being installed. ```Shell sudo mkdir -p /etc/apt/keyrings sudo wget -q -O /etc/apt/keyrings/mopidy-archive-keyring.gpg \ https://apt.mopidy.com/mopidy-archive-keyring.gpg ``` -------------------------------- ### Navigate into Cloned Mopidy Repository Source: https://docs.mopidy.com/latest/devenv This command changes the current directory to the newly cloned Mopidy Git repository. This is a prerequisite for performing further operations within the Mopidy project, such as installing dependencies or running tests. ```Shell cd ~/mopidy-dev/mopidy/ ``` -------------------------------- ### Add mopidy.backend.PlaybackProvider.on_source_setup() Method Source: https://docs.mopidy.com/latest/changelog This method can be implemented by Backend playback providers to set GStreamer source properties within the `source-setup` callback. It allows for custom configuration of GStreamer sources during playback. ```APIDOC mopidy.backend.PlaybackProvider.on_source_setup() ``` -------------------------------- ### Start upmpdcli in foreground Source: https://docs.mopidy.com/latest/upnp This command starts the `upmpdcli` application in the foreground. It will run until manually stopped or the terminal session is closed. ```Shell upmpdcli ``` -------------------------------- ### Change Directory to Mopidy Development Workspace Source: https://docs.mopidy.com/latest/devenv Navigate to the main Mopidy development workspace before cloning extensions. ```Shell cd ~/mopidy-dev/ ``` -------------------------------- ### Example Mopidy HTTP Server Configuration Source: https://docs.mopidy.com/latest/ext/http A sample configuration block for the Mopidy HTTP extension, demonstrating typical settings for enabling the server, specifying hostname and port, and configuring Zeroconf and CSRF protection. ```INI [http] enabled = true hostname = 127.0.0.1 port = 6680 zeroconf = Mopidy HTTP server on $hostname allowed_origins = csrf_protection = true default_app = mopidy ``` -------------------------------- ### Run Mopidy from Virtual Environment Source: https://docs.mopidy.com/latest/devenv This command executes the Mopidy application. When the virtual environment is active, this command will run the Mopidy version installed from the Git repository, allowing developers to test their changes directly. ```Shell mopidy ``` -------------------------------- ### Install upmpdcli on Debian/Ubuntu Source: https://docs.mopidy.com/latest/upnp This command installs the `upmpdcli` package on Debian or Ubuntu systems using the `apt` package manager. It requires superuser privileges to execute. ```Shell sudo apt install upmpdcli ``` -------------------------------- ### Activate Mopidy Development Virtual Environment Source: https://docs.mopidy.com/latest/devenv Activate the Python virtual environment for Mopidy development, essential for working with extensions. ```Shell . ~/mopidy-dev/.venv/bin/activate ``` -------------------------------- ### Enable Mopidy Homebrew Tap Source: https://docs.mopidy.com/latest/installation/macos This command adds the official Mopidy Homebrew formula repository to your Homebrew installation, allowing you to access Mopidy-specific packages. ```Shell brew tap mopidy/mopidy ``` -------------------------------- ### Change Directory to Cloned Mopidy Extension Source: https://docs.mopidy.com/latest/devenv Navigate into the newly cloned Mopidy extension's directory to perform further operations. ```Shell cd ~/mopidy-dev/mopidy-spotify/ ``` -------------------------------- ### Mopidy.js Node.js Installation Source: https://docs.mopidy.com/latest/history/changelog-0 Mopidy.js now supports Node.js environments, allowing Mopidy clients to be built using Node.js. It is available on the npm registry for easy installation. ```JavaScript npm install mopidy ``` -------------------------------- ### Mopidy Extension API Updates Source: https://docs.mopidy.com/latest/history/changelog-0 Mopidy 0.18 introduces a new `setup()` method for extensions, replacing several deprecated methods. This streamlines extension initialization and registration, improving the overall extension development experience. ```APIDOC Class: mopidy.ext.Registry Description: Details for extension registration. Class: mopidy.ext.Extension Method: setup() Description: New method for extension setup. Replaces: - get_backend_classes() (deprecated) - get_frontend_classes() (deprecated) - register_gstreamer_elements() (deprecated) ``` -------------------------------- ### Check Python Version Source: https://docs.mopidy.com/latest/_sources/installation/pypi.rst This command checks the installed Python 3 version on your system. Mopidy requires Python 3.11 or newer to function correctly. ```bash python3 --version ``` -------------------------------- ### Install Mopidy Extension using Pip Source: https://docs.mopidy.com/latest/_sources/devenv.rst Command to install a Mopidy extension, such as Mopidy-Scrobbler, using the pip package manager within the active virtual environment. ```Shell pip install Mopidy-Scrobbler ``` -------------------------------- ### Mopidy Extension API Documentation Source: https://docs.mopidy.com/latest/api/ext Detailed API documentation for the `mopidy.ext.Extension` class, which serves as the base for all Mopidy extensions. It outlines the class attributes and methods available for managing extension-specific data, configuration, and command-line interactions. ```APIDOC mopidy.ext.Extension: Description: Base class for Mopidy extensions. Attributes: dist_name: str Description: The extension’s distribution name, as registered on PyPI. Example: Mopidy-Soundspot ext_name: str Description: The extension’s short name, as used in setup.py and as config section name. Example: soundspot Methods: classmethod check_attr() Description: Check if ext_name exist. Returns: None classmethod get_cache_dir(config: dict[str, dict[str, Any]]) Description: Get or create cache directory for the extension. Use this directory to cache data that can safely be thrown away. Parameters: config: The Mopidy config object. Returns: pathlib.Path get_command() Description: Command to expose to command line users running `mopidy`. Returns: mopidy.commands.Command | None Instance of a `Command` class. classmethod get_config_dir(config: dict[str, dict[str, Any]]) Description: Get or create configuration directory for the extension. Parameters: config: The Mopidy config object. Returns: pathlib.Path get_config_schema() Description: The extension’s config validation schema. Returns: mopidy.config.schemas.ConfigSchema classmethod get_data_dir(config: dict[str, dict[str, Any]]) Description: Get or create data directory for the extension. Use this directory to store data that should be persistent. Parameters: config: The Mopidy config object. ``` -------------------------------- ### Upgrade Homebrew Packages Source: https://docs.mopidy.com/latest/installation/macos This command updates all software installed via Homebrew on your system. It is used both for general system maintenance and specifically for upgrading Mopidy and its dependencies. ```Shell brew upgrade ``` -------------------------------- ### Create Mopidy Development Workspace Directory Source: https://docs.mopidy.com/latest/devenv This command creates a new directory named 'mopidy-dev' in the user's home directory. This directory will serve as the central workspace for all Mopidy development, housing Git repositories for Mopidy and its extensions. ```Shell mkdir ~/mopidy-dev ``` -------------------------------- ### Install Mopidy Extension from AUR on Arch Linux Source: https://docs.mopidy.com/latest/_sources/installation/arch.rst This snippet shows how to install a Mopidy extension, such as 'mopidy-mpd', from the Arch User Repository (AUR) using the 'yay' helper. ```Shell yay -S mopidy-mpd ``` -------------------------------- ### Start upmpdcli as a system service Source: https://docs.mopidy.com/latest/upnp This command starts the `upmpdcli` application as a background service using `sudo service`. This method is suitable for persistent operation and running `upmpdcli` in the background. ```Shell sudo service upmpdcli start ``` -------------------------------- ### List Outdated Python Packages with Pip Source: https://docs.mopidy.com/latest/devenv Identify outdated Python packages and Mopidy extensions within the active virtual environment using pip. ```Shell pip list --outdated ```