2
* Copyright (C) 2013 Canonical, Ltd.
5
* Jussi Pakkanen <jussi.pakkanen@canonical.com>
7
* This library is free software; you can redistribute it and/or modify it under
8
* the terms of version 3 of the GNU General Public License as published
9
* by the Free Software Foundation.
11
* This library is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
21
#include "MediaFile.hh"
22
#include "MediaStore.hh"
29
static int do_query(vector<string> &files, string &query) {
31
for(auto &fname : files) {
32
s.insert(MediaFile(fname));
34
vector<MediaFile> matches = s.query(query);
35
printf("Got %ld matches.\n", (long)matches.size());
36
for(auto &m : matches) {
37
printf(" %s\n", m.getFileName().c_str());
42
int main(int argc, char **argv) {
44
printf("%s <query term>\n", argv[0]);
48
string root = getenv("HOME");
49
string query = argv[1];
51
vector<string> files = s.scanFiles(root, AudioMedia);
52
printf("Found %ld files.\n", (long)files.size());
53
return do_query(files, query);