Commit 646dd9c2 authored by Jens Georg's avatar Jens Georg

Always create faces database

With the map support merged, we need to have a consistent database numbering.
Faces support + extension will be 21, map extension is 22
parent 553ac248
......@@ -21,17 +21,12 @@ public abstract class DatabaseTable {
* tables are created on demand and tables and columns are easily ignored when already present.
* However, the change should be noted in upgrade_database() as a comment.
***/
public const int SCHEMA_VERSION = 21;
#if ENABLE_FACES
public const int SCHEMA_VERSION = 21;
#else
public const int SCHEMA_VERSION = 20;
#endif
public const int SCHEMA_VERSION = 22;
protected static Sqlite.Database db;
private static int in_transaction = 0;
public string table_name = null;
private static void prepare_db(string filename) {
......
......@@ -350,13 +350,30 @@ private VerifyResult upgrade_database(int input_version) {
version = 20;
#if ENABLE_FACES
//
// Version 21:
// * Add has_gps, gps_lat and gps_lon columns to PhotoTable
if (!DatabaseTable.ensure_column("PhotoTable", "has_gps", "INTEGER DEFAULT -1",
"upgrade_database: adding gps_lat column to PhotoTable")
|| !DatabaseTable.ensure_column("PhotoTable", "gps_lat", "REAL",
"upgrade_database: adding gps_lat column to PhotoTable")
|| !DatabaseTable.ensure_column("PhotoTable", "gps_lon", "REAL",
"upgrade_database: adding gps_lon column to PhotoTable")) {
return VerifyResult.UPGRADE_ERROR;
}
version = 21;
//
// Version 22:
// * Create face detection tables even if feasture is not enabled
// * Added face pixels column to FaceLocationTable
// * Added face vector column to FaceTable
//
FaceTable.get_instance();
FaceLocationTable.get_instance();
if (!DatabaseTable.has_column("FaceLocationTable", "vec")) {
message("upgrade_database: adding vec column to FaceLocationTable");
if (!DatabaseTable.add_column("FaceLocationTable", "vec", "TEXT"))
......@@ -373,23 +390,8 @@ private VerifyResult upgrade_database(int input_version) {
return VerifyResult.UPGRADE_ERROR;
}
version = 21;
#endif
//
// Version 21:
// * Add has_gps, gps_lat and gps_lon columns to PhotoTable
version = 22;
if (!DatabaseTable.ensure_column("PhotoTable", "has_gps", "INTEGER DEFAULT -1",
"upgrade_database: adding gps_lat column to PhotoTable")
|| !DatabaseTable.ensure_column("PhotoTable", "gps_lat", "REAL",
"upgrade_database: adding gps_lat column to PhotoTable")
|| !DatabaseTable.ensure_column("PhotoTable", "gps_lon", "REAL",
"upgrade_database: adding gps_lon column to PhotoTable")) {
return VerifyResult.UPGRADE_ERROR;
}
version = 21;
//
// Finalize the upgrade process
//
......
......@@ -4,8 +4,6 @@
* (version 2.1 or later). See the COPYING file in this distribution.
*/
#if ENABLE_FACES
public struct FaceLocationID {
public const int64 INVALID = -1;
......@@ -266,5 +264,3 @@ public class FaceLocationTable : DatabaseTable {
return rows;
}
}
#endif
......@@ -4,7 +4,6 @@
* (version 2.1 or later). See the COPYING file in this distribution.
*/
#if ENABLE_FACES
public struct FaceID {
public const int64 INVALID = -1;
......@@ -212,4 +211,3 @@ public class FaceTable : DatabaseTable {
return rows;
}
}
#endif
......@@ -4,7 +4,6 @@
* (version 2.1 or later). See the COPYING file in this distribution.
*/
#if ENABLE_FACES
public class FaceSourceCollection : ContainerSourceCollection {
private Gee.HashMap<string, Face> name_map = new Gee.HashMap<string, Face>
((Gee.HashDataFunc)Face.hash_name_string, (Gee.EqualDataFunc)Face.equal_name_strings);
......@@ -354,11 +353,13 @@ public class Face : DataSource, ContainerSource, Proxyable, Indexable {
#endif
}
#if ENABLE_FACES
public static void terminate() {
try {
FaceDetect.interface.terminate();
} catch(Error e) {}
}
#endif
public static int compare_names(void *a, void *b) {
Face *aface = (Face *) a;
......@@ -705,4 +706,3 @@ public class Face : DataSource, ContainerSource, Proxyable, Indexable {
}
}
#endif
......@@ -4,8 +4,6 @@
* (version 2.1 or later). See the COPYING file in this distribution.
*/
#if ENABLE_FACES
// Encapsulate geometry and pixels of a Face
public struct FaceLocationData {
public string geometry;
......@@ -224,4 +222,3 @@ public class FaceLocation : Object {
}
}
#endif
......@@ -28,14 +28,10 @@ face_obj = ''
if get_option('face-detection')
face_sources = (['faces/FacesBranch.vala',
'faces/FaceLocation.vala',
'faces/FacePage.vala',
'faces/FaceShape.vala',
'faces/Faces.vala',
'faces/Face.vala',
'faces/FaceDetect.vala',
'db/FaceLocationTable.vala',
'db/FaceTable.vala',
'faces/Faces.vala',
'faces/FacesTool.vala'])
endif
......@@ -67,6 +63,8 @@ executable('shotwell',
'db/DatabaseTable.vala',
'db/PhotoTable.vala',
'db/EventTable.vala',
'db/FaceLocationTable.vala',
'db/FaceTable.vala',
'db/TagTable.vala',
'db/TombstoneTable.vala',
'db/VideoTable.vala',
......@@ -75,6 +73,8 @@ executable('shotwell',
'editing_tools/EditingTools.vala',
'editing_tools/RGBHistogramManipulator.vala',
'editing_tools/StraightenTool.vala',
'faces/Face.vala',
'faces/FaceLocation.vala',
'slideshow/Slideshow.vala',
'slideshow/TransitionEffects.vala',
'photos/Photos.vala',
......
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