Report current track via MPRIS DBus interface

Bug #1326653 reported by Daniel Schürmann
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Mixxx
In Progress
Wishlist
David Hernández Morales

Bug Description

This is a follow up from this bug: Bug #1326596

It would be nice if we report the current track via MPRIS DBus interface.

See:
Qt's QDBus* classes http://qt-project.org/doc/qt-4.8/qtdbus.html
https://code.google.com/p/qmmp/source/browse/branches/qmmp-0.5/src/plugins/General/mpris/mpris.cpp?r=2132

Related: Bug #918199

Changed in mixxx:
status: New → Confirmed
importance: Undecided → Wishlist
Revision history for this message
Shwan (shwan-ciyako) wrote :

Hi Daniel
I am very interested in solving this situation, have a friend that might be able to help me out in putting together some code, but if I am going to try doing it by myself, as I am a hardware engineer, this will take me time without help.
My current idea was to add that in the autodj part of the code. you said that QT has support for it. is there any file in the source of Mixxx that handles the data I want to get that you can pint me to?
giving a guide/idea about where in the source and what to edit and kind of suggestion about the implementation will probably help me out a lot on the way.

We would like to knoe at least the comming 10 songs, or minimal the playing and next deck, using 4 decks also is an option .

Revision history for this message
holber (mikael-holber) wrote :

The list of information we request (also applies to COM-server and applescript/scriptbridge) are:

Artist
AlbumArtist
Album
Title
Genre
Year
Performer
Comment
Composer
fileURL

Revision history for this message
Daniel Schürmann (daschuer) wrote :

Hi Shwan,

cool!

First you should make sure you environment is prepared. Are you able to build the latest master and are you able to single step though the code?
This link may help getting you up http://www.mixxx.org/wiki/doku.php/bugfix_workflow otherwise just ask.

I think the MPRIS clients expect a single player like all other media players. For your requirements it seams to be the best to let the clients believe that Mixxx is such a player.
We can only predict the next track reliable when Auto DJ is enabled. In this state, the next tracks is loaded to a deck but still on top of the Auto DJ play list. So there is no need to deal with four decks.

The current playing deck, you will get from the PlayerInfo::getCurrentPlayingTrack a singelton class in src/playerinfo.cpp
To implement only this seams to be a reasonable fist step.

For the following tracks you may interface somehow with the AutoDJ src/library/autodj/autodjprocessor.cpp
the tracks are located in m_pAutoDJTableModel

I have not much experience with DBus, but this seams to be a good tutorial:
https://techbase.kde.org/Development/Tutorials#D-Bus

Hope that helps.

Revision history for this message
Daniel Schürmann (daschuer) wrote :

This may help as well:
https://github.com/mixxxdj/mixxx/blob/a74c65d6469a2f1ce0d1927ffbd73be90bf754c5/src/engine/sidechain/enginerecord.cpp#L124

> The list of information we request ...

Yes, no problem. You can query all that by pTrack->getXXX() functions.

Revision history for this message
holber (mikael-holber) wrote : Re: [Bug 1326653] Re: Report current track via MPRIS DBus interface

Great! I will get both Shwan and Horia working on this ;)

On Mon, Jan 26, 2015 at 3:50 PM, Daniel Schürmann <
<email address hidden>> wrote:

> This may help as well:
>
> https://github.com/mixxxdj/mixxx/blob/a74c65d6469a2f1ce0d1927ffbd73be90bf754c5/src/engine/sidechain/enginerecord.cpp#L124
>
> > The list of information we request ...
>
> Yes, no problem. You can query all that by pTrack->getXXX() functions.
>
> --
> You received this bug notification because you are subscribed to a
> duplicate bug report (1414572).
> https://bugs.launchpad.net/bugs/1326653
>
> Title:
> Report current track via MPRIS DBus interface
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/mixxx/+bug/1326653/+subscriptions
>

Revision history for this message
Daniel Schürmann (daschuer) wrote :

Hi holber,

I have got recently a request to interface Mixxx with a beamer.
How is the status of this project? Do you need help?
Thank you for the updates.

Kind regards,

Daniel

Revision history for this message
holber (mikael-holber) wrote :

Hi Daniel,

