diff --git a/botthread.c b/botthread.c index a1df256..f132e01 100644 --- a/botthread.c +++ b/botthread.c @@ -218,7 +218,13 @@ //dOvr: //sprintf(output,"SELECT artist,title,file,length,vid,classification,rating,count FROM videos WHERE rating <= %i AND classification = %i AND count <= %i",tmpChan->modes[CHAN_RATING],tmpChan->modes[CHAN_CLASS],playCnt); - sprintf(output,"SELECT artist,title,file,length,vid,classification,rating,count FROM videos WHERE rating <= %i AND classification = %i",tmpChan->modes[CHAN_RATING],tmpChan->modes[CHAN_CLASS]); + //sprintf(output,"SELECT artist,title,file,length,vid,classification,rating,count FROM videos WHERE rating <= %i AND classification = %i",tmpChan->modes[CHAN_RATING],tmpChan->modes[CHAN_CLASS]); + sprintf(output,"SELECT artist,title,file,length,vid,classification,rating FROM videos WHERE rating <= %i",tmpChans->modes[CHAN_RATING]); + if (tmpChans->modes[CHAN_EXCLUSIVE]) + sprintf(output,"%s AND oid = %i",tmpChans->modes[CHAN_EXCLUSIVE]); + if (tmpChans->modes[CHAN_CLASS]) + sprintf(output,"%s AND classification = %i",tmpChans->mode[CHAN_CLASS]); + res = dbQuery(output,1); if (res == 0x0) { sprintf(output,"MSG:TUveD:%s:Sorry I'm Have SQL Troubles Today.",chan); @@ -245,17 +251,9 @@ void *tuveCMD_Thread(void *threadid) { int tid; - MYSQL_RES *res = 0x0; - MYSQL_ROW row; tid = (int)threadid; writeLog(0,"Starting Bot Thread: [%d]\n", tid); -/* - res = dbQuery("SELECT count FROM videos ORDER BY count ASC LIMIT 1",1); - row = mysql_fetch_row(res); - playCnt = atoi(row[0]); - mysql_free_result(res); -*/ while (1) { sleep(5); @@ -416,10 +414,16 @@ getRandom: if (tmpChans->modes[CHAN_RANDOM] == 0x1) { //sprintf(output,"SELECT artist,title,file,length,vid,classification,rating,count FROM videos WHERE rating <= %i AND classification = %i AND count <= %i AND oid = %i",tmpChans->modes[CHAN_RATING],tmpChans->modes[CHAN_CLASS],playCnt,tmpChans->modes[CHAN_EXCLUSIVE]); + sprintf(output,"SELECT artist,title,file,length,vid,classification,rating FROM videos WHERE rating <= %i",tmpChans->modes[CHAN_RATING]); if (tmpChans->modes[CHAN_EXCLUSIVE]) - sprintf(output,"SELECT artist,title,file,length,vid,classification,rating,count FROM videos WHERE rating <= %i AND classification = %i AND oid = %i",tmpChans->modes[CHAN_RATING],tmpChans->modes[CHAN_CLASS],tmpChans->modes[CHAN_EXCLUSIVE]); - else - sprintf(output,"SELECT artist,title,file,length,vid,classification,rating,count FROM videos WHERE rating <= %i AND classification = %i",tmpChans->modes[CHAN_RATING],tmpChans->modes[CHAN_CLASS]); + sprintf(output,"%s AND oid = %i",tmpChans->modes[CHAN_EXCLUSIVE]); + if (tmpChans->modes[CHAN_CLASS]) + sprintf(output,"%s AND classification = %i",tmpChans->mode[CHAN_CLASS]); + + + //sprintf(output,"SELECT artist,title,file,length,vid,classification,rating,count FROM videos WHERE rating <= %i AND classification = %i AND oid = %i",tmpChans->modes[CHAN_RATING],tmpChans->modes[CHAN_CLASS],tmpChans->modes[CHAN_EXCLUSIVE]); + //else + //sprintf(output,"SELECT artist,title,file,length,vid,classification,rating,count FROM videos WHERE rating <= %i AND classification = %i",tmpChans->modes[CHAN_RATING],tmpChans->modes[CHAN_CLASS]); //sprintf(output,"SELECT artist,title,file,length,vid,classification,rating,count FROM videos WHERE rating <= %i AND classification = %i AND count <= %i",tmpChans->modes[CHAN_RATING],tmpChans->modes[CHAN_CLASS],playCnt); res = dbQuery(output,1); if (res == 0x0) {