Esempio n. 1
0
def checkfiles(args):
  """Checks the existence of the files based on your criteria"""

  from .__init__ import Database
  db = Database()

  objects = db.objects(protocols = args.protocols, groups=args.groups, classes=args.classes)

  # go through all files, check if they are available on the filesystem
  good = []
  bad = []
  for obj in objects:
    if os.path.exists(obj.make_path(directory=args.directory, extension=args.extension)): good.append(obj)
    else: bad.append(obj)

  # report
  output = sys.stdout
  if args.selftest:
    from bob.db.utils import null
    output = null()

  if bad:
    for obj in bad:
      output.write('Cannot find file "%s"\n' % (obj.make_path(directory=args.directory, extension=args.extension),))
    output.write('%d files (out of %d) were not found at "%s"\n' % \
        (len(bad), len(objects), args.directory))

  return 0
Esempio n. 2
0
def checkfiles(args):
  """Checks existence of files based on your criteria"""

  from .query import Database
  db = Database()

  r = db.objects()

  # go through all files, check if they are available on the filesystem
  good = []
  bad = []
  for f in r:
    if os.path.exists(f.make_path(args.directory, args.extension)):
      good.append(f)
    else:
      bad.append(f)

  # report
  output = sys.stdout
  if args.selftest:
    from bob.db.utils import null
    output = null()

  if bad:
    for f in bad:
      output.write('Cannot find file "%s"\n' % (f.make_path(args.directory, args.extension),))
    output.write('%d files (out of %d) were not found at "%s"\n' % \
      (len(bad), len(r), args.directory))

  return 0
Esempio n. 3
0
def checkfiles(args):
  """Checks existence of files based on your criteria"""

  from .query import Database
  db = Database()

  r = db.objects()

  # go through all files, check if they are available on the filesystem
  good = []
  bad = []
  for f in r:
    if os.path.exists(f.make_path(args.directory, args.extension)):
      good.append(f)
    else:
      bad.append(f)

  # report
  output = sys.stdout
  if args.selftest:
    from bob.db.utils import null
    output = null()

  if bad:
    for f in bad:
      output.write('Cannot find file "%s"\n' % (f.make_path(args.directory, args.extension),))
    output.write('%d files (out of %d) were not found at "%s"\n' % \
      (len(bad), len(r), args.directory))

  return 0
Esempio n. 4
0
def checkfiles(args):
    """Checks the existence of the files based on your criteria"""

    from .__init__ import Database
    db = Database()

    objects = db.objects(protocols=args.protocols, groups=args.groups)

    # go through all files, check if they are available on the filesystem
    good = []
    bad = []
    for obj in objects:
        if os.path.exists(
                obj.make_path(directory=args.directory,
                              extension=args.extension)):
            good.append(obj)
        else:
            bad.append(obj)

    # report
    output = sys.stdout
    if args.selftest:
        from bob.db.utils import null
        output = null()

    if bad:
        for obj in bad:
            output.write('Cannot find file "%s"\n' % (obj.make_path(
                directory=args.directory, extension=args.extension), ))
        output.write('%d files (out of %d) were not found at "%s"\n' % \
            (len(bad), len(objects), args.directory))

    return 0
def checkfiles(args):
  """Checks the existence of the files based on your criteria."""

  from .__init__ import Database
  db = Database()

  r = db.objects()

  # go through all files, check if they are available
  good = {}
  bad = {}
  for f in r:
    if os.path.exists(f.make_path(directory=args.directory, extension=args.extension)): good[f.id] = f.make_path(directory=args.directory, extension=args.extension)
    else: bad[f.id] = f.make_path(directory=args.directory, extension=args.extension)

  # report
  output = sys.stdout
  if args.selftest:
    from bob.db.utils import null
    output = null()

  if bad:
    for f in bad:
      output.write('Cannot find file "%s"\n' % (f,))
    output.write('%d files (out of %d) were not found at "%s"\n' % \
        (len(bad), len(r), args.directory))

  return 0
