diff --git a/README b/README index 86e93b5..485f56d 100644 --- a/README +++ b/README @@ -46,6 +46,8 @@ on a local network or multiple encodings on the same host. to do this you need to install additional dependencies: apt-get install python-twisted python-requests + (on ubuntu 12.04 you need a newer version of requests, + i.e: sudo easy_install -U requests) now run one node in server mode: pandora_client server diff --git a/bin/pandora_client b/bin/pandora_client index 56a52f6..4efbbcd 100755 --- a/bin/pandora_client +++ b/bin/pandora_client @@ -18,12 +18,16 @@ import pandora_client if __name__ == '__main__': usage = "usage: %prog [options] action" parser = OptionParser(usage=usage) + parser.add_option('-v', '--version', dest='version', action="store_true") parser.add_option('-c', '--config', dest='config', help='config.json containing config', default='~/.ox/client.json', type='string') parser.add_option('-d', '--debug', dest='debug', help='output debug information', action="store_true") (opts, args) = parser.parse_args() + if opts.version: + print "%s %s" % (os.path.basename(sys.argv[0]), pandora_client.__version__) + sys.exit(0) opts.config = os.path.expanduser(opts.config) if (args and args[0] not in ('config', 'client') and not os.path.exists(opts.config)): print 'no configuration found, run "%s config" or specify one with -c' % sys.argv[0] @@ -31,7 +35,7 @@ if __name__ == '__main__': if None in (opts.config, ): parser.print_help() - sys.exit() + sys.exit(1) actions = ('scan', 'sync', 'upload', 'extract', 'clean', 'cmd', 'import_srt') config = ('config', 'add_volume') diff --git a/pandora_client/__init__.py b/pandora_client/__init__.py index 545f07d..814913e 100644 --- a/pandora_client/__init__.py +++ b/pandora_client/__init__.py @@ -15,6 +15,7 @@ import socket import sqlite3 import sys import time +import pkg_resources import ox @@ -24,7 +25,7 @@ import utils DEBUG = False -__version__ = '0.2' +__version__ = pkg_resources.require("pandora_client")[0].version socket.setdefaulttimeout(300) CHUNK_SIZE = 1024*1024 diff --git a/setup.py b/setup.py index ba60267..ec049b9 100644 --- a/setup.py +++ b/setup.py @@ -8,13 +8,22 @@ except: def get_bzr_version(): import os + import re info = os.path.join(os.path.dirname(__file__), '.bzr/branch/last-revision') + changelog = os.path.join(os.path.dirname(__file__), 'debian/changelog') if os.path.exists(info): f = open(info) rev = int(f.read().split()[0]) f.close() if rev: return u'%s' % rev + elif os.path.exists(changelog): + f = open(changelog) + head = f.read().strip().split('\n')[0] + f.close() + rev = re.compile('\d+\.\d+\.(\d+)').findall(head) + if rev: + return u"%s" % rev[0] return u'unknown' setup( @@ -36,7 +45,8 @@ It is currently known to work on Linux and Mac OS X. 'pandora_client' ], install_requires=[ - 'ox >= 2.1.541' + 'ox >= 2.1.541', + 'requests >= 1.1.0' ], keywords = [ ], @@ -46,4 +56,3 @@ It is currently known to work on Linux and Mac OS X. 'License :: OSI Approved :: GNU General Public License (GPL)', ], ) -