for (letters,cnt)inopdsdb.gettitle_2letters(letter,cfg.DUBLICATES_SHOW,alpha,news):
for (letters,cnt)inopdsdb.gettitle_2letters(letter,cfg.DUBLICATES_SHOW,alpha,np):
id=""
foriinrange(len(letters)):
id+='%04d'%(ord(letters[i]))
@@ -443,7 +450,7 @@ if type_value==13 or type_value==71:
letter="%"+searchTerm
header()
for (book_id,book_name,book_path,reg_date,book_title,annotation,docdate,format,fsize,cover,cover_type)inopdsdb.getbooksfortitle(letter,cfg.MAXITEMS,page_value,cfg.DUBLICATES_SHOW):
for (book_id,book_name,book_path,reg_date,book_title,annotation,docdate,format,fsize,cover,cover_type)inopdsdb.getbooksfortitle(letter,cfg.MAXITEMS,page_value,cfg.DUBLICATES_SHOW,np):
elifalpha==2:having=" having INSTR('0123456789',letters)>0 and letters!=''"
elifalpha==3:having=" having INSTR('ABCDEFGHIJKLMNOPQRSTUVWXYZ',letters)>0 and letters!=''"
elifalpha==4:having=" having INSTR('ABCDEFGHIJKLMNOPQRSTUVWXYZАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЬЫЪЭЮЯ0123456789',letters)=0 and letters!=''"
ifhaving=="":having=" having "+period
else:having=having+""+period
sql="select UPPER(substring(trim(title),1,"+str(lc)+")) as letters, count(*) as cnt from "+TBL_BOOKS+" where substring(trim(title),1,"+str(lc-1)+")='"+letters+"'"+dstr+" and avail!=0 group by 1"+having+" order by 1"
sql="select UPPER(substring(trim(title),1,"+str(lc)+")) as letters, count(*) as cnt from "+TBL_BOOKS+" where substring(trim(title),1,"+str(lc-1)+")=%s and avail!=0 "+dstr+period+" group by 1"+having+" order by 1"
sql="select SQL_CALC_FOUND_ROWS book_id,filename,path,registerdate,title,annotation,docdate,format,filesize,cover,cover_type from "+TBL_BOOKS+" where title like '"+letters+"%'"+dstr+" and avail!=0 order by title "+limitstr
else:period=" and (registerdate>now()-INTERVAL %s DAY)"%new_period
sql="select SQL_CALC_FOUND_ROWS book_id,filename,path,registerdate,title,annotation,docdate,format,filesize,cover,cover_type from "+TBL_BOOKS+" where title like %s and avail!=0"+dstr+period+" order by title "+limitstr
sql="select 1 s, count(avail) from %s where avail!=0 %s %s"%(TBL_BOOKS,dstr,period)
sql1="select 1 s, count(avail) from %s where avail!=0 %s %s"%(TBL_BOOKS,dstr,period)
sql2="select 2 s, count(*) from (select b.author_id from %s b left join %s c on b.book_id=c.book_id where c.avail!=0 %s group by b.author_id) a1"%(TBL_BAUTHORS,TBL_BOOKS,period)
sql3="select 3 s, count(*) from (select b.genre_id from %s b left join %s c on b.book_id=c.book_id where c.avail!=0 %s group by b.genre_id) a2"%(TBL_BGENRES,TBL_BOOKS,period)
sql4="select 4 s, count(*) from (select b.ser_id from %s b left join %s c on b.book_id=c.book_id where c.avail!=0 %s group by b.ser_id) a3"%(TBL_BSERIES,TBL_BOOKS,period)
sql=sql1+" union all "+sql2+" union all "+sql3+" union all "+sql4+" order by s"
cursor=self.cnx.cursor()
cursor.execute(sql)
rows=cursor.fetchall()
cursor.close
returnrows
defzipisscanned(self,zipname,setavail=0):
sql='select cat_id from '+TBL_BOOKS+' where path="'+zipname+'" limit 1'