Skip to content
This repository has been archived by the owner on Dec 5, 2020. It is now read-only.

MPRIS metadata is null (again) #82

Closed
crobe87 opened this issue Oct 4, 2016 · 14 comments
Closed

MPRIS metadata is null (again) #82

crobe87 opened this issue Oct 4, 2016 · 14 comments
Assignees
Milestone

Comments

@crobe87
Copy link

crobe87 commented Oct 4, 2016

Apart from the recent master that can't build, I tried a few older commits trees to see if MPRIS was working...
and this is back again:

WARNING **: MPRIS.vala:167: MPRIS metadata is null

tried up to https://github.com/haecker-felix/gradio/tree/eca48a42fd7d69be593795a7e9652d5b0607edcc

old similar issue: #38

@haecker-felix
Copy link
Owner

haecker-felix commented Oct 7, 2016

Which desktop shell? Which OS?

Cannot reproduce. Please try it with the latest commit. Build error is fixed :)

@crobe87
Copy link
Author

crobe87 commented Oct 8, 2016

Latest commit:
Ubuntu 16.04 running i3 tiling wm.
Metatag artist-title is showing correctly in gradio GUI in multiple radios.
But terminal output still says metatag is null. So other apps read metatag as null.
e.g. my i3 dock bar that uses playerctl to read mpris shows null too (it work with vlc or other players).

As you can see, it shows metatag is null just on the first time I start a radio, then it stays (null) even though it doesn't reissue the warning every time I start a new radio.

gradio output:

** Message: main.vala:6: Starting Gradio version 5.0.0b2!
** Message: Library.vala:107: Reading library data from: /home/username/.local/share/gradio/library.gradio
** Message: Library.vala:132: Successfully imported library
** Message: MPRIS.vala:34: Successfully initialized MPRIS session.
** Message: MainWindow.vala:76: Desktop session is: i3
** Message: CategoryItemProvider.vala:36: Fetching category items...
** Message: StationProvider.vala:82: Requested results from 0 to 20
** Message: StationProvider.vala:82: Requested results from 0 to 20
** Message: StationProvider.vala:82: Requested results from 0 to 20
** Message: Util.vala:96: Loaded CSS from: /usr/local/share/gradio/gradio.css
** Message: CategoryItemProvider.vala:127: Successfully loaded category items!
** Message: DiscoverSidebar.vala:127: Loading category items...
** Message: RadioStation.vala:86: Playable url: http://sc-blues.1.fm:8030/

** (gradio:26758): WARNING **: MPRIS.vala:167: MPRIS metadata is null

** (gradio:26758): WARNING *: MPRIS.vala:167: MPRIS metadata is null
*
Message: RadioStation.vala:86: Playable url: http://media-the.musicradio.com/RadioXLondon
** Message: RadioStation.vala:86: Playable url: http://svr1.msmn.co:8136
** Message: RadioStation.vala:86: Playable url: http://bbcmedia.ic.llnwd.net/stream/bbcmedia_lrmanc_mf_p
** Message: RadioStation.vala:86: Playable url: http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio2_mf_p
** Message: RadioStation.vala:86: Playable url: http://89.16.185.174:8003/stream
** Message: RadioStation.vala:86: Playable url: http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio4fm_mf_p
** Message: RadioStation.vala:86: Playable url: http://msmn.co:8118/;stream

playerctl -l

gradio

playerctl status

Playing

playerctl metatag artist

(null)

playerctl metatag title

(null)

@haecker-felix
Copy link
Owner

The two "MPRIS metadata is null" messages are normal. Happens because the MPRIS backend isn't loaded at the startup yet. Yes I should "fix" this.

Gradio use following tags:

_metadata.insert("mpris:trackid", station_id);
_metadata.insert("mpris:artUrl", station_icon);
_metadata.insert("xesam:artist", artists);

I've never used i3. But the mpris tray/box (whatever) detects gradio?

@crobe87
Copy link
Author

crobe87 commented Oct 8, 2016

