ChimkenMPRIS 0.0.1__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.
- chimkenmpris-0.0.1/LICENSE +21 -0
- chimkenmpris-0.0.1/PKG-INFO +18 -0
- chimkenmpris-0.0.1/PYPI_README.md +1 -0
- chimkenmpris-0.0.1/README.md +1 -0
- chimkenmpris-0.0.1/pyproject.toml +29 -0
- chimkenmpris-0.0.1/setup.cfg +4 -0
- chimkenmpris-0.0.1/src/ChimkenMPRIS/Player.py +43 -0
- chimkenmpris-0.0.1/src/ChimkenMPRIS/Root.py +29 -0
- chimkenmpris-0.0.1/src/ChimkenMPRIS/__init__.py +1 -0
- chimkenmpris-0.0.1/src/ChimkenMPRIS/main.py +35 -0
- chimkenmpris-0.0.1/src/ChimkenMPRIS.egg-info/PKG-INFO +18 -0
- chimkenmpris-0.0.1/src/ChimkenMPRIS.egg-info/SOURCES.txt +13 -0
- chimkenmpris-0.0.1/src/ChimkenMPRIS.egg-info/dependency_links.txt +1 -0
- chimkenmpris-0.0.1/src/ChimkenMPRIS.egg-info/requires.txt +1 -0
- chimkenmpris-0.0.1/src/ChimkenMPRIS.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sand
|
|
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.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ChimkenMPRIS
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A small MPRIS server made for my app but also usable
|
|
5
|
+
Author: sand
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: github, https://github.com/sandbuster2005/Chimken-MPRIS.git
|
|
8
|
+
Keywords: chimken,MPRIS,dbus
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
12
|
+
Requires-Python: >=3.9
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: sdbus
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
|
|
18
|
+
A small MPRIS server made for my app but also usable
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
A small MPRIS server made for my app but also usable
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a python lib with the goal to make a python MPRIS implementation for dbus
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools >= 77.0.3"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ChimkenMPRIS"
|
|
7
|
+
version = "0.0.1"
|
|
8
|
+
requires-python = ">= 3.9"
|
|
9
|
+
dependencies = [ "sdbus" ]
|
|
10
|
+
authors = [ { name = "sand" }, ]
|
|
11
|
+
|
|
12
|
+
description = "A small MPRIS server made for my app but also usable"
|
|
13
|
+
readme = "PYPI_README.md"
|
|
14
|
+
license = "MIT"
|
|
15
|
+
license-files = ["LICEN[CS]E*"]
|
|
16
|
+
|
|
17
|
+
keywords = ["chimken", "MPRIS", "dbus"]
|
|
18
|
+
|
|
19
|
+
classifiers = [
|
|
20
|
+
"Development Status :: 4 - Beta",
|
|
21
|
+
"Intended Audience :: Developers",
|
|
22
|
+
"Operating System :: POSIX :: Linux",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
github = "https://github.com/sandbuster2005/Chimken-MPRIS.git"
|
|
29
|
+
#Documentation = "https://sandbuster2005.github.io/ChimkenJournalism"
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from sdbus import (
|
|
2
|
+
DbusInterfaceCommonAsync,
|
|
3
|
+
dbus_method_async,
|
|
4
|
+
dbus_property_async,
|
|
5
|
+
DbusPropertyEmitsChangeFlag
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
class MediaPlayer2Player(DbusInterfaceCommonAsync, interface_name='org.mpris.MediaPlayer2.Player'):
|
|
9
|
+
|
|
10
|
+
def __init__(self, action_queue):
|
|
11
|
+
self._playback_status = "Playing"
|
|
12
|
+
super().__init__()
|
|
13
|
+
self.action_queue = action_queue
|
|
14
|
+
|
|
15
|
+
@dbus_property_async('s', flags=DbusPropertyEmitsChangeFlag )
|
|
16
|
+
def playback_status(self):
|
|
17
|
+
# In a real app, query your state variables here
|
|
18
|
+
return "Playing"
|
|
19
|
+
|
|
20
|
+
@playback_status.setter
|
|
21
|
+
def playback_status_setter(self, new_status: str):
|
|
22
|
+
self._playback_status = new_status
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@dbus_method_async('')
|
|
26
|
+
async def play(self):
|
|
27
|
+
self.action_queue.append("PLAY")
|
|
28
|
+
|
|
29
|
+
@dbus_method_async('')
|
|
30
|
+
async def pause(self):
|
|
31
|
+
self.action_queue.append("PAUSE")
|
|
32
|
+
|
|
33
|
+
@dbus_method_async('')
|
|
34
|
+
async def play_pause(self):
|
|
35
|
+
self.action_queue.append("PLAY_PAUSE")
|
|
36
|
+
|
|
37
|
+
@dbus_method_async('')
|
|
38
|
+
async def next(self):
|
|
39
|
+
self.action_queue.append("NEXT")
|
|
40
|
+
|
|
41
|
+
@dbus_method_async('')
|
|
42
|
+
async def previous(self):
|
|
43
|
+
self.action_queue.append("PREVIOUS")
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from sdbus import (
|
|
2
|
+
DbusInterfaceCommonAsync,
|
|
3
|
+
dbus_method_async,
|
|
4
|
+
dbus_property_async,
|
|
5
|
+
DbusPropertyEmitsChangeFlag
|
|
6
|
+
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
class MediaPlayer2Root(DbusInterfaceCommonAsync, interface_name='org.mpris.MediaPlayer2'):
|
|
10
|
+
|
|
11
|
+
def __init__(self, action_queue):
|
|
12
|
+
super().__init__()
|
|
13
|
+
self.action_queue = action_queue
|
|
14
|
+
|
|
15
|
+
@dbus_property_async('b')
|
|
16
|
+
def can_quit(self) -> bool:
|
|
17
|
+
return True
|
|
18
|
+
|
|
19
|
+
@dbus_property_async('b')
|
|
20
|
+
def can_raise(self) -> bool:
|
|
21
|
+
return False
|
|
22
|
+
|
|
23
|
+
@dbus_property_async('s')
|
|
24
|
+
def desktop_entry(self) -> str:
|
|
25
|
+
return "my-custom-tui"
|
|
26
|
+
|
|
27
|
+
@dbus_method_async('')
|
|
28
|
+
async def quit(self) -> None:
|
|
29
|
+
self.action_queue.append("QUIT")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .main import *
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import threading
|
|
3
|
+
from sdbus import request_default_bus_name_async
|
|
4
|
+
from .Player import MediaPlayer2Player
|
|
5
|
+
from .Root import MediaPlayer2Root
|
|
6
|
+
|
|
7
|
+
class MPRIS_server:
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def __init__(self):
|
|
11
|
+
self.action_queue = [] # D-Bus -> TUI (e.g., media keys pressed)
|
|
12
|
+
self.update_queue = [] # TUI -> D-Bus (e.g., user clicked pause inside TUI)
|
|
13
|
+
|
|
14
|
+
self.root_interface = MediaPlayer2Root( self.action_queue )
|
|
15
|
+
self.player_interface = MediaPlayer2Player( self.action_queue )
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def run(self):
|
|
19
|
+
loop = asyncio.new_event_loop()
|
|
20
|
+
asyncio.set_event_loop(loop)
|
|
21
|
+
|
|
22
|
+
async def main():
|
|
23
|
+
# Register a well-known D-Bus name under the standard MPRIS convention
|
|
24
|
+
# (e.g., org.mpris.MediaPlayer2.my_player)
|
|
25
|
+
await request_default_bus_name_async("org.mpris.MediaPlayer2.ChimkenMuziks")
|
|
26
|
+
|
|
27
|
+
# Export both interfaces to the standard MPRIS object path
|
|
28
|
+
object_path = "/org/mpris/MediaPlayer2"
|
|
29
|
+
|
|
30
|
+
self.root_interface.export_to_dbus( object_path )
|
|
31
|
+
self.player_interface.export_to_dbus( object_path )
|
|
32
|
+
|
|
33
|
+
loop.run_until_complete( main() )
|
|
34
|
+
# This keeps the D-Bus listener running indefinitely in the background thread
|
|
35
|
+
loop.run_forever()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ChimkenMPRIS
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A small MPRIS server made for my app but also usable
|
|
5
|
+
Author: sand
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: github, https://github.com/sandbuster2005/Chimken-MPRIS.git
|
|
8
|
+
Keywords: chimken,MPRIS,dbus
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
12
|
+
Requires-Python: >=3.9
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: sdbus
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
|
|
18
|
+
A small MPRIS server made for my app but also usable
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
PYPI_README.md
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
src/ChimkenMPRIS/Player.py
|
|
6
|
+
src/ChimkenMPRIS/Root.py
|
|
7
|
+
src/ChimkenMPRIS/__init__.py
|
|
8
|
+
src/ChimkenMPRIS/main.py
|
|
9
|
+
src/ChimkenMPRIS.egg-info/PKG-INFO
|
|
10
|
+
src/ChimkenMPRIS.egg-info/SOURCES.txt
|
|
11
|
+
src/ChimkenMPRIS.egg-info/dependency_links.txt
|
|
12
|
+
src/ChimkenMPRIS.egg-info/requires.txt
|
|
13
|
+
src/ChimkenMPRIS.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
sdbus
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ChimkenMPRIS
|