Merge branch 'database' into develop
This commit is contained in:
@@ -230,7 +230,7 @@ Updater::process(boost::system::error_code err)
|
|||||||
rootDirectories.push_back( std::make_pair( directory->getPath(), directory->getType() ));
|
rootDirectories.push_back( std::make_pair( directory->getPath(), directory->getType() ));
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH( RootDirectory rootDirectory, rootDirectories)
|
for (RootDirectory rootDirectory : rootDirectories)
|
||||||
processDirectory(rootDirectory.first, rootDirectory.first, rootDirectory.second, stats);
|
processDirectory(rootDirectory.first, rootDirectory.first, rootDirectory.second, stats);
|
||||||
|
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_INFO) << "Changes = " << stats.nbChanges();
|
LMS_LOG(MOD_DBUPDATER, SEV_INFO) << "Changes = " << stats.nbChanges();
|
||||||
@@ -430,11 +430,16 @@ Updater::processAudioFile( const boost::filesystem::path& file, Stats& stats)
|
|||||||
// ***** Genres
|
// ***** Genres
|
||||||
std::vector< Genre::pointer > genres;
|
std::vector< Genre::pointer > genres;
|
||||||
{
|
{
|
||||||
genres = getGenres( boost::any_cast< std::list<std::string> > (items[MetaData::Type::Genres]) );
|
std::list<std::string> genreList;
|
||||||
|
|
||||||
|
if (items.find(MetaData::Type::Genres) != items.end())
|
||||||
|
genreList = boost::any_cast< std::list<std::string> > (items[MetaData::Type::Genres]);
|
||||||
|
|
||||||
|
genres = getGenres( genreList );
|
||||||
}
|
}
|
||||||
assert( !genres.empty() );
|
assert( !genres.empty() );
|
||||||
|
|
||||||
// Get the associated Artist
|
// ***** Artist
|
||||||
Artist::pointer artist;
|
Artist::pointer artist;
|
||||||
{
|
{
|
||||||
std::string artistName;
|
std::string artistName;
|
||||||
@@ -450,7 +455,7 @@ Updater::processAudioFile( const boost::filesystem::path& file, Stats& stats)
|
|||||||
}
|
}
|
||||||
assert(artist);
|
assert(artist);
|
||||||
|
|
||||||
// Get the associated Release
|
// ***** Release
|
||||||
Release::pointer release;
|
Release::pointer release;
|
||||||
{
|
{
|
||||||
std::string releaseName;
|
std::string releaseName;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2013 Emeric Poupon
|
* Copyright (C) 2015 Emeric Poupon
|
||||||
*
|
*
|
||||||
* This file is part of LMS.
|
* This file is part of LMS.
|
||||||
*
|
*
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Artist.hpp"
|
#include "Types.hpp"
|
||||||
#include "SqlQuery.hpp"
|
#include "SqlQuery.hpp"
|
||||||
|
|
||||||
#include "logger/Logger.hpp"
|
#include "logger/Logger.hpp"
|
||||||
|
|||||||
@@ -1,6 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2015 Emeric Poupon
|
||||||
|
*
|
||||||
|
* This file is part of LMS.
|
||||||
|
*
|
||||||
|
* LMS is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* LMS is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
#include "Release.hpp"
|
#include "Types.hpp"
|
||||||
|
|
||||||
#include "SearchFilter.hpp"
|
#include "SearchFilter.hpp"
|
||||||
#include "SqlQuery.hpp"
|
#include "SqlQuery.hpp"
|
||||||
|
|
||||||
|
|||||||
@@ -97,32 +97,16 @@ Audio::Audio(Wt::WContainerWidget *parent)
|
|||||||
std::vector<std::string> keywords;
|
std::vector<std::string> keywords;
|
||||||
boost::algorithm::split(keywords, text, boost::is_any_of(" "), boost::token_compress_on);
|
boost::algorithm::split(keywords, text, boost::is_any_of(" "), boost::token_compress_on);
|
||||||
|
|
||||||
{
|
releaseSearch->search(SearchFilter::NameLikeMatch( {
|
||||||
SearchFilter filter;
|
{ SearchFilter::Field::Artist, keywords },
|
||||||
for (std::string keyword : keywords)
|
{ SearchFilter::Field::Release, keywords }}),
|
||||||
{
|
3);
|
||||||
filter.nameLikeMatch[SearchFilter::Field::Artist].push_back(keyword);
|
|
||||||
filter.nameLikeMatch[SearchFilter::Field::Release].push_back(keyword);
|
|
||||||
}
|
|
||||||
|
|
||||||
releaseSearch->search(filter, 3);
|
artistSearch->search(SearchFilter::NameLikeMatch({{SearchFilter::Field::Artist, keywords}}),
|
||||||
}
|
3);
|
||||||
|
|
||||||
{
|
trackSearch->search(SearchFilter::NameLikeMatch({{SearchFilter::Field::Track, keywords}}),
|
||||||
SearchFilter filter;
|
3);
|
||||||
for (std::string keyword : keywords)
|
|
||||||
filter.nameLikeMatch[SearchFilter::Field::Artist].push_back(keyword);
|
|
||||||
|
|
||||||
artistSearch->search(filter, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
SearchFilter filter;
|
|
||||||
BOOST_FOREACH(std::string keyword, keywords)
|
|
||||||
filter.nameLikeMatch[SearchFilter::Field::Track].push_back(keyword);
|
|
||||||
|
|
||||||
trackSearch->search(filter, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
artistSearch->show();
|
artistSearch->show();
|
||||||
releaseSearch->show();
|
releaseSearch->show();
|
||||||
@@ -143,10 +127,8 @@ Audio::Audio(Wt::WContainerWidget *parent)
|
|||||||
trackSearch->hide();
|
trackSearch->hide();
|
||||||
releaseSearch->show();
|
releaseSearch->show();
|
||||||
|
|
||||||
SearchFilter filter;
|
releaseSearch->search(SearchFilter::IdMatch({{SearchFilter::Field::Artist, {artistId}}}),
|
||||||
filter.idMatch[SearchFilter::Field::Artist].push_back(artistId);
|
20);
|
||||||
|
|
||||||
releaseSearch->search(filter, 20);
|
|
||||||
}, std::placeholders::_1));
|
}, std::placeholders::_1));
|
||||||
|
|
||||||
releaseSearch->moreReleasesSelected().connect(std::bind([=]
|
releaseSearch->moreReleasesSelected().connect(std::bind([=]
|
||||||
@@ -162,11 +144,8 @@ Audio::Audio(Wt::WContainerWidget *parent)
|
|||||||
releaseSearch->hide();
|
releaseSearch->hide();
|
||||||
trackSearch->show();
|
trackSearch->show();
|
||||||
|
|
||||||
// TODO load track search with selected release
|
trackSearch->search(SearchFilter::IdMatch({{SearchFilter::Field::Release, {releaseId}}}),
|
||||||
SearchFilter filter;
|
20);
|
||||||
filter.idMatch[SearchFilter::Field::Release].push_back(releaseId);
|
|
||||||
|
|
||||||
trackSearch->search(filter, 20);
|
|
||||||
}, std::placeholders::_1));
|
}, std::placeholders::_1));
|
||||||
|
|
||||||
trackSearch->moreTracksSelected().connect(std::bind([=]
|
trackSearch->moreTracksSelected().connect(std::bind([=]
|
||||||
@@ -207,10 +186,9 @@ Audio::Audio(Wt::WContainerWidget *parent)
|
|||||||
|
|
||||||
// Initially, populate the widgets using an empty search
|
// Initially, populate the widgets using an empty search
|
||||||
{
|
{
|
||||||
SearchFilter filter; // empty filter
|
artistSearch->search(SearchFilter(), 3);
|
||||||
artistSearch->search(filter, 3);
|
releaseSearch->search(SearchFilter(), 3);
|
||||||
releaseSearch->search(filter, 3);
|
trackSearch->search(SearchFilter(), 3);
|
||||||
trackSearch->search(filter, 3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user