Yes, it detects gradio. My tray uses "playerctl", mpris command-line controller (link here with a quick readme https://github.com/acrisci/playerctl , compatible with spotify, vlc, audacious, bmp, xmms2, and others).

You see I posted the output of the command playerctl -l, that means list all active players using the MPRIS D-Bus Interface, and it shows gradio there.
When I ask about status and gradio is playing, playerctl shows "playing". So that's working.

Playerctl can also stop and resume playing from cli by issuing the command "playerctl stop/play", and gradio stops/plays correctly.
e.g. I mapped "playerctl stop" and "playerctl play" to my media keys and can stop/resume gradio correctly.
So it's working.
It's just a problem with metadata.

There must be something in gradio because playerctl shows the metadata correctly with vlc and many other players in my system.
It's just gradio that shows (null)

@crobe87
Copy link
Author

crobe87 commented Oct 10, 2016

I've read a bit about qdbus
other players spit out all playing info with this command:

qdbus org.mpris.MediaPlayer2.playername /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata

e.g. VLC

qdbus org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata

output:

mpris:trackid:
vlc:publisher: 9
xesam:genre: BLues
xesam:title: 1.FM - BLUES RADIO
xesam:url: http://69.46.90.84:5018

If I do the same on gradio:

qdbus org.mpris.MediaPlayer2.gradio /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata

outputs:

Error: org.freedesktop.DBus.Error.InvalidArgs
Proprietà "Metadata" inesistente
(italian for "Metadata" property doesn't exist)

mpris.vala line 209 is commented/incomplete

    /*public HashTable<string,Variant>? Metadata {
        owned get {
            return _metadata;
        }
    }*/

@crobe87
Copy link
Author

crobe87 commented Oct 10, 2016

just did a very dirty test on mpris.vala...

If I:

  • uncomment the lines 209-213
  • comment 93-94 (where it does set metadata=NULL),
  • delete " = null" from line 84,

it works as long as I quickly click on a radio on opening, otherwise it goes into a segfault:

GLib-CRITICAL **: g_hash_table_iter_init: assertion 'hash_table != NULL' failed
Segmentation fault

But this proves that the problem is in gradio. With those mods qdbus works fine on gradio too:

qdbus org.mpris.MediaPlayer2.gradio /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata

outputs:

mpris:artUrl: http://cdn-radiotime-logos.tunein.com/s47716q.png
mpris:trackid: 88934
xesam:artist: 1.FM - Blues Radio
xesam:title: Floyd Lee - High Maintenance Woman

So the problem is how the Metadata property is handled inside mpris.vala

@haecker-felix
Copy link
Owner

haecker-felix commented Oct 10, 2016

Yeah I know the current mpris implementation is very buggy.

But the crazy thing is: MPRIS works flawless for me, but not for you.

Nevertheless I have to rewrite the complete mpris class.

But exactly these things I want to fix/improve in the 5.0 release. That's why I release betas of 5.0.0 ;).

But thanks a lot for your investigation!

@crobe87
Copy link
Author

crobe87 commented Oct 10, 2016

If you copy paste this command in terminal, (one long line):
qdbus org.mpris.MediaPlayer2.gradio /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata

it works to you?
To me, git cloned right now, it's outputting:

Error: org.freedesktop.DBus.Error.InvalidArgs
Proprietà "Metadata" inesistente
(italian for "Metadata" property doesn't exist)

It outputs fine only after I mod mpris.vala as I said before (enabling metadata and deleting every "metadata = null", but then I get a random segfault):

mpris:artUrl: http://www.cdnx.co.uk/public/img/cdxn-og-logo.png
mpris:trackid: 88074
xesam:artist: CDNX 1 - Classic & New Indie Alt
xesam:title: Kauf - Key To Life

Give a look at vlc/clementine/vocal code on github and compare to yours. It may quicken things.

@haecker-felix
Copy link
Owner

I have to admit I have stolen some lines from the vocal source code ^^. (Because it also written in vala)

But this evening I will start to code on the new mpris class.

@haecker-felix
Copy link
Owner

haecker-felix commented Oct 10, 2016

@crobe87 Could you try this?

http://pastebin.com/c6mRAPgX

Thanks.

(yes i know: current title is missing)

Edit: Forget it. I have also modified other classes. You can't compile.

@crobe87
Copy link
Author

crobe87 commented Oct 10, 2016

make of http://pastebin.com/c6mRAPgX fails with:
http://pastebin.com/VBqBCHyn
EDIT: didn't see your edit!

@haecker-felix haecker-felix added this to the Gradio 5.0 milestone Oct 10, 2016
@haecker-felix haecker-felix self-assigned this Oct 10, 2016
@haecker-felix
Copy link
Owner

Try again now. I've pushed the latest changes.

@crobe87
Copy link
Author

crobe87 commented Oct 10, 2016

Perfect. It works great now, thank you!
my bar works, qdbus works, playerctl works.

Only little thing is that in terminal there is this message that spawns every second:

** Message: mpris.vala:304: mpris position is not supported

Just to let you know, don't know if is wanted or not.

Attaching terminal output:
http://pastebin.com/DKwxrb0J

@haecker-felix
Copy link
Owner

Thanks for quick answer!

These messages are just for debugging purposes.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants