Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion - MPRIS #166

Open
elkrien opened this issue Aug 30, 2022 · 5 comments
Open

Suggestion - MPRIS #166

elkrien opened this issue Aug 30, 2022 · 5 comments
Labels
help-needed Asking users' and early adopters' help to complete a task

Comments

@elkrien
Copy link

elkrien commented Aug 30, 2022

Hi there! Congratulations on this project.

Do you plan on adding MPRIS support so it can be controlled with media keys on Linux?

@s-n-g
Copy link
Collaborator

s-n-g commented Aug 31, 2022

Hi @elkrien

This is something that has already been requested in the past, so yes, I will eventually look into it...
But it may take some time... 😉

@jediafr
Copy link

jediafr commented Feb 1, 2023

FYI Mpris can be added to mpv through https://github.com/hoyon/mpv-mpris.
It works on my KDE widget , i can see pyradio title, length and act on volume through it.

One thing would be cool is that Pyradio constitutes a playlist with the searched radios so we could press next to change without having to recall pyradio window.

@s-n-g
Copy link
Collaborator

s-n-g commented Feb 1, 2023

Hi @jediafr

I am aware of the mpv-mpris plugin; vlc also has mpris enabled, and even an mplayer mpris plugin exists.

It's not that I haven't looked into it, but...

I have tried to use mpris-server with PyRadio, but I just cannot seem to get it to work as intended.

The problem is that in order for it to enter the DBus event loop (apparently that's the way it gets to send and receive signals), I have to use

from gi.repository import GLib

loop = GLib.MainLoop()
loop.run()

or similar code, running in a different thread.

And once I do that, the logger starts printing debug messages to the terminal, which actually breaks the TUI, and this happens even when debug is off (-d is not used).

This may be an absolutely fine and acceptable behavior for a GUI application, but for a TUI one, as PyRadio it's a no go.

Now, removing the logger would not be an option; I would not be able to continue the development without it, plus the Titles Logging feature depends on it...

I know this is too technical and all, but I put it up here so that if anyone can provide some help on how to go on with it, I would be grateful

@s-n-g s-n-g added the help-needed Asking users' and early adopters' help to complete a task label Feb 1, 2023
@leleobhz
Copy link

@s-n-g

2 cents here: I dont think using mpv mpris support is the proper way to do this because some radios simply does not export anything on stream metadata, as next screenshot shows:

image

I would suggest to add a "third player" option python-mpv (https://github.com/jaseg/python-mpv) and use this to play and fetch metadata from stream - and if stream does not have any metadata, fullfull mpris data with stations.csv information (name and image).

That said, a little bridge with mpris-server and ptrhon-mpv metadata may help. Using python-mpv does not instantiate an entire mpv thread and allow mpv to be controlled from python instead a IPC socket. And also allow a better metadata handling.

About mpris-server, you posted GLib example, but the functional example at https://github.com/alexdelorenzo/mpris_server?tab=readme-ov-file#example does not use this kind of instancing. Is this right?

@s-n-g
Copy link
Collaborator

s-n-g commented May 22, 2024

Thank you for the suggestion @leleobhz

I will look into this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help-needed Asking users' and early adopters' help to complete a task
Projects
None yet
Development

No branches or pull requests

4 participants