summaryrefslogtreecommitdiff
path: root/apps/plugins/searchengine/token.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/searchengine/token.c')
-rw-r--r--apps/plugins/searchengine/token.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/apps/plugins/searchengine/token.c b/apps/plugins/searchengine/token.c
index cc4f5b3224..84ce21daeb 100644
--- a/apps/plugins/searchengine/token.c
+++ b/apps/plugins/searchengine/token.c
@@ -16,14 +16,10 @@
16 * KIND, either express or implied. 16 * KIND, either express or implied.
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19#include "searchengine.h"
19#include "token.h" 20#include "token.h"
20#include "dbinterface.h" 21#include "dbinterface.h"
21 22
22#define REQUIRESONGDATA() if(!currententry->loadedsongdata) loadsongdata();
23#define REQUIRERUNDBDATA() if(!currententry->loadedrundbdata) loadrundbdata();
24#define REQUIREALBUMNAME() if(!currententry->loadedalbumname) { REQUIRESONGDATA(); loadalbumname(); }
25#define REQUIREARTISTNAME() if(!currententry->loadedartistname) { REQUIRESONGDATA(); loadartistname(); }
26
27char *getstring(struct token *token) { 23char *getstring(struct token *token) {
28 switch(token->kind) { 24 switch(token->kind) {
29 case TOKEN_STRING: 25 case TOKEN_STRING:
@@ -31,25 +27,27 @@ char *getstring(struct token *token) {
31 case TOKEN_STRINGIDENTIFIER: 27 case TOKEN_STRINGIDENTIFIER:
32 switch(token->intvalue) { 28 switch(token->intvalue) {
33 case INTVALUE_TITLE: 29 case INTVALUE_TITLE:
34 REQUIRESONGDATA(); 30 loadsongdata();
35 return currententry->title; 31 return currententry->title;
36 case INTVALUE_ARTIST: 32 case INTVALUE_ARTIST:
37 REQUIREARTISTNAME(); 33 loadartistname();
38 return currententry->artistname; 34 return currententry->artistname;
39 case INTVALUE_ALBUM: 35 case INTVALUE_ALBUM:
40 REQUIREALBUMNAME(); 36 loadalbumname();
41 return currententry->albumname; 37 return currententry->albumname;
42 case INTVALUE_GENRE: 38 case INTVALUE_GENRE:
43 REQUIRESONGDATA(); 39 loadsongdata();
44 return currententry->genre; 40 return currententry->genre;
45 case INTVALUE_FILENAME: 41 case INTVALUE_FILENAME:
46 return currententry->filename; 42 return currententry->filename;
47 default: 43 default:
44 rb->splash(HZ*2,true,"unknown stringid intvalue");
48 return 0; 45 return 0;
49 } 46 }
50 break; 47 break;
51 default: 48 default:
52 // report error 49 // report error
50 rb->splash(HZ*2,true,"unknown token...");
53 return 0; 51 return 0;
54 } 52 }
55} 53}
@@ -61,19 +59,21 @@ int getvalue(struct token *token) {
61 case TOKEN_NUMIDENTIFIER: 59 case TOKEN_NUMIDENTIFIER:
62 switch(token->intvalue) { 60 switch(token->intvalue) {
63 case INTVALUE_YEAR: 61 case INTVALUE_YEAR:
64 REQUIRESONGDATA(); 62 loadsongdata();
65 return currententry->year; 63 return currententry->year;
66 case INTVALUE_RATING: 64 case INTVALUE_RATING:
67 REQUIRERUNDBDATA(); 65 loadrundbdata();
68 return currententry->rating; 66 return currententry->rating;
69 case INTVALUE_PLAYCOUNT: 67 case INTVALUE_PLAYCOUNT:
70 REQUIRERUNDBDATA(); 68 loadrundbdata();
71 return currententry->playcount; 69 return currententry->playcount;
72 default: 70 default:
71 rb->splash(HZ*2,true,"unknown numid intvalue");
73 // report error. 72 // report error.
74 return 0; 73 return 0;
75 } 74 }
76 default: 75 default:
76 rb->splash(HZ*2,true,"unknown token...");
77 return 0; 77 return 0;
78 } 78 }
79} 79}