diff --git a/botthread.c b/botthread.c index 0b44bbd..22406c0 100644 --- a/botthread.c +++ b/botthread.c @@ -4,8 +4,6 @@ #include "tuved.h" -//int playCnt = 0; - int nextSong(); int chanMaint(); @@ -216,14 +214,11 @@ if (tmpChan->modes[CHAN_LIVE] == 0x1) return(0x0); - //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 FROM videos WHERE rating <= %i",tmpChan->modes[CHAN_RATING]); - if (tmpChan->modes[CHAN_EXCLUSIVE]) - sprintf(output,"%s AND oid = %i",output,tmpChan->modes[CHAN_EXCLUSIVE]); - if (tmpChan->modes[CHAN_CLASS]) - sprintf(output,"%s AND classification = %i",output,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) { @@ -231,8 +226,6 @@ tuveSendAllInChan(chan,0x0,output); } else if (mysql_num_rows(res) == 0x0) { - //playCnt++; - //goto dOvr; sprintf(output,"MSG:TUveD:%s:Sorry There Are No Videos Available At The Current Channel Settings.",chan); tuveSendAllInChan(chan,0x0,output); } @@ -288,9 +281,6 @@ res = dbQuery(output,1); - //sprintf(output,"UPDATE videos SET count = %i WHERE vid = %i",atoi(row[6])+1,vid); - //dbQuery(output,0); - if ((res == 0x0) || (mysql_num_rows(res) == 0x0)) { sprintf(output,"MSG:TUveD:%s:Sorry I'm Have SQL Troubles Today.",chan); tuveSendAllInChan(chan,0x0,output); @@ -347,15 +337,6 @@ sprintf(output,"MSG:TUveD:%s:Playing %s (%d:%.2d)",channel,tmpChan->videoChanTitle,min,sec); tuveSendAllInChan(channel,0x0,output); -/* - - if (tmpChan->count != -1) { - if (tmpChan->nextUser != 0x0) - tmpChan->nextUser = tmpChan->nextUser->next; - if (tmpChan->nextUser == 0x0) - tmpChan->nextUser = tmpChan->users; - } -*/ tmpChan->count = MAX_COUNT; @@ -413,18 +394,12 @@ /* Find A Random Song */ 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,"%s AND oid = %i",output,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",output,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) { sprintf(output,"MSG:TUveD:%s:Sorry I'm Having SQL Troubles Today.",tmpChans->channel); @@ -433,8 +408,6 @@ else if (mysql_num_rows(res) == 0x0) { sprintf(output,"MSG:TUveD:%s:Sorry Videos Matching The Channels Settings.",tmpChans->channel); tuveSendAllInChan(tmpChans->channel,0x0,output); - //playCnt++; - //goto getRandom; } else { mysql_data_seek(res,(random() % mysql_num_rows(res)));