I tried to mobilize some resources here but with little luck. I do not have
any experience with QT so I would need a lot of help. If you could help me
it would be great! The project is available at http://www.beam-project.com

We are currently in the process of moving the repository from google-code
as they are closing down, so use the binary releases if you want to try it
out.

The obvious information we would need is "Current song" which is playing to
the public (not headphones). If there is any intuitive way of predicting
the next track that will be played (or if it is used in playlist-mode) this
would be very useful as well. This is of course complementary information
that requires the user to use Mixxx in a specific, predefined way.

The information that our application will access is the following from each
song:

Artist
AlbumArtist
Album
Title
Genre
Year
Performer
Comment
Composer
fileURL

We then structure the information as following:
 CURRENTSONG PREVIOUSSONG NEXTSONG NEXTTANDA%Artist %PreviousArtist
 %NextArtist %NextTandaArtist%AlbumArtist %PreviousAlbumArtist
 %NextAlbumArtist %NextTandaAlbumArtist%Album %PreviousAlbum %NextAlbum
 %NextTandaAlbum%Title %PreviousTitle %NextTitle %NextTandaTitle%Genre
 %PreviousGenre %NextGenre %NextTandaGenre%Comment %PreviousComment
 %NextComment %NextTandaComment%Composer %PreviousComposer %NextComposer
 %NextTandaComposer%Performer %PreviousPerformer %NextPerformer
 %NextTandaPerformer%Year %PreviousYear %NextYear %NextTandaYear%Singer
 %PreviousSinger %NextSinger %NextTandaSinger%IsCortina %PreviousIsCortina
 %NextIsCortina

Previous song is saved in the application, This is not live-information.
Current song is obviously current. Next song is read from the playlist.
Next tanda is a "tango specific" expression where we locate the next
"section" of songs based on some rules.

Hope this helps you understand our intention. We are absolutely willing to
adopt Beam to be more general, for this we would need some use-cases.

Best Regards
Mikael

On Tue, Apr 7, 2015 at 11:17 AM, Daniel Schürmann <
<email address hidden>> wrote:

> Hi holber,
>
> I have got recently a request to interface Mixxx with a beamer.
> How is the status of this project? Do you need help?
> Thank you for the updates.
>
> Kind regards,
>
> Daniel
>
> --
> You received this bug notification because you are subscribed to a
> duplicate bug report (1414572).
> https://bugs.launchpad.net/bugs/1326653
>
> Title:
> Report current track via MPRIS DBus interface
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/mixxx/+bug/1326653/+subscriptions
>

Revision history for this message
Daniel Schürmann (daschuer) wrote :

Thank you for your fast responds.

I will try to give you all the support I can.

What could be the mode in which we can work together?
When do you will have time to spend on this?
Do you have already a Mixxx building environment? Do you need help to set one up?

Revision history for this message
holber (mikael-holber) wrote :

My partner Horia will assist you.

Kind regards
Mikael

On Tue, Apr 7, 2015 at 12:50 PM, Daniel Schürmann <
<email address hidden>> wrote:

> Thank you for your fast responds.
>
> I will try to give you all the support I can.
>
> What could be the mode in which we can work together?
> When do you will have time to spend on this?
> Do you have already a Mixxx building environment? Do you need help to set
> one up?
>
> --
> You received this bug notification because you are subscribed to a
> duplicate bug report (1414572).
> https://bugs.launchpad.net/bugs/1326653
>
> Title:
> Report current track via MPRIS DBus interface
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/mixxx/+bug/1326653/+subscriptions
>

Revision history for this message
Daniel Schürmann (daschuer) wrote :

@Horia: Thank you for your help. Pleas contact me to discuss how an when we can start with this.

Revision history for this message
Daniel Schürmann (daschuer) wrote :
Changed in mixxx:
status: Confirmed → In Progress
assignee: nobody → Daniel Schürmann (daschuer)
Revision history for this message
Daniel Schürmann (daschuer) wrote :

Status update:
The MPRIS 2.2 interface is installed.
The root MediaPlayer2 interface is working.
So you can Raise() and Fullscreen() Mixxx remotely
The MediaPlayer2.Player interface is working in some places. It is a bit hard to map this interface to the "current" deck, but it should be possible with some effort.
I am only not sure if it worth the work, because we have no use case for this. So it is probably a good idea to remain in this state until we have one.