Esempio n. 6
0
def path(args):
  """Returns a list of fully formed paths or stems given some file id"""

  from .query import Database
  db = Database()

  output = sys.stdout
  if args.selftest:
    from bob.db.utils import null
    output = null()

  r = db.paths(args.id, prefix=args.directory, suffix=args.extension)
  for path in r: output.write('%s\n' % path)

  if not r: return 1

  return 0
Esempio n. 7
0
def reverse(args):
  """Returns a list of file database identifiers given the path stems"""

  from .query import Database
  db = Database()

  output = sys.stdout
  if args.selftest:
    from bob.db.utils import null
    output = null()

  r = db.reverse(args.path)
  for f in r: output.write('%d\n' % f.id)

  if not r: return 1

  return 0
Esempio n. 8
0
def path(args):
  """Returns a list of fully formed paths or stems given some file id"""

  from .query import Database
  db = Database()

  output = sys.stdout
  if args.selftest:
    from bob.db.utils import null
    output = null()

  r = db.paths(args.id, prefix=args.directory, suffix=args.extension)
  for path in r: output.write('%s\n' % path)

  if not r: return 1

  return 0
Esempio n. 9
0
def reverse(args):
  """Returns a list of file database identifiers given the path stems"""

  from .query import Database
  db = Database()

  output = sys.stdout
  if args.selftest:
    from bob.db.utils import null
    output = null()

  r = db.reverse(args.path)
  for f in r: output.write('%d\n' % f.id)

  if not r: return 1

  return 0
Esempio n. 10
0
def dumplist(args):
  """Dumps lists of files based on your criteria"""

  from . import Database
  db = Database()

  objects = db.objects(protocols = args.protocols, groups=args.groups, classes=args.classes)

  output = sys.stdout
  if args.selftest:
    from bob.db.utils import null
    output = null()

  for obj in objects:
    output.write('%s\n' % (obj.make_path(directory=args.directory, extension=args.extension),))

  return 0
Esempio n. 11
0
def dumplist(args):
    """Dumps lists of files based on your criteria"""

    from . import Database
    db = Database()

    objects = db.objects(protocols=args.protocols, groups=args.groups)

    output = sys.stdout
    if args.selftest:
        from bob.db.utils import null
        output = null()

    for obj in objects:
        output.write('%s\n' % (obj.make_path(directory=args.directory,
                                             extension=args.extension), ))

    return 0
Esempio n. 12
0
def dumplist(args):
    """Dumps lists of files based on your criteria"""

    from .query import Database

    db = Database(args.list_directory, use_dense_probe_file_list=False)

    r = db.objects(purposes=args.purpose, groups=args.group, classes=args.sclass, protocol=args.protocol)

    output = sys.stdout
    if args.selftest:
        from bob.db.utils import null

        output = null()

    for f in r:
        output.write("%s\n" % f.make_path(directory=args.directory, extension=args.extension))

    return 0
Esempio n. 13
0
def dumplist(args):
  """Dumps lists of files based on your criteria"""

  from .query import Database
  db = Database()

  r = db.objects(
      purposes=args.purpose,
      groups=args.group,
  )

  output = sys.stdout
  if args.selftest:
    from bob.db.utils import null
    output = null()

  for f in r:
    output.write('%s\n' % f.make_path(directory=args.directory,extension=args.extension))

  return 0
Esempio n. 14
0
def dumplist(args):
    """Dumps lists of files based on your criteria"""

    from .query import Database

    db = Database()

    r = db.objects(
        protocol=args.protocol, purposes=args.purposes, client_ids=args.client_ids, sets=args.sets, classes=args.classes
    )

    output = sys.stdout
    if args.selftest:
        from bob.db.utils import null

        output = null()

    for f in r:
        output.write("%s\n" % (f.make_path(args.directory, args.extension),))

    return 0
Esempio n. 15
0
def dumplist(args):
  """Dumps lists of files based on your criteria"""

  from .query import Database
  db = Database()

  r = db.objects(
      protocol=args.protocol,
      purposes=args.purpose,
      model_ids=(args.client,),
      groups=args.group,
      classes=args.sclass
  )

  output = sys.stdout
  if args.selftest:
    from bob.db.utils import null
    output = null()

  for f in r:
    output.write('%s\n' % (f.make_path(args.directory, args.extension),))

  return 0