Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1091489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:32:09+00:00 2026-05-16T23:32:09+00:00

basically the problem is, that the only way to get all instances of VLC

  • 0

basically the problem is, that the only way to get all instances of VLC is to search all non-named instances for the org.freedesktop.MediaPlayer identity function and call it.

(alternatively I could use the introspection API, but this wouldn’t seem to solve my problem)
Unfortunately many programs upon having sent a dbus call, simply do not respond, causing a long and costly timeout.

When this happens multiple times it can add up.
Basically the builtin timeout is excessively long.

If I can decrease the dbus timeout somehow that will solve my problem, but the ideal solution would be a way.

I got the idea that I could put each call to “Identify” inside a thread and that I could kill threads that take too long, but this seems not to be suggested. Also adding multithreading greatly increases the CPU load while not increasing the speed of the program all that much.

here is the code that I am trying to get to run quickly (more or less) which is currently painfully slow.

import dbus
bus = dbus.SessionBus()
dbus_proxy = bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus')
names = dbus_proxy.ListNames()
for name in names:
    if name.startswith(':'):
        try:
            proxy = bus.get_object(name, '/')
            ident_method = proxy.get_dbus_method("Identity",     
                dbus_interface="org.freedesktop.MediaPlayer")

            print ident_method()

        except dbus.exceptions.DBusException:
            pass
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:32:10+00:00Added an answer on May 16, 2026 at 11:32 pm

    Easier than spawning a bunch of threads would be to make the calls to the different services asynchronously, providing a callback handler for when a result comes back or a D-Bus error occurs. All of the calls effectively happen in parallel, and your program can proceed as soon as it gets some positive results.

    Here’s a quick-and-dirty program that prints a list of all the services it finds. Note how quickly it gets all the positive results without having to wait for any timeouts from anything. In a real program you’d probably assign a do-nothing function to the error handler, since your goal here is to ignore the services that don’t respond, but this example waits until it’s heard from everything before quitting.

    #! /usr/bin/env python
    
    import dbus
    import dbus.mainloop.glib
    import functools
    import glib
    
    class VlcFinder (object):
        def __init__ (self, mainloop):
            self.outstanding = 0
            self.mainloop = mainloop
    
            bus = dbus.SessionBus ()
            dbus_proxy = bus.get_object ("org.freedesktop.DBus", "/org/freedesktop/DBus")
            names = dbus_proxy.ListNames ()
            for name in dbus_proxy.ListNames ():
                if name.startswith (":"):
                    proxy = bus.get_object (name, "/")
                    iface = dbus.Interface (proxy, "org.freedesktop.MediaPlayer")
                    iface.Identity (reply_handler = functools.partial (self.reply_cb, name),
                                    error_handler = functools.partial (self.error_cb, name))
                    self.outstanding += 1
    
        def reply_cb (self, name, ver):
            print "Found {0}: {1}".format (name, ver)
            self.received_result ()
    
        def error_cb (self, name, msg):
            self.received_result ()
    
        def received_result (self):
            self.outstanding -= 1
            if self.outstanding == 0:
                self.mainloop.quit ()
    
    if __name__ == "__main__":
        dbus.mainloop.glib.DBusGMainLoop (set_as_default = True)
        mainloop = glib.MainLoop ()
        finder = VlcFinder (mainloop)
        mainloop.run ()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically my problem is that i've adapted a piece of code found here http://social.msdn.microsoft.com/Forums/en-US/vemapcontroldev/thread/62e70670-f306-4bb7-8684-549979af91c1
So basically, I've run into this problem enough times that it is seriously frustrating
I have a pretty simple problem. Basically I have an array called $list that
I've a problem with LINQ. Basically a third party database that I need to
I have some localization problems in my webpage. There are basically two problems (that
Basically my problem is with the page at http://wiki.diablocommunity.com/index.php?title=Tristram_Cathedral Please see the screen shots
Im stuck with this little project in C# but basically my problem is this:
Okay guys, basically the problem I'm having is this. I've been assigned to write
I'm having a problem with the SetLength command. It's basically this problem: I work
My problem is basically the same than this one but on windows 7: How

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.