Make the audio similarity engine the default one for new installs, if available
This commit is contained in:
@@ -180,17 +180,15 @@ namespace lms::db
|
||||
|
||||
bool Session::migrateSchemaIfNeeded()
|
||||
{
|
||||
const bool migrationPerformed{ Migration::doDbMigration(*this) };
|
||||
return Migration::doDbMigration(*this);
|
||||
}
|
||||
|
||||
// TODO: move this elsewhere
|
||||
{
|
||||
auto uniqueTransaction{ createWriteTransaction() };
|
||||
void Session::createScanSettingsIfNeeded(RecommendationEngineType defaultRecommendationEngineType)
|
||||
{
|
||||
auto uniqueTransaction{ createWriteTransaction() };
|
||||
|
||||
if (!ScanSettings::find(*this))
|
||||
create<ScanSettings>();
|
||||
}
|
||||
|
||||
return migrationPerformed;
|
||||
if (!ScanSettings::find(*this))
|
||||
create<ScanSettings>().modify()->setRecommendationEngineType(defaultRecommendationEngineType);
|
||||
}
|
||||
|
||||
void Session::createIndexesIfNeeded()
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
#include "database/Transaction.hpp"
|
||||
#include "database/Types.hpp"
|
||||
#include "database/objects/Types.hpp"
|
||||
|
||||
namespace lms::db
|
||||
{
|
||||
@@ -58,6 +59,7 @@ namespace lms::db
|
||||
|
||||
void prepareTablesIfNeeded(); // need to run only once at startup
|
||||
bool migrateSchemaIfNeeded(); // returns true if migration was performed
|
||||
void createScanSettingsIfNeeded(RecommendationEngineType defaultRecommendationEngineType = RecommendationEngineType::Clusters);
|
||||
void createIndexesIfNeeded();
|
||||
void vacuumIfNeeded();
|
||||
void vacuum();
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "database/IdType.hpp"
|
||||
#include "database/Object.hpp"
|
||||
#include "database/objects/Types.hpp"
|
||||
|
||||
LMS_DECLARE_IDTYPE(ScanSettingsId)
|
||||
|
||||
@@ -49,14 +50,6 @@ namespace lms::db
|
||||
Hourly,
|
||||
};
|
||||
|
||||
// Do not modify values (just add)
|
||||
enum class RecommendationEngineType
|
||||
{
|
||||
Clusters = 0,
|
||||
None = 2,
|
||||
AudioSimilarity = 3,
|
||||
};
|
||||
|
||||
ScanSettings() = default;
|
||||
|
||||
static pointer find(Session& session, std::string_view name = "");
|
||||
|
||||
@@ -114,6 +114,13 @@ namespace lms::db
|
||||
PubDateDesc,
|
||||
};
|
||||
|
||||
enum class RecommendationEngineType
|
||||
{
|
||||
Clusters = 0,
|
||||
None = 2,
|
||||
AudioSimilarity = 3,
|
||||
};
|
||||
|
||||
enum class ReleaseArtistLinkSortMethod
|
||||
{
|
||||
None,
|
||||
|
||||
@@ -344,6 +344,7 @@ VALUES
|
||||
|
||||
// Now perform full migration
|
||||
db.getTLSSession().migrateSchemaIfNeeded();
|
||||
db.getTLSSession().createScanSettingsIfNeeded();
|
||||
|
||||
// Now perform some dummy finds to ensure all fields are correctly mapped
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user