2005-04-28 14:06:20 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005 by Michiel van der Kolk
|
|
|
|
*
|
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2005-04-28 18:49:23 +00:00
|
|
|
#include "searchengine.h"
|
2005-04-28 12:33:38 +00:00
|
|
|
#include "token.h"
|
|
|
|
#include "dbinterface.h"
|
|
|
|
|
|
|
|
char *getstring(struct token *token) {
|
|
|
|
switch(token->kind) {
|
|
|
|
case TOKEN_STRING:
|
|
|
|
return token->spelling;
|
|
|
|
case TOKEN_STRINGIDENTIFIER:
|
|
|
|
switch(token->intvalue) {
|
|
|
|
case INTVALUE_TITLE:
|
2005-04-28 18:49:23 +00:00
|
|
|
loadsongdata();
|
2005-04-28 12:33:38 +00:00
|
|
|
return currententry->title;
|
|
|
|
case INTVALUE_ARTIST:
|
2005-04-28 18:49:23 +00:00
|
|
|
loadartistname();
|
2005-04-28 12:33:38 +00:00
|
|
|
return currententry->artistname;
|
|
|
|
case INTVALUE_ALBUM:
|
2005-04-28 18:49:23 +00:00
|
|
|
loadalbumname();
|
2005-04-28 12:33:38 +00:00
|
|
|
return currententry->albumname;
|
|
|
|
case INTVALUE_GENRE:
|
2005-04-28 18:49:23 +00:00
|
|
|
loadsongdata();
|
2005-04-28 12:33:38 +00:00
|
|
|
return currententry->genre;
|
|
|
|
case INTVALUE_FILENAME:
|
|
|
|
return currententry->filename;
|
|
|
|
default:
|
2005-04-28 18:49:23 +00:00
|
|
|
rb->splash(HZ*2,true,"unknown stringid intvalue");
|
2005-04-28 12:33:38 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
// report error
|
2005-04-28 18:49:23 +00:00
|
|
|
rb->splash(HZ*2,true,"unknown token...");
|
2005-04-28 12:33:38 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int getvalue(struct token *token) {
|
|
|
|
switch(token->kind) {
|
|
|
|
case TOKEN_NUM:
|
|
|
|
return token->intvalue;
|
|
|
|
case TOKEN_NUMIDENTIFIER:
|
|
|
|
switch(token->intvalue) {
|
|
|
|
case INTVALUE_YEAR:
|
2005-04-28 18:49:23 +00:00
|
|
|
loadsongdata();
|
2005-04-28 12:33:38 +00:00
|
|
|
return currententry->year;
|
|
|
|
case INTVALUE_RATING:
|
2005-04-28 18:49:23 +00:00
|
|
|
loadrundbdata();
|
2005-04-28 12:33:38 +00:00
|
|
|
return currententry->rating;
|
|
|
|
case INTVALUE_PLAYCOUNT:
|
2005-04-28 18:49:23 +00:00
|
|
|
loadrundbdata();
|
2005-04-28 12:33:38 +00:00
|
|
|
return currententry->playcount;
|
|
|
|
default:
|
2005-04-28 18:49:23 +00:00
|
|
|
rb->splash(HZ*2,true,"unknown numid intvalue");
|
2005-04-28 12:33:38 +00:00
|
|
|
// report error.
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
default:
|
2005-04-28 18:49:23 +00:00
|
|
|
rb->splash(HZ*2,true,"unknown token...");
|
2005-04-28 12:33:38 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|