PyDLNA 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,97 @@
1
+ name: CI & Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ jobs:
9
+ test:
10
+ name: Run Tests
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ['3.9', '3.10', '3.11', '3.12']
15
+
16
+ steps:
17
+ - name: Checkout code
18
+ uses: actions/checkout@v4
19
+
20
+ - name: Set up Python ${{ matrix.python-version }}
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: ${{ matrix.python-version }}
24
+
25
+ - name: Install dependencies & package
26
+ run: |
27
+ python -m pip install --upgrade pip
28
+ pip install pytest setuptools setuptools-scm build
29
+ pip install -e .
30
+
31
+ - name: Run tests / verification
32
+ run: |
33
+ if [ -d "tests" ]; then
34
+ pytest
35
+ else
36
+ python -m compileall src
37
+ fi
38
+
39
+ github-release:
40
+ name: Create GitHub Release
41
+ needs: test
42
+ runs-on: ubuntu-latest
43
+ permissions:
44
+ contents: write # Required for creating releases and uploading assets
45
+
46
+ steps:
47
+ - name: Checkout code with full history
48
+ uses: actions/checkout@v4
49
+ with:
50
+ fetch-depth: 0 # Required for setuptools-scm to resolve git tag version
51
+
52
+ - name: Set up Python
53
+ uses: actions/setup-python@v5
54
+ with:
55
+ python-version: '3.11'
56
+
57
+ - name: Install build tools
58
+ run: |
59
+ python -m pip install --upgrade pip
60
+ pip install build setuptools-scm
61
+
62
+ - name: Build sdist and wheel
63
+ run: python -m build
64
+
65
+ - name: Upload dist artifacts
66
+ uses: actions/upload-artifact@v4
67
+ with:
68
+ name: python-package-distributions
69
+ path: dist/
70
+
71
+ - name: Create GitHub Release
72
+ uses: softprops/action-gh-release@v2
73
+ with:
74
+ files: dist/*
75
+ generate_release_notes: true
76
+ env:
77
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78
+
79
+ publish-pypi:
80
+ name: Publish to PyPI
81
+ needs: github-release
82
+ runs-on: ubuntu-latest
83
+ environment:
84
+ name: pypi
85
+ url: https://pypi.org/p/PyDLNA
86
+ permissions:
87
+ id-token: write # Mandatory for OIDC authentication to PyPI
88
+
89
+ steps:
90
+ - name: Download dist artifacts
91
+ uses: actions/download-artifact@v4
92
+ with:
93
+ name: python-package-distributions
94
+ path: dist/
95
+
96
+ - name: Publish package to PyPI
97
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,11 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ tests/
5
+ .env
6
+ build/
7
+ dist/
8
+ *.egg-info/
9
+ .pytest_cache/
10
+ .vscode/
11
+ src/pydlna/_version.py
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SurrealisticRabbit
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
pydlna-0.1.4/PKG-INFO ADDED
@@ -0,0 +1,92 @@
1
+ Metadata-Version: 2.4
2
+ Name: PyDLNA
3
+ Version: 0.1.4
4
+ Summary: A simple, zero-dependency DLNA Python library for discovery, streaming, and device control.
5
+ Author: SurrealisticRabbit
6
+ License: MIT
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.8
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE.md
13
+ Dynamic: license-file
14
+
15
+ # PyDLNA
16
+
17
+ A simple, zero-dependency Python library for DLNA streaming, discovery, and device control.
18
+
19
+ 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.
20
+
21
+ ```bash
22
+ pip install PyDLNA
23
+
24
+ ```
25
+
26
+ ---
27
+
28
+ ## Quick Concepts
29
+
30
+ * **`DLNADiscovery()`** — Your best friend for finding DLNA devices (renderers, media servers, etc.) on your local network.
31
+ * **`DLNAServer()`** — Hosts and serves your local media files over HTTP with proper DLNA headers.
32
+ * **`device.controller()`** — Gives you an active playback control session (`.play()`, `.pause()`, track info) for a specific renderer.
33
+
34
+ ---
35
+
36
+ ## Usage Examples
37
+
38
+ ### 1. Basic Streaming — `examples/basic.py`
39
+
40
+ Serve a directory, find a smart TV or speaker on the network, and throw a video/audio track directly to it:
41
+
42
+ ```python
43
+ import time
44
+ from pydlna import DLNADiscovery, DLNAServer
45
+
46
+ folder = "D:/Movies"
47
+
48
+ with DLNAServer(name="PyDLNA Example") as server:
49
+ server.library.add_directory(folder)
50
+
51
+ target = None
52
+ with DLNADiscovery().discover() as devices:
53
+ for device in devices:
54
+ if device.is_renderer:
55
+ print(f"Found renderer: {device.name}")
56
+ target = device
57
+ break
58
+
59
+ if target is None:
60
+ print("No renderer found.")
61
+ else:
62
+ with target.controller() as session:
63
+ media = server.library[0]
64
+ print(f"Sending: {media.url_for(target.address)}")
65
+ session.play(media)
66
+
67
+ while session.is_playing():
68
+ current = session.currently_playing
69
+ print(f"Playing: {media.title[:18]} > {current.position}:{current.duration}", end="\r")
70
+ time.sleep(1)
71
+
72
+ ```
73
+
74
+ ---
75
+
76
+ ### 2. Inspecting Network Devices — `examples/client_info.py`
77
+
78
+ Scan your network and inspect the hardware, model numbers, and supported playback formats of discovered renderers:
79
+
80
+ ```python
81
+ from pydlna import DLNADiscovery
82
+
83
+ for client in DLNADiscovery().discover():
84
+ if client.is_renderer:
85
+ print(f"{client.name or '(unnamed)'} @ {client.address}")
86
+ print(f" Manufacturer : {client.manufacturer} ({client.manufacturer_url})")
87
+ print(f" Model : {client.model_name} {client.model_number}")
88
+ print(f" Playable formats : {client.playback_formats}")
89
+ print(f" Supported protocols: {client.supported_protocols}")
90
+ print("-" * 50)
91
+
92
+ ```
pydlna-0.1.4/README.md ADDED
@@ -0,0 +1,78 @@
1
+ # PyDLNA
2
+
3
+ A simple, zero-dependency Python library for DLNA streaming, discovery, and device control.
4
+
5
+ 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.
6
+
7
+ ```bash
8
+ pip install PyDLNA
9
+
10
+ ```
11
+
12
+ ---
13
+
14
+ ## Quick Concepts
15
+
16
+ * **`DLNADiscovery()`** — Your best friend for finding DLNA devices (renderers, media servers, etc.) on your local network.
17
+ * **`DLNAServer()`** — Hosts and serves your local media files over HTTP with proper DLNA headers.
18
+ * **`device.controller()`** — Gives you an active playback control session (`.play()`, `.pause()`, track info) for a specific renderer.
19
+
20
+ ---
21
+
22
+ ## Usage Examples
23
+
24
+ ### 1. Basic Streaming — `examples/basic.py`
25
+
26
+ Serve a directory, find a smart TV or speaker on the network, and throw a video/audio track directly to it:
27
+
28
+ ```python
29
+ import time
30
+ from pydlna import DLNADiscovery, DLNAServer
31
+
32
+ folder = "D:/Movies"
33
+
34
+ with DLNAServer(name="PyDLNA Example") as server:
35
+ server.library.add_directory(folder)
36
+
37
+ target = None
38
+ with DLNADiscovery().discover() as devices:
39
+ for device in devices:
40
+ if device.is_renderer:
41
+ print(f"Found renderer: {device.name}")
42
+ target = device
43
+ break
44
+
45
+ if target is None:
46
+ print("No renderer found.")
47
+ else:
48
+ with target.controller() as session:
49
+ media = server.library[0]
50
+ print(f"Sending: {media.url_for(target.address)}")
51
+ session.play(media)
52
+
53
+ while session.is_playing():
54
+ current = session.currently_playing
55
+ print(f"Playing: {media.title[:18]} > {current.position}:{current.duration}", end="\r")
56
+ time.sleep(1)
57
+
58
+ ```
59
+
60
+ ---
61
+
62
+ ### 2. Inspecting Network Devices — `examples/client_info.py`
63
+
64
+ Scan your network and inspect the hardware, model numbers, and supported playback formats of discovered renderers:
65
+
66
+ ```python
67
+ from pydlna import DLNADiscovery
68
+
69
+ for client in DLNADiscovery().discover():
70
+ if client.is_renderer:
71
+ print(f"{client.name or '(unnamed)'} @ {client.address}")
72
+ print(f" Manufacturer : {client.manufacturer} ({client.manufacturer_url})")
73
+ print(f" Model : {client.model_name} {client.model_number}")
74
+ print(f" Playable formats : {client.playback_formats}")
75
+ print(f" Supported protocols: {client.supported_protocols}")
76
+ print("-" * 50)
77
+
78
+ ```
@@ -0,0 +1,34 @@
1
+ """Serve a folder of media over DLNA and play it on the first renderer found.
2
+
3
+ Usage:
4
+ python examples/basic.py [folder]
5
+ """
6
+
7
+ import time
8
+ from pydlna import DLNADiscovery, DLNAServer
9
+
10
+ folder = "D:/Movies"
11
+
12
+ with DLNAServer(name="PyDLNA Example") as server:
13
+ server.library.add_directory(folder)
14
+
15
+ target = None
16
+ with DLNADiscovery().discover() as devices:
17
+ for device in devices:
18
+ if device.is_renderer:
19
+ print(f"Found renderer: {device.name}")
20
+ target = device
21
+ break
22
+
23
+ if target is None:
24
+ print("No renderer found.")
25
+ else:
26
+ with target.controller() as session:
27
+ media = server.library[0]
28
+ print(f"Sending: {media.url_for(target.address)}")
29
+ session.play(media)
30
+
31
+ while session.is_playing():
32
+ current = session.currently_playing
33
+ print(f"Playing: {server.library[0].title[:18]}> {current.position}:{current.duration}", end="\r")
34
+ time.sleep(1)
@@ -0,0 +1,14 @@
1
+ """Show what PyDLNA can see about renderer clients on the network.
2
+
3
+ Run: python examples/client_info.py
4
+ """
5
+
6
+ from pydlna import DLNADiscovery
7
+
8
+ for client in DLNADiscovery().discover():
9
+ if client.is_renderer:
10
+ print(f"{client.name or '(unnamed)'} @ {client.address}")
11
+ print(f" Manufacturer : {client.manufacturer} {client.manufacturer_url}")
12
+ print(f" Model : {client.model_name} {client.model_number}")
13
+ print(f" Playable formats: {client.playback_formats}")
14
+ print(f" Supported protocols: {client.supported_protocols}")
@@ -0,0 +1,29 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "setuptools-scm>=8.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "PyDLNA"
7
+ dynamic = ["version"]
8
+ description = "A simple, zero-dependency DLNA Python library for discovery, streaming, and device control."
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = { text = "MIT" }
12
+ authors = [
13
+ { name = "SurrealisticRabbit" }
14
+ ]
15
+ classifiers = [
16
+ "Programming Language :: Python :: 3",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Operating System :: OS Independent",
19
+ ]
20
+
21
+ dependencies = []
22
+
23
+ [tool.setuptools_scm]
24
+ version_scheme = "post-release"
25
+ local_scheme = "no-local-version"
26
+ write_to = "src/pydlna/_version.py"
27
+
28
+ [tool.setuptools.packages.find]
29
+ where = ["src"]
pydlna-0.1.4/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,92 @@
1
+ Metadata-Version: 2.4
2
+ Name: PyDLNA
3
+ Version: 0.1.4
4
+ Summary: A simple, zero-dependency DLNA Python library for discovery, streaming, and device control.
5
+ Author: SurrealisticRabbit
6
+ License: MIT
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.8
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE.md
13
+ Dynamic: license-file
14
+
15
+ # PyDLNA
16
+
17
+ A simple, zero-dependency Python library for DLNA streaming, discovery, and device control.
18
+
19
+ 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.
20
+
21
+ ```bash
22
+ pip install PyDLNA
23
+
24
+ ```
25
+
26
+ ---
27
+
28
+ ## Quick Concepts
29
+
30
+ * **`DLNADiscovery()`** — Your best friend for finding DLNA devices (renderers, media servers, etc.) on your local network.
31
+ * **`DLNAServer()`** — Hosts and serves your local media files over HTTP with proper DLNA headers.
32
+ * **`device.controller()`** — Gives you an active playback control session (`.play()`, `.pause()`, track info) for a specific renderer.
33
+
34
+ ---
35
+
36
+ ## Usage Examples
37
+
38
+ ### 1. Basic Streaming — `examples/basic.py`
39
+
40
+ Serve a directory, find a smart TV or speaker on the network, and throw a video/audio track directly to it:
41
+
42
+ ```python
43
+ import time
44
+ from pydlna import DLNADiscovery, DLNAServer
45
+
46
+ folder = "D:/Movies"
47
+
48
+ with DLNAServer(name="PyDLNA Example") as server:
49
+ server.library.add_directory(folder)
50
+
51
+ target = None
52
+ with DLNADiscovery().discover() as devices:
53
+ for device in devices:
54
+ if device.is_renderer:
55
+ print(f"Found renderer: {device.name}")
56
+ target = device
57
+ break
58
+
59
+ if target is None:
60
+ print("No renderer found.")
61
+ else:
62
+ with target.controller() as session:
63
+ media = server.library[0]
64
+ print(f"Sending: {media.url_for(target.address)}")
65
+ session.play(media)
66
+
67
+ while session.is_playing():
68
+ current = session.currently_playing
69
+ print(f"Playing: {media.title[:18]} > {current.position}:{current.duration}", end="\r")
70
+ time.sleep(1)
71
+
72
+ ```
73
+
74
+ ---
75
+
76
+ ### 2. Inspecting Network Devices — `examples/client_info.py`
77
+
78
+ Scan your network and inspect the hardware, model numbers, and supported playback formats of discovered renderers:
79
+
80
+ ```python
81
+ from pydlna import DLNADiscovery
82
+
83
+ for client in DLNADiscovery().discover():
84
+ if client.is_renderer:
85
+ print(f"{client.name or '(unnamed)'} @ {client.address}")
86
+ print(f" Manufacturer : {client.manufacturer} ({client.manufacturer_url})")
87
+ print(f" Model : {client.model_name} {client.model_number}")
88
+ print(f" Playable formats : {client.playback_formats}")
89
+ print(f" Supported protocols: {client.supported_protocols}")
90
+ print("-" * 50)
91
+
92
+ ```
@@ -0,0 +1,23 @@
1
+ .gitignore
2
+ LICENSE.md
3
+ README.md
4
+ pyproject.toml
5
+ .github/workflows/release.yml
6
+ examples/basic.py
7
+ examples/client_info.py
8
+ src/PyDLNA.egg-info/PKG-INFO
9
+ src/PyDLNA.egg-info/SOURCES.txt
10
+ src/PyDLNA.egg-info/dependency_links.txt
11
+ src/PyDLNA.egg-info/scm_file_list.json
12
+ src/PyDLNA.egg-info/scm_version.json
13
+ src/PyDLNA.egg-info/top_level.txt
14
+ src/pydlna/__init__.py
15
+ src/pydlna/_version.py
16
+ src/pydlna/client.py
17
+ src/pydlna/discovery.py
18
+ src/pydlna/errors.py
19
+ src/pydlna/file.py
20
+ src/pydlna/formatters.py
21
+ src/pydlna/handlers.py
22
+ src/pydlna/server.py
23
+ src/pydlna/services.py
@@ -0,0 +1,20 @@
1
+ {
2
+ "files": [
3
+ ".github/workflows/release.yml",
4
+ ".gitignore",
5
+ "LICENSE.md",
6
+ "README.md",
7
+ "examples/basic.py",
8
+ "examples/client_info.py",
9
+ "pyproject.toml",
10
+ "src/pydlna/__init__.py",
11
+ "src/pydlna/client.py",
12
+ "src/pydlna/discovery.py",
13
+ "src/pydlna/errors.py",
14
+ "src/pydlna/file.py",
15
+ "src/pydlna/formatters.py",
16
+ "src/pydlna/handlers.py",
17
+ "src/pydlna/server.py",
18
+ "src/pydlna/services.py"
19
+ ]
20
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "0.1.4",
3
+ "distance": 0,
4
+ "node": "g458803ff7ec535192b6620ad3debd39c5eadae43",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-10-09"
8
+ }
@@ -0,0 +1 @@
1
+ pydlna
@@ -0,0 +1,25 @@
1
+ """PyDLNA — a tiny DLNA/UPnP media server and control point library."""
2
+
3
+ from pydlna.client import DLNAClient, DLNAController, PlaybackPosition, UPnPServiceInfo
4
+ from pydlna.discovery import DLNADiscovery
5
+ from pydlna.errors import UPnPError
6
+ from pydlna.file import MediaFile, MediaItem
7
+ from pydlna.server import DLNAServer, MediaLibrary
8
+
9
+ try:
10
+ from pydlna._version import __version__
11
+ except ImportError:
12
+ __version__ = "0.0.0.dev0"
13
+
14
+ __all__ = [
15
+ "DLNAClient",
16
+ "DLNAController",
17
+ "DLNADiscovery",
18
+ "DLNAServer",
19
+ "MediaFile",
20
+ "MediaItem",
21
+ "MediaLibrary",
22
+ "PlaybackPosition",
23
+ "UPnPError",
24
+ "UPnPServiceInfo",
25
+ ]
@@ -0,0 +1,24 @@
1
+ # file generated by vcs-versioning
2
+ # don't change, don't track in version control
3
+ from __future__ import annotations
4
+
5
+ __all__ = [
6
+ "__version__",
7
+ "__version_tuple__",
8
+ "version",
9
+ "version_tuple",
10
+ "__commit_id__",
11
+ "commit_id",
12
+ ]
13
+
14
+ version: str
15
+ __version__: str
16
+ __version_tuple__: tuple[int | str, ...]
17
+ version_tuple: tuple[int | str, ...]
18
+ commit_id: str | None
19
+ __commit_id__: str | None
20
+
21
+ __version__ = version = '0.1.4'
22
+ __version_tuple__ = version_tuple = (0, 1, 4)
23
+
24
+ __commit_id__ = commit_id = 'g458803ff7'