Metadata-Version: 2.4
Name: mopidy-dial
Version: 0.0.1
Summary: Mopidy extension implementing SSDP/DIAL endpoint for mopidy-youtube
Author-email: Nik Tumbri <natumbri@gmail.com>
License: Apache-2.0
Project-URL: Homepage, https://github.com/natumbri/mopidy-dial
Classifier: Environment :: No Input/Output (Daemon)
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Multimedia :: Sound/Audio :: Players
Requires-Python: >=3.13
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: mopidy>=4.0.0
Requires-Dist: pykka>=4.0
Requires-Dist: requests>=2.31
Requires-Dist: tornado>=6.4
Dynamic: license-file

# mopidy-dial

[![Latest PyPI version](https://img.shields.io/pypi/v/mopidy-dial)](https://pypi.org/p/mopidy-dial)
[![CI build status](https://img.shields.io/github/actions/workflow/status/natumbri/mopidy-dial/ci.yml)](https://github.com/natumbri/mopidy-dial/actions/workflows/ci.yml)
[![Test coverage](https://img.shields.io/codecov/c/gh/natumbri/mopidy-dial)](https://codecov.io/gh/natumbri/mopidy-dial)

Mopidy extension that exposes a DIAL/SSDP endpoint for YouTube and YouTube Music on the local network. It allows YouTube clients on the same LAN to discover Mopidy as a cast target and keep playback state in sync with the app.


## Installation

Install from PyPI:

```sh
python3 -m pip install mopidy-dial
```

For a Mopidy installation that uses a config directory, add the extension under the Mopidy config and restart the service.


## Configuration

Add the extension to your Mopidy configuration:

```ini
[dial]
enabled = true
friendly_name = Mopidy
```

The available option is:

- `enabled`: enables the extension
- `friendly_name`: name advertised to YouTube apps on the local network; defaults to `Mopidy`

If you use a `mopidy.conf` file, the section above is all you need for the extension itself.


## What this extension does

This project implements a small local-network bridge between Mopidy and the YouTube Lounge/DIAL protocol used by YouTube apps. In practice, it does the following:

- advertises a DIAL device over SSDP on the LAN
- creates and manages the YouTube Lounge session used by the app
- forwards playback state changes from Mopidy back to the connected client
- supports YouTube Music as a second session with the matching theme

This is intended for use alongside `mopidy-youtube` or similar YouTube-backed playback sources.


## Usage

1. Install the extension and ensure Mopidy is running on the same LAN as your phone or TV.
2. Add the configuration shown above to your Mopidy config.
3. Start Mopidy.
4. Open YouTube or YouTube Music and look for the advertised `Mopidy` device.
5. Connect from the app to begin casting or controlling playback.


## Project resources

- [Source code](https://github.com/natumbri/mopidy-dial)
- [Issues](https://github.com/natumbri/mopidy-dial/issues)
- [Releases](https://github.com/natumbri/mopidy-dial/releases)


## Development

### Set up development environment

Clone the repo using, for example, GitHub CLI:

```sh
gh repo clone natumbri/mopidy-dial
```

Enter the directory, and install dependencies using [uv](https://docs.astral.sh/uv/):

```sh
cd mopidy-dial/
uv sync
```

### Running tests

To run all tests and linters in isolated environments, use
[tox](https://tox.wiki/):

```sh
tox
```

To only run tests, use [pytest](https://pytest.org/):

```sh
pytest
```

To format the code, use [ruff](https://docs.astral.sh/ruff/):

```sh
ruff format .
```

To check for lint issues with ruff, run:

```sh
ruff check .
```

To check for type errors, use [pyright](https://microsoft.github.io/pyright/):

```sh
pyright .
```

### Setup before first release

Before the first release, you must [enable trusted publishing on
PyPI](https://docs.pypi.org/trusted-publishers/creating-a-project-through-oidc/)
so that the `release.yml` GitHub Action can create the PyPI project and publish
releases to PyPI.

When following the instructions linked above, use the following values in the
form at PyPI:

- Publisher: GitHub
- PyPI project name: `mopidy-dial`
- Owner: `natumbri`
- Repository name: `mopidy-dial`
- Workflow name: `release.yml`
- Environment name: `pypi` (must match environment name in `release.yml`)

### Making a release

To make a release to PyPI, go to the project's [GitHub releases
page](https://github.com/natumbri/mopidy-dial/releases)
and click the "Draft a new release" button.

In the "choose a tag" dropdown, select the tag you want to release or create a
new tag, e.g. `v0.1.0`. Add a title, e.g. `v0.1.0`, and a description of the changes.

Decide if the release is a pre-release (alpha, beta, or release candidate) or
should be marked as the latest release, and click "Publish release".

Once the release is created, the `release.yml` GitHub Action will automatically
build and publish the release to
[PyPI](https://pypi.org/project/mopidy-dial/).


## Credits

- Original author: [Nik Tumbri](https://github.com/natumbri)
- Current maintainer: [Nik Tumbri](https://github.com/natumbri)
- [Contributors](https://github.com/natumbri/mopidy-dial/graphs/contributors)