The real valid use case that makes me doing this work is the interface to the beam-project.
I have not implemented the meta data interface yet because MPRIS is somehow open how to do it.

@Horia: It is pretty easy to do it on top of my branch.
Here you find how to access the track info object: https://github.com/daschuer/mixxx/blob/mpris/src/mpris/mediaplayer2player.cpp#L30
It should contain all metadata required to display the current track.
If you need additional help, just ask.

Revision history for this message
Horia Uifăleanu (horia-uifaleanu) wrote :

Hi guys,

I have some time these days and I would be happy to start working on Mixxx's DBus interface.

Daniel could you give me some directions to setup my devenv?!

Horia.

Revision history for this message
Daniel Schürmann (daschuer) wrote :

Hi Horia,

Great :-D

A good start to read is here:
http://www.mixxx.org/wiki/doku.php/bugfix_workflow

Where is the point you need help?
Are you familiar with git?
Are you able to build Mixxx from the command line?
What is your favorite IDE?

Daniel

Revision history for this message
Horia Uifăleanu (horia-uifaleanu) wrote :

Hi,

My first question was aiming at this: http://www.mixxx.org/wiki/doku.php/compiling_on_linux . So it is clear now.

Yes, I am familiar with git, with DBus and with Qt as well.
I have just read about Bazaar and perform the necessary setup.

IDE: I like to use Qt Creator even for non-Qt projects

No, I did not managed to build Mixxx from the command line. I got this error:
"horia@horia-ThinkPad-X301:~$ sudo apt-get build-dep mixxx
[sudo] password for horia:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libexpat1-dev' instead of 'libexpat-dev'
Note, selecting 'libshout3-dev' instead of 'libshout-dev'
The following packages have unmet dependencies:
 libjack-dev : Depends: libjack0 (= 1:0.121.3+20120418git75e3e20b-2.1ubuntu1) but it is not going to be installed
E: Build-dependencies for mixxx could not be satisfied.
horia@horia-ThinkPad-X301:~$
"
Horia

Revision history for this message
Daniel Schürmann (daschuer) wrote :

> I have just read about Bazaar

There is no need to, because we have moved the source entirely to GitHub.

> The following packages have unmet dependencies:
> libjack-dev : Depends: libjack0 (= 1:0.121.3+20120418git75e3e20b-2.1ubuntu1) but it is not going to be installed

Strange, I assume you are on Ubuntu Trusty, like me
libjack0 1:0.121.3+20120418git75e3e20b-2.1ubuntu1 is installed.

I can reproduce the issue by installing libjack0

This solves the issue on my system
sudo apt-get install libjack-dev libjack0 portaudio19-dev

It looks like there is a kind of package dead lock with jack 1 and 2
I will file a Bug.

Revision history for this message
Daniel Schürmann (daschuer) wrote :
Revision history for this message
Horia Uifăleanu (horia-uifaleanu) wrote :

Hi Daniel,

I managed to build Mixxx on my machine.
Now, I want to setup my QtCreator as specified here:
http://www.mixxx.org/wiki/doku.php/qtcreator

At a certain point it says:" right click on the top-level directory and
select “Add existing files”, and then select SConstruct from the list. Do
the same for theSConscripts."

It is my first time wotking with SCons, I found the SConstruct file but did
not found SConscripts.

Horia.

On Thu, Jun 11, 2015 at 9:51 AM, Daniel Schürmann <
<email address hidden>> wrote:

> Bug #1464120
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1326653
>
> Title:
> Report current track via MPRIS DBus interface
>
> Status in Mixxx:
> In Progress
>
> Bug description:
> This is a follow up from this bug: Bug #1326596
>
> It would be nice if we report the current track via MPRIS DBus
> interface.
>
> See:
> Qt's QDBus* classes http://qt-project.org/doc/qt-4.8/qtdbus.html
>
> https://code.google.com/p/qmmp/source/browse/branches/qmmp-0.5/src/plugins/General/mpris/mpris.cpp?r=2132
>
> Related: Bug #918199
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/mixxx/+bug/1326653/+subscriptions
>

--
Horia Uifaleanu
email: <email address hidden>

Revision history for this message
Horia Uifăleanu (horia-uifaleanu) wrote :

Hi Daniel,

