/usr/bin/ontv-dbus is in ontv 3.2.0-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2010 Olof Kindgren <olki@src.gnome.org>
# This file is part of OnTV.
# OnTV is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# OnTV is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with OnTV; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
from dbus import SessionBus, Interface
from optparse import OptionParser
class OnTVDbus:
"""Simple frontend for sending messages to running OnTV instance"""
def __init__(self):
parser = OptionParser()
parser.add_option("-u", "--update-listings",
action="store_true",
help="Update listings")
parser.add_option("-t", "--toggle-program-window",
action="store_true",
help="Toggle visibility of the program window")
parser.add_option("-s", "--search",
action="store_true",
help="Show search dialog")
(options, args) = parser.parse_args()
remote_object = self.__get_running_instance()
if remote_object:
if options.update_listings:
remote_object.UpdateListings()
if options.toggle_program_window:
remote_object.ToggleWindow()
if options.search:
remote_object.ShowSearch()
else:
print("Couldn't find a running OnTV instance")
def __get_running_instance(self):
session_bus = SessionBus()
dbus_object = session_bus.get_object('org.freedesktop.DBus',
'/org/freedesktop/DBus')
dbus_iface = Interface(dbus_object, 'org.freedesktop.DBus')
services = dbus_iface.ListNames()
if "org.gnome.OnTV" in services:
return session_bus.get_object("org.gnome.OnTV","/DBusService")
return False
if __name__ == "__main__":
ontv_dbus = OnTVDbus()
|