PyDLNA
A simple, zero-dependency Python library for DLNA streaming, discovery, and device control.
Most DLNA libraries out there are either overly complex, poorly documented, or unmaintained. PyDLNA is built to be fit-for-purpose, straightforward, and ready to use in a few lines of code.
pip install PyDLNA
Quick Concepts
DLNA_Discovery()— Finds DLNA devices (renderers, media servers) on local network.DLNA_Server()— Hosts and serves local media files over HTTP with DLNA headers.device.controller()— Gives active playback control session (.play(),.pause(), track info) for a renderer.
Usage Examples
Stream one file
Start a server, find first renderer, play a file:
from pydlna import DLNA_Discovery, DLNA_Server
with DLNA_Server() as server:
media = server.library.add("D:/Movies/movie.mp4")
renderer = next(
(device for device in DLNA_Discovery().discover() if device.is_renderer),
None,
)
if renderer is None:
raise RuntimeError("No DLNA renderer found")
renderer.controller().play(media)
print(f"Playing {media.title} on {renderer.name}")
Server stays alive inside with block. play(media) builds reachable media URL and sends both required UPnP commands.
Stream a folder
add_directory() finds common audio, video, and image files. Select any file from library:
from pydlna import DLNA_Discovery, DLNA_Server
with DLNA_Server() as server:
server.library.add_directory("D:/Movies")
renderer = next(device for device in DLNA_Discovery().discover() if device.is_renderer)
renderer.controller().play(server.library[0])
Find renderers
from pydlna import DLNA_Discovery
for device in DLNA_Discovery().discover():
if device.is_renderer:
print(f"{device.name} at {device.address}")
Renderer Compatibility
Compatibility check is optional. Use it when app must avoid sending files a renderer explicitly rejects:
result = media.compatibility_with(renderer)
if result.can_play:
renderer.controller().play(media)
Result status is supported, unsupported, or unknown. unknown permits playback because many renderers publish no usable Sink capabilities.
MIME detection uses host MIME data plus common media-extension fallbacks. It does not inspect codecs, resolution, audio tracks, or containers beyond file extension. PyDLNA avoids claiming a DLNA profile from MIME type alone because that can falsely advertise codec compatibility.
Metadata
Release files for PyDLNA 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pydlna-0.2.0.tar.gz | 20.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pydlna-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 44.1 kB
Release files / pydlna-0.2.0.tar.gz
| Download URL | pydlna-0.2.0.tar.gz |
|---|---|
| Size | 20.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
530cf415015ba3c3b542d8758796b9399aa55246265f89bcf58b85fdcb120eca
|
|
BLAKE2b-256 checksum How to use checksums |
b2e046c589d8c846a43a9f23a86c787358e3f116beaa4bbe0c91547fe51e8730
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency logRelease files / pydlna-0.2.0-py3-none-any.whl
| Download URL | pydlna-0.2.0-py3-none-any.whl |
|---|---|
| Size | 23.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ff53719623617d378627dae78aaa81642854c837cec2ed7aa9d4555c650a141b
|
|
BLAKE2b-256 checksum How to use checksums |
286386f566be047b6f2749066d12aea98d98b17beb745096ef6dd63aa731b0b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency log