Code Monkey home page Code Monkey logo

Comments (26)

acrisci avatar acrisci commented on May 25, 2024 2

Hey, I'm redesigning the dbus-native service interface so it can work for this project.

https://github.com/acrisci/node-dbus-next

See a working example here.

Let me know what you think.

from mpris-service.

acrisci avatar acrisci commented on May 25, 2024 2

😎

from mpris-service.

acrisci avatar acrisci commented on May 25, 2024 1

Another problem with dbus-native is it has a very unusual and undocumented variant object format you'd need to write a converter for.

The current library node-dbus is no better. It completely ignores the types of the properties. There is no way to represent "1.0" as anything other than a byte which is needed for volume and rate.

I'm beginning to think the best way to fix this is to just write your own dbus service in C because there's not a good library for writing the services in node.

from mpris-service.

martpie avatar martpie commented on May 25, 2024 1

Can I say I love you guys?

from mpris-service.

acrisci avatar acrisci commented on May 25, 2024 1

@martpie can you open a new issue with some more information on the error?

from mpris-service.

emersion avatar emersion commented on May 25, 2024

You mean, switch to https://github.com/sidorares/node-dbus?

Yeah, that would be much better. What's more, the currently used dbus implementation makes fixing bugs like #1 very difficult.

from mpris-service.

emersion avatar emersion commented on May 25, 2024

Service implementation example: https://github.com/sidorares/node-dbus/blob/master/examples/service/server2.js

from mpris-service.

YurySolovyov avatar YurySolovyov commented on May 25, 2024

I'd looked into this, but I have 0 experience with dbus and this repo does not have any tests, so I either need some guidance or need to add some tests

from mpris-service.

emersion avatar emersion commented on May 25, 2024

I think the first thing to do would be to describe the org.mpris.MediaPlayer2 interface with an object like this: https://github.com/sidorares/node-dbus/blob/master/examples/service/server2.js#L15

Letters used are data types (yeah, it kind of sucks), here is the spec: https://dbus.freedesktop.org/doc/dbus-specification.html#type-system

It seems that for methods, the last item in the types list is the return value. All others are arguments.

Then, we'll need to implement org.mpris.MediaPlayer2 with JS functions. d-feet is a great tool to debug this.

Tests are a very good idea, but I don't really know how to implement them. Created an issue for that: #7

from mpris-service.

YurySolovyov avatar YurySolovyov commented on May 25, 2024

actually, that module is not purely native too, instead, it uses abstract-socket as optional dependency (or claims to do so).

see sidorares/dbus-native#92

from mpris-service.

acrisci avatar acrisci commented on May 25, 2024

Yeah looked over the code and what it would take to patch the current dbus library, and I think it's easier just to write it out. Working on this now.

from mpris-service.

acrisci avatar acrisci commented on May 25, 2024

I found a bug in 0.2.5 of dbus-native that won't handle functions that return nothing, but it's fixed in the master branch.

from mpris-service.

acrisci avatar acrisci commented on May 25, 2024

Now I have found that the org.freedesktop.DBus.Properties interface is not fully implemented and not overridable in the dbus-native project which is a big problem.

from mpris-service.

emersion avatar emersion commented on May 25, 2024

Thanks for looking into this! Indeed we do need a full org.freedesktop.DBus.Properties implementation, do you know if a big piece of it is missing or if it's easy to add it?

from mpris-service.

acrisci avatar acrisci commented on May 25, 2024

There's an internal implementation of the properties interface that's different from the exported interface implementation. There's no way to emit events on the internal implementation, so we can't emit PropertiesChanged which is required to make playerctl work.

The Set method of properties is not implemented.

There's no way to make a property readonly either.

I'll do some probing PRs and see if the maintainer has a will to make this work.

from mpris-service.

emersion avatar emersion commented on May 25, 2024

Eh, these are pretty severe limitations. :\

from mpris-service.

emersion avatar emersion commented on May 25, 2024

Looks great! Keep up the good work!

from mpris-service.

martpie avatar martpie commented on May 25, 2024

@emersion Can we expect a release soon?

from mpris-service.

emersion avatar emersion commented on May 25, 2024

Yes. I wonder if this should be a new major release. @acrisci, thoughts?

from mpris-service.

acrisci avatar acrisci commented on May 25, 2024

Yes definitely a new major release. I'm pretty confident it works ok.

Electron integration is what worries me a little. I've tested it in the Electron sample app and it works fine. However, I can't get it to work in GPMDP. I think they might have some security thing that's disabling the node interfaces. I'm still looking into it.

from mpris-service.

acrisci avatar acrisci commented on May 25, 2024

Ok just figured it out. They use an invalid interface name (includes the - character). Once I change those to _ it works fine. Going to add some validation for that.

from mpris-service.

emersion avatar emersion commented on May 25, 2024

Nice. I'll wait a little to get your fix in.

from mpris-service.

acrisci avatar acrisci commented on May 25, 2024

@emersion I have a branch of GPMDP with mpris functional for playerctl. Ready for release 👍 .

from mpris-service.

emersion avatar emersion commented on May 25, 2024

2.0 released! 🎉

Thanks again for your hard work!

from mpris-service.

acrisci avatar acrisci commented on May 25, 2024

MarshallOfSound/Google-Play-Music-Desktop-Player-UNOFFICIAL-#3513

from mpris-service.

martpie avatar martpie commented on May 25, 2024

@acrisci When trying to use mpris-service in Electron 4, I get an error with BigInt

A JavaScript error occured in the main process
Uncaught Exception:
TypeError: JSBI.BigInt is not a function

I am a bit confused because Electron 4 is based on Node 10 so everything "should" work, any idea?

require('node-dbus-next').setBigIntCompat(true) does not seem to change anything

from mpris-service.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.