mpris media controller (WIP)

So you have written that new, must have program. Let us see it here.
User avatar
BruceSteers
Posts: 1884
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

mpris media controller (WIP)

Post by BruceSteers »

I've been making a new thing that some of you may find interesting or even useful.

it's a DBus mpris.MediaPlayer2 controller.

What i have so far..

The program opens a tray icon on launch.

Right clicking the icon shows the menus.

A menu is created for any found controlable DBus mpris players
(things like vlc, firefox (youtube), SMplayer, Spotify, many other media players)

The related players icon is shown and the menu will contain Rewind/Prev/Pause+Play/Next/Forward options.
If the player does not support Rewind/Prev/etc options the menu only shows what's supported.
Rewind and Forward menu options will go 10 seconds

also you can left click the Tray icon to open the window
In the window the players are listed with controls and a position slider (if available)

It's new and pretty untested and may give some errors yet but maybe you like the idea and it inspires you to do better :)

Todo:
Add Volume and other controls but i cannot get the Volume DBus command to use a Double (Float) instead of a Variable
Sort out the interface as it needs to be flashy/cool/changable :)

Much much much more error checking and improvements.
Attachments
Screenshot at 2023-01-29 16-48-19.png
Screenshot at 2023-01-29 16-48-19.png (723.63 KiB) Viewed 10478 times
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1884
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: mpris media controller (WIP)

Post by BruceSteers »

Okay , updates...

I figured out Volume , also how to set LoopStatus and Shuffle

Added a signal watcher that detects DBus MPRIS events like Volume/Position changes so updates instantly.
(Seems there is no way to tell what program sent the signal so on getting notification it checks all controllers)

I removed the Info Label and put the info in a Tooltip to make it more compact

Position slider/Volume/controls will hide what's not available

Still a long way to go but it's coming along nicely :)
Attachments
Screenshot at 2023-01-30 15-25-53.png
Screenshot at 2023-01-30 15-25-53.png (832.33 KiB) Viewed 10463 times
If at first you don't succeed , try doing something differently.
BruceS
User avatar
cogier
Site Admin
Posts: 1160
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: mpris media controller (WIP)

Post by cogier »

I have downloaded your program to see if it could help me, but it crashed.

When I clicked on the TrayIcon I got a blueish rectangle in the middle of the monitor, nothing else, just a blue rectangle. I clicked on the 'PlayerControl' button that caused the crash.

Is it me or some other issue?

Image
User avatar
BruceSteers
Posts: 1884
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: mpris media controller (WIP)

Post by BruceSteers »

hmm, I've done a few updates since and cannot get the error on Cinnamon , it seems to work (ish)

Did you have no mpris players loaded at the time? (I've since added handling to not open the window if no players exist)
Players I know of so far...
Firefox video, SMplayer, VLC, Spotify

SMplayer is not great, it always reports it's volume as 0.4 regardless what it's set to, this causes a glitch in the program i need to account for :-\

Also there seems to be a position sliding issue where sometimes the slider updates to the current position before it sets the position to somewhere else after sliding.
Attachments
MControl-0.0.17.tar.gz
(19.72 KiB) Downloaded 511 times
If at first you don't succeed , try doing something differently.
BruceS
User avatar
cogier
Site Admin
Posts: 1160
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: mpris media controller (WIP)

Post by cogier »

Hi Bruce, Sorry, I am not having much luck with this.

I doesn't seem to matter what I do, nothing, other than 'Quit', appears on the menu.

Image
Image

I was going to try Firefox but on relaunching the program it put a 'No Entry' sign on the taskbar and the Console in Gambas announced 'gb.desktop: unable to get icon for file:'.

What I am after is to allow Mint to be able to access my program as YouTube can, through Chrome, as you can see in the second picture.
User avatar
BruceSteers
Posts: 1884
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: mpris media controller (WIP)

Post by BruceSteers »

Maybe if you give your program it's own mpris interface? then the existing controller will probably see it?

Dunno why you have problems with the program?
it works here.
If at first you don't succeed , try doing something differently.
BruceS
User avatar
cogier
Site Admin
Posts: 1160
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: mpris media controller (WIP)

Post by cogier »

OK Thanks, I'll have to look into MPRIS.
User avatar
BruceSteers
Posts: 1884
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: mpris media controller (WIP)

Post by BruceSteers »

cogier wrote: Thursday 2nd February 2023 12:49pm OK Thanks, I'll have to look into MPRIS.
oooh it's complicated.
So far I have a half built project that adds mpris to MediaView

My DBus experience is not good enough i think though.
I think i'll add another post about it and see if anyone can help make it work properly.
If at first you don't succeed , try doing something differently.
BruceS
User avatar
cogier
Site Admin
Posts: 1160
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: mpris media controller (WIP)

Post by cogier »

Hi Bruce, please don't go out of your way on my account. I just thought that it would be easy, which, it obviously isn't!
User avatar
BruceSteers
Posts: 1884
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: mpris media controller (WIP)

Post by BruceSteers »

Aah but it's worth it 😎

Did you sre my post on the m/l ?
I'm part way there
https://lists.gambas-basic.org/pipermai ... 78331.html
If at first you don't succeed , try doing something differently.
BruceS
Post Reply