I managed to build Mixxx on my machine.
Now, I want to setup my QtCreator as specified here: http://www.mixxx.org/wiki/doku.php/qtcreator

At a certain point it says:" right click on the top-level directory and select “Add existing files”, and then select SConstruct from the list. Do the same for theSConscripts."

It is my first time wotking with SCons, I found the SConstruct file but did not found SConscripts.

Horia.

Revision history for this message
Daniel Schürmann (daschuer) wrote :

Sorry, I can't help a lot with Qt Creator.
Can one else jump in?

IMHO you do not need to deal with SConstruct and SConscripts.
Just replacing "make" with "scons" should work.
So you may try to continue with
"Adding a build and a clean target"

Revision history for this message
Horia Uifăleanu (horia-uifaleanu) wrote :

Hi Daniel,

One further question: where is the mpris branch you were reffering upper here in the comments?

I can't find it on th eremote repository:

horia@horia-ThinkPad-X301:~/mixxx$ git branch -r
  origin/1.10
  origin/1.11
  origin/1.12
  origin/1.8
  origin/1.9
  origin/HEAD -> origin/master
  origin/master
  origin/memory-leak
  origin/release-1.11.x-translations
  origin/translator-comments
  origin/trunk_translations
horia@horia-ThinkPad-X301:~/mixxx$

Horia.

Revision history for this message
Horia Uifăleanu (horia-uifaleanu) wrote :

Tests:

Are they any tests written or do you have something in mind for the current MPRIS 2.2 stubs you indicated?
https://github.com/daschuer/mixxx/tree/mpris/src/mpris

Revision history for this message
Daniel Schürmann (daschuer) wrote :

You can pull it into your repro like that

git checkout -b mpris master
git pull https://github.com/daschuer/mixxx.git mpris

Revision history for this message
Daniel Schürmann (daschuer) wrote :

Tests:

I have used D-Feet, to check and invoke the DBus functions.
I think the reference client is Beamer for now :-)

Maybe we can finally invoke d-Bus command line calls from a
Google Test to build unit tests.
All other unit tests are located in the src/test

Revision history for this message
Horia Uifăleanu (horia-uifaleanu) wrote :

I will use D-feet for the quick checks.

Google Test:
In what regards the other tests, a simple scenario testing would be to create a new DBus session to retrieve the info via the DBus interface and compare the results with the values from the singleton PlayerInfo::getCurrentPlayingTrack.
This approach might be suitable for unit tests as well.

MPRIS 2.2 standard:
I will start with the entries for the current playing track but basically, on long term, I would like to go on with all the items specified by MPRIS 2.2

Revision history for this message
Daniel Schürmann (daschuer) wrote :

> I will start with the entries for the current playing track but basically, on long term, I would like to go on with all the items specified by MPRIS 2.2

That sounds reasonable. Just make beamer work! ;-) Thank you.

Revision history for this message
Horia Uifăleanu (horia-uifaleanu) wrote :
Revision history for this message
Horia Uifăleanu (horia-uifaleanu) wrote :

Hi Daniel,

I already have something to commit and for the moment my github username ( horiator ) might not have access yet to https://github.com/daschuer/mixxx.git mpris

Horia.

Revision history for this message
Horia Uifăleanu (horia-uifaleanu) wrote :

Ok. You can ignore my last comment!

I have created a fork and I will issue a pull request.

Horia.

Changed in mixxx:
assignee: Daniel Schürmann (daschuer) → nobody
Revision history for this message
RJ Skerry-Ryan (rryan) wrote :

Due to lack of progress, marking Triaged and clearing assignee. Feel free to revert if it is in fact still in progress :).

Changed in mixxx:
status: In Progress → Triaged
Revision history for this message
Daniel Schürmann (daschuer) wrote :
Changed in mixxx:
status: Triaged → In Progress
assignee: nobody → David Hernández Morales (davidhm)
milestone: none → 2.3.0
Be (be.ing)
Changed in mixxx:
milestone: 2.3.0 → none
Revision history for this message
Swiftb0y (swiftb0y) wrote :

Mixxx now uses GitHub for bug tracking. This bug has been migrated to:
https://github.com/mixxxdj/mixxx/issues/7493

lock status: Metadata changes locked and limited to project staff
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.