Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.db.ldhf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.db.ldhf
Commits
1346bc50
Commit
1346bc50
authored
9 years ago
by
Tiago de Freitas Pereira
Browse files
Options
Downloads
Patches
Plain Diff
Extended the method original_file_name
parent
f530c533
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/db/cuhk_cufs/query.py
+33
-1
33 additions, 1 deletion
bob/db/cuhk_cufs/query.py
with
33 additions
and
1 deletion
bob/db/cuhk_cufs/query.py
+
33
−
1
View file @
1346bc50
...
...
@@ -35,11 +35,14 @@ class Database(bob.db.verification.utils.SQLiteDatabase, bob.db.verification.uti
"""
def
__init__
(
self
,
original_directory
=
None
,
original_extension
=
None
,
a
nnotation
_directory
=
None
):
def
__init__
(
self
,
original_directory
=
None
,
original_extension
=
None
,
a
rface_directory
=
""
,
xm2vts
_directory
=
""
):
# call base class constructors to open a session to the database
bob
.
db
.
verification
.
utils
.
SQLiteDatabase
.
__init__
(
self
,
SQLITE_FILE
,
File
)
bob
.
db
.
verification
.
utils
.
ZTDatabase
.
__init__
(
self
,
original_directory
=
original_directory
,
original_extension
=
original_extension
)
self
.
arface_directory
=
arface_directory
self
.
xm2vts_directory
=
xm2vts_directory
def
protocols
(
self
):
return
PROTOCOLS
...
...
@@ -48,6 +51,35 @@ class Database(bob.db.verification.utils.SQLiteDatabase, bob.db.verification.uti
return
PURPOSES
def
original_file_name
(
self
,
file
,
check_existence
=
True
):
"""
This function returns the original file name for the given File object.
Keyword parameters:
file : :py:class:`File` or a derivative
The File objects for which the file name should be retrieved
check_existence : bool
Check if the original file exists?
Return value : str
The original file name for the given File object
"""
# check if directory is set
original_directory
=
self
.
original_directory
if
f
.
modality
==
"
photo
"
:
if
f
.
client
.
original_database
==
"
xm2vts
"
:
original_directory
=
self
.
xm2vts
elif
f
.
client
.
original_database
==
"
arface
"
:
original_directory
=
self
.
arface
if
not
original_directory
or
not
self
.
original_extension
:
raise
ValueError
(
"
The original_directory and/or the original_extension were not specified in the constructor.
"
)
# extract file name
file_name
=
file
.
make_path
(
original_directory
,
self
.
original_extension
)
if
not
check_existence
or
os
.
path
.
exists
(
file_name
):
return
file_name
raise
ValueError
(
"
The file
'
%s
'
was not found. Please check the original directory
'
%s
'
and extension
'
%s
'
?
"
%
(
file_name
,
original_directory
,
self
.
original_extension
))
def
objects
(
self
,
groups
=
None
,
protocol
=
None
,
purposes
=
None
,
model_ids
=
None
,
**
kwargs
):
"""
This function returns lists of File objects, which fulfill the given restrictions.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment