Commit 697ffbb0 authored by Manuel Günther's avatar Manuel Günther
Browse files

Added 'client' to dumplist command; fixed small bug in db.reverse() function.

parent 1a0ead4d
...@@ -20,7 +20,7 @@ def dumplist(args): ...@@ -20,7 +20,7 @@ def dumplist(args):
r = db.objects( r = db.objects(
protocol=args.protocol, protocol=args.protocol,
purposes=args.purposes, purposes=args.purposes,
#model_ids=args.model_ids, model_ids=(args.client,),
groups=args.groups, groups=args.groups,
languages=args.languages languages=args.languages
) )
...@@ -46,11 +46,16 @@ def add_command(subparsers): ...@@ -46,11 +46,16 @@ def add_command(subparsers):
db = Database() db = Database()
if not db.is_valid():
clients = tuple()
else:
clients = [client.id for client in db.clients()]
parser.add_argument('-d', '--directory', dest="directory", default='', help="if given, this path will be prepended to every entry returned (defaults to '%(default)s')") parser.add_argument('-d', '--directory', dest="directory", default='', help="if given, this path will be prepended to every entry returned (defaults to '%(default)s')")
parser.add_argument('-e', '--extension', dest="extension", default='', help="if given, this extension will be appended to every entry returned (defaults to '%(default)s')") parser.add_argument('-e', '--extension', dest="extension", default='', help="if given, this extension will be appended to every entry returned (defaults to '%(default)s')")
parser.add_argument('-p', '--protocol', dest="protocol", default='', help="if given, limits the dump to a particular subset of the data that corresponds to the given protocol (defaults to '%(default)s')", choices=db.protocol_names()) parser.add_argument('-p', '--protocol', dest="protocol", default='', help="if given, limits the dump to a particular subset of the data that corresponds to the given protocol (defaults to '%(default)s')", choices=db.protocol_names())
parser.add_argument('-u', '--purposes', dest="purposes", default='', help="if given, this value will limit the output files to those designed for the given purposes. (defaults to '%(default)s')", choices=db.purposes()) parser.add_argument('-u', '--purposes', dest="purposes", default='', help="if given, this value will limit the output files to those designed for the given purposes. (defaults to '%(default)s')", choices=db.purposes())
# TODO: model_ids parser.add_argument('-C', '--client', dest="client", default=None, type=int, help="if given, limits the dump to a particular client (defaults to '%(default)s')", choices=clients)
parser.add_argument('-g', '--groups', dest="groups", default='', help="if given, this value will limit the output files to those belonging to a particular protocolar group. (defaults to '%(default)s')", choices=db.groups()) parser.add_argument('-g', '--groups', dest="groups", default='', help="if given, this value will limit the output files to those belonging to a particular protocolar group. (defaults to '%(default)s')", choices=db.groups())
parser.add_argument('-l', '--languages', dest="languages", default='', help="if given, this value will limit the output files to those belonging to the given languages. (defaults to '%(default)s')", choices=db.languages()) parser.add_argument('-l', '--languages', dest="languages", default='', help="if given, this value will limit the output files to those belonging to the given languages. (defaults to '%(default)s')", choices=db.languages())
parser.add_argument('-c', '--classes', dest="classes", default='', help="if given, this value will limit the output files to those belonging to the given classes. (defaults to '%(default)s')", choices=('client', 'impostor', '')) parser.add_argument('-c', '--classes', dest="classes", default='', help="if given, this value will limit the output files to those belonging to the given classes. (defaults to '%(default)s')", choices=('client', 'impostor', ''))
......
...@@ -73,7 +73,7 @@ class Database(object): ...@@ -73,7 +73,7 @@ class Database(object):
return ProtocolPurpose.group_choices return ProtocolPurpose.group_choices
def client_groups(self): def client_groups(self):
"""Returns the names of the XM2VTS groups. This is specific to this database which """Returns the names of the BANCA groups. This is specific to this database which
does not have separate training, development and evaluation sets.""" does not have separate training, development and evaluation sets."""
return Client.group_choices return Client.group_choices
...@@ -519,7 +519,7 @@ class Database(object): ...@@ -519,7 +519,7 @@ class Database(object):
Keyword Parameters: Keyword Parameters:
id ids
The ids of the object in the database table "file". This object should be The ids of the object in the database table "file". This object should be
a python iterable (such as a tuple or list). a python iterable (such as a tuple or list).
...@@ -556,6 +556,7 @@ class Database(object): ...@@ -556,6 +556,7 @@ class Database(object):
self.assert_validity() self.assert_validity()
retval = []
fobj = self.session.query(File).filter(File.path.in_(paths)) fobj = self.session.query(File).filter(File.path.in_(paths))
for p in paths: for p in paths:
retval.extend([k.id for k in fobj if k.path == p]) retval.extend([k.id for k in fobj if k.path == p])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment