add commandline script
This commit is contained in:
parent
e44dad7dec
commit
66f09da616
2 changed files with 44 additions and 2 deletions
41
bin/pandora_client
Executable file
41
bin/pandora_client
Executable file
|
@ -0,0 +1,41 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
|
# GPL 2008
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
from optparse import OptionParser
|
||||||
|
|
||||||
|
root = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')
|
||||||
|
if os.path.exists(os.path.join(root, 'pandora_client')):
|
||||||
|
sys.path.insert(0, root)
|
||||||
|
|
||||||
|
|
||||||
|
import pandora_client
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
usage = "usage: %prog [options] action"
|
||||||
|
parser = OptionParser(usage=usage)
|
||||||
|
parser.add_option('-c', '--config', dest='config', help='config.json containing config', default='~/.ox/client.json', type='string')
|
||||||
|
(opts, args) = parser.parse_args()
|
||||||
|
|
||||||
|
opts.config = os.path.expanduser(opts.config)
|
||||||
|
if None in (opts.config, ) or not os.path.exists(opts.config):
|
||||||
|
parser.print_help()
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
if not args or args[0] not in ('scan', 'sync', 'clean'):
|
||||||
|
parser.error('you must specify a valid action. \n\t\tknown actions are: scan, sync, clean')
|
||||||
|
|
||||||
|
action = args[0]
|
||||||
|
|
||||||
|
c = pandora_client.Client(opts.config)
|
||||||
|
if action == 'scan':
|
||||||
|
c.scan()
|
||||||
|
if action == 'sync':
|
||||||
|
c.sync()
|
||||||
|
if action == 'clean':
|
||||||
|
c.clean()
|
||||||
|
|
||||||
|
|
5
setup.py
5
setup.py
|
@ -13,9 +13,10 @@ def get_bzr_version():
|
||||||
setup(
|
setup(
|
||||||
name="pandora_client",
|
name="pandora_client",
|
||||||
version="1.0.%s" % get_bzr_version() ,
|
version="1.0.%s" % get_bzr_version() ,
|
||||||
description='''pandora_client - headless archive client for pan.do/ra
|
description='''pandora_client - commandline client and python api for pan.do/ra
|
||||||
|
|
||||||
can be used instead of OxFF to keep archive and pan.do/ra instance in sync.
|
can be used interact with pan.do/ra instance via its api.
|
||||||
|
or instead of OxFF to keep archive and pan.do/ra instance in sync.
|
||||||
''',
|
''',
|
||||||
author="j",
|
author="j",
|
||||||
author_email="j@mailb.org",
|
author_email="j@mailb.org",
|
||||||
|
|
Loading…
Reference in a new issue