# HG changeset patch # User Stiletto # Date 1297512608 -10800 # Node ID 38269b62d856d944db6ba5fd40027973b3f9940d # Parent c9188930a16f160906b646b895b7d2ec49ab5ee8 colon fix, scanscript diff -r c9188930a16f -r 38269b62d856 Makefile --- a/Makefile Sat Feb 12 13:48:14 2011 +0300 +++ b/Makefile Sat Feb 12 15:10:08 2011 +0300 @@ -1,27 +1,27 @@ include config.mk -all: cos-dbupdate cos-search scan +all: cos-dbupdate cos-search scan extractors scan: ${OBJS} - @echo CC -o $@ - @g++ ${OBJS} ${LDFLAGS} -o $@ + @echo C++ -o $@ + @${CXX} ${OBJS} ${LDFLAGS} -o $@ clean: - rm -f ${OBJS} scan + rm -f ${OBJS} cos-dbupdate cos-search scan walker.o: walker.cxx walker.h - @g++ -c ${CFLAGS} walker.cxx - -#magi.o: magi.cxx walker.h -# @g++ -c ${CFLAGS} magi.cxx + @echo C++ $< + @${CXX} -c ${CFLAGS} walker.cxx scan.o: walker.h scan.cxx - @g++ -c ${CFLAGS} scan.cxx - + @echo C++ $< + @${CXX} -c ${CFLAGS} scan.cxx cos-dbupdate: cos-dbupdate.cxx - g++ -O0 -g cos-dbupdate.cxx -o cos-dbupdate ${CFLAGS} ${LDFLAGS} + @echo C++ $< + @${CXX} -O0 -g cos-dbupdate.cxx -o cos-dbupdate ${CFLAGS} ${LDFLAGS} cos-search: cos-search.cxx - g++ -O0 -g cos-search.cxx -o cos-search ${CFLAGS} ${LDFLAGS} \ No newline at end of file + @echo C++ $< + @${CXX} -O0 -g cos-search.cxx -o cos-search ${CFLAGS} ${LDFLAGS} \ No newline at end of file diff -r c9188930a16f -r 38269b62d856 config.mk --- a/config.mk Sat Feb 12 13:48:14 2011 +0300 +++ b/config.mk Sat Feb 12 15:10:08 2011 +0300 @@ -1,6 +1,3 @@ -# dwm version -VERSION = 5.9 - # Customize below to fit your system # paths @@ -14,12 +11,11 @@ # flags CPPFLAGS = -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} -D_BSD_SOURCE=1 CFLAGS = -g -std=c++0x -pedantic -Wall -O0 ${INCS} ${CPPFLAGS} -#CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS} LDFLAGS = -g ${LIBS} -#LDFLAGS = -s ${LIBS} OBJS = walker.o scan.o -# magi.o # compiler and linker CC = cc +CXX = c++ + diff -r c9188930a16f -r 38269b62d856 cos-dbupdate.cxx --- a/cos-dbupdate.cxx Sat Feb 12 13:48:14 2011 +0300 +++ b/cos-dbupdate.cxx Sat Feb 12 15:10:08 2011 +0300 @@ -47,7 +47,7 @@ break; Xapian::Document newdocument; newdocument.set_data(fname); - newdocument.add_posting("FILENAME="+fname, 0); + newdocument.add_posting("FILENAME:"+fname, 0); int i=1; while (1) { string term; @@ -57,7 +57,7 @@ cout << "TERM <" << term << ">" << endl; newdocument.add_posting(term, i++); } - database.replace_document("FILENAME="+fname,newdocument); + database.replace_document("FILENAME:"+fname,newdocument); cout << "EOFILE <" << fname << ">" << endl; } } catch(const Xapian::Error &error) { diff -r c9188930a16f -r 38269b62d856 cos-search.cxx --- a/cos-search.cxx Sat Feb 12 13:48:14 2011 +0300 +++ b/cos-search.cxx Sat Feb 12 15:10:08 2011 +0300 @@ -51,11 +51,11 @@ pcrecpp::StringPiece input(qstring); // Wrap in a StringPiece string var; - while (prereg.Consume(&input, &var)) { - string upvar = var+"="; - std::transform(var.begin(), var.end(), var.begin(), ::tolower); + while (prereg.FindAndConsume(&input, &var)) { + string upvar = var+":"; + //std::transform(var.begin(), var.end(), var.begin(), ::tolower); std::transform(upvar.begin(), upvar.end(), upvar.begin(), ::toupper); - cout << var << upvar << endl; + //cout << var << " -> " << upvar << endl; qp.add_boolean_prefix(var,upvar); } @@ -63,7 +63,7 @@ // Build the query object Xapian::Query query = qp.parse_query(qstring); //Xapian::Query::OP_OR, argv + 2, argv + argc); - cout << "Performing query `" << query.get_description() << "'" << endl; + cerr << "Performing query `" << query.get_description() << "'" << endl; // Give the query object to the enquire session enquire.set_query(query); @@ -72,17 +72,16 @@ Xapian::MSet matches = enquire.get_mset(0, db.get_doccount()); // Display the results - cout << matches.size() << " results found" << endl; + cerr << matches.size() << " results found" << endl; for (Xapian::MSetIterator i = matches.begin(); i != matches.end(); ++i) { Xapian::Document doc = i.get_document(); - cout << "Document ID " << *i << "\t" << - i.get_percent() << "% [" << - doc.get_data() << "]" << endl; + cout << "#" << *i << "\t" << + doc.get_data() << endl; } } catch(const Xapian::Error &error) { - cout << "Exception: " << error.get_msg() << endl; + cerr << "Exception: " << error.get_msg() << endl; } } diff -r c9188930a16f -r 38269b62d856 scan.cxx --- a/scan.cxx Sat Feb 12 13:48:14 2011 +0300 +++ b/scan.cxx Sat Feb 12 15:10:08 2011 +0300 @@ -1,5 +1,10 @@ #include "walker.h" +class ShitFuck : public MagicWalker { + virtual int HandleFile(const char *filename) { + } +}; + int main(int argc, char *argv[]) { MagicWalker f("/home/media/music"); f.Run(); diff -r c9188930a16f -r 38269b62d856 scanscript.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scanscript.sh Sat Feb 12 15:10:08 2011 +0300 @@ -0,0 +1,5 @@ +#!/bin/sh +PROGDIR=$(dirname $(readlink -f $0)) +find "$1" -type f| while read fname; do + $PROGDIR/extractors/ext-audio-mpeg "$fname" +done