/usr/bin/dmedia-cli is in dmedia-importer 0.6.0~repack-1build1.
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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | #!/usr/bin/python
# Authors:
# Jason Gerard DeRose <jderose@novacut.com>
# David Green <david4dev@gmail.com>
#
# dmedia: distributed media library
# Copyright (C) 2010, 2011 Jason Gerard DeRose <jderose@novacut.com>
#
# This file is part of `dmedia`.
#
# `dmedia` is free software: you can redistribute it and/or modify it under the
# terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# `dmedia` 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 Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with `dmedia`. If not, see <http://www.gnu.org/licenses/>.
"""
Command line tool for talking to dmedia DBus services.
"""
from __future__ import print_function
import argparse
import json
import dmedia
from dmedia.constants import BUS
parser = argparse.ArgumentParser(
description='Execute methods on dmedia DBus services',
)
parser.add_argument('--version', action='version', version=dmedia.__version__)
parser.add_argument('--bus',
help='DBus bus name; default is %(default)r',
default=BUS,
)
subparsers = parser.add_subparsers(
title='Commands from {!r}'.format(BUS)
)
p_version = subparsers.add_parser('version',
help='get version of running dmedia service',
)
def do_version(dm, args):
print(
'{} {}'.format(args.bus, dm.version())
)
p_version.set_defaults(func=do_version)
p_kill = subparsers.add_parser('kill',
help='kill `dmedia-service`',
)
def do_kill(dm, args):
print('Killing {}...'.format(args.bus))
dm.kill()
p_kill.set_defaults(func=do_kill)
p_get_env = subparsers.add_parser('get-env',
help='echo out JSON encoded env dict',
)
def do_get_env(dm, args):
print(json.dumps(dm.get_env(), sort_keys=True, indent=2))
p_get_env.set_defaults(func=do_get_env)
p_get_auth_url = subparsers.add_parser('get-auth-url',
help='echo desktopcouch basic auth URL',
)
def do_get_auth_url(dm, args):
print(dm.get_auth_url())
p_get_auth_url.set_defaults(func=do_get_auth_url)
p_has_app = subparsers.add_parser('has-app',
help='show whether the WebUI app is available',
)
def do_has_app(dm, args):
print(bool(dm.has_app()))
p_has_app.set_defaults(func=do_has_app)
args = parser.parse_args()
from dmedia.api import DMedia
dm = DMedia(args.bus)
args.func(dm, args)
|