for (letters,cnt)inopdsdb.getauthor_2letters(letter,alpha):
for (letters,cnt)inopdsdb.getauthor_2letters(letter,alpha,np):
id=""
foriinrange(len(letters)):
id+='%04d'%(ord(letters[i]))
@@ -389,7 +389,7 @@ elif type_value==6:
i=i//10000
header()
for (letters,cnt)inopdsdb.getseries_2letters(letter,alpha):
for (letters,cnt)inopdsdb.getseries_2letters(letter,alpha,np):
id=""
foriinrange(len(letters)):
id+='%04d'%(ord(letters[i]))
@@ -571,7 +571,7 @@ if type_value==12 or type_value==72:
letter="%"+searchTerm
header()
for (author_id,first_name,last_name,cnt)inopdsdb.getauthorsbyl(letter,cfg.MAXITEMS,page_value,cfg.DUBLICATES_SHOW):
for (author_id,first_name,last_name,cnt)inopdsdb.getauthorsbyl(letter,cfg.MAXITEMS,page_value,cfg.DUBLICATES_SHOW,np):
id='22'+str(author_id)
entry_start()
entry_head(last_name+''+first_name,None,id_value)
@@ -597,7 +597,7 @@ if type_value==16 or type_value==73:
letter="%"+searchTerm
header()
for (ser_id,ser,cnt)inopdsdb.getseriesbyl(letter,cfg.MAXITEMS,page_value,cfg.DUBLICATES_SHOW):
for (ser_id,ser,cnt)inopdsdb.getseriesbyl(letter,cfg.MAXITEMS,page_value,cfg.DUBLICATES_SHOW,np):
id='26'+str(ser_id)
entry_start()
entry_head(ser,None,id_value)
@@ -613,7 +613,7 @@ if type_value==16 or type_value==73:
#
iftype_value==22:
header()
for (book_id,book_name,book_path,reg_date,book_title,annotation,docdate,format,fsize,cover,cover_type)inopdsdb.getbooksforautor(slice_value,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.getbooksforautor(slice_value,cfg.MAXITEMS,page_value,cfg.DUBLICATES_SHOW,np):
id='90'+str(book_id)
entry_start()
entry_head(book_title,reg_date,id_value)
@@ -632,7 +632,7 @@ if type_value==22:
#
iftype_value==26:
header()
for (book_id,book_name,book_path,reg_date,book_title,annotation,docdate,format,fsize,cover,cover_type)inopdsdb.getbooksforser(slice_value,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.getbooksforser(slice_value,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!=''"
sql="select UPPER(substring(CONCAT(TRIM(last_name),'',trim(first_name)),1,"+str(lc)+")) as letters, count(*) as cnt from "+TBL_AUTHORS+" where substring(CONCAT(trim(last_name),'',trim(first_name)),1,"+str(lc-1)+")='"+letters+"' group by 1"+having+" order by 1"
ifnew_period==0:period=''
else:period="and author_id in (select b.author_id from bauthors b left join books c on b.book_id=c.book_id where registerdate>now()-INTERVAL %s DAY group by b.author_id)"%new_period
sql="select UPPER(substring(CONCAT(TRIM(last_name),'',trim(first_name)),1,"+str(lc)+")) as letters, count(*) as cnt from "+TBL_AUTHORS+" where substring(CONCAT(trim(last_name),'',trim(first_name)),1,"+str(lc-1)+")=%s "+period+" group by 1"+having+" order by 1"
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!=''"
ifnew_period==0:period=''
else:period="and ser_id in (select b.ser_id from bseries b left join books c on b.book_id=c.book_id where registerdate>now()-INTERVAL %s DAY group by b.ser_id)"%new_period
sql="select UPPER(substring(TRIM(ser),1,"+str(lc)+")) as letters, count(*) as cnt from "+TBL_SERIES+" where substring(trim(ser),1,"+str(lc-1)+")='"+letters+"' group by 1"+having+" order by 1"
sql="select UPPER(substring(TRIM(ser),1,"+str(lc)+")) as letters, count(*) as cnt from "+TBL_SERIES+" where substring(trim(ser),1,"+str(lc-1)+")=%s "+period+" group by 1"+having+" order by 1"
sql="select SQL_CALC_FOUND_ROWS a.author_id, a.first_name, a.last_name, count(*) as cnt from "+TBL_AUTHORS+" a, "+TBL_BAUTHORS+" b, "+TBL_BOOKS+" c where a.author_id=b.author_id and b.book_id=c.book_id and CONCAT(TRIM(a.last_name),'',TRIM(a.first_name)) like '"+letters+"%'"+dstr+" and c.avail!=0 group by 1,2,3 order by 3,2 "+limitstr
else:period=" and (registerdate>now()-INTERVAL %s DAY) and a.author_id in (select b.author_id from bauthors b left join books c on b.book_id=c.book_id where registerdate>now()-INTERVAL %s DAY group by b.author_id)"%(new_period,new_period)
sql="select SQL_CALC_FOUND_ROWS a.author_id, a.first_name, a.last_name, count(*) as cnt from "+TBL_AUTHORS+" a, "+TBL_BAUTHORS+" b, "+TBL_BOOKS+" c where a.author_id=b.author_id and b.book_id=c.book_id and CONCAT(TRIM(a.last_name),'',TRIM(a.first_name)) like %s and c.avail!=0 "+dstr+period+" group by 1,2,3 order by 3,2 "+limitstr
sql="select SQL_CALC_FOUND_ROWS a.book_id,a.filename,a.path,a.registerdate,a.title,a.annotation,a.docdate,a.format,a.filesize,a.cover,a.cover_type from "+TBL_BOOKS+" a, "+TBL_BAUTHORS+" b where a.book_id=b.book_id and b.author_id="+str(author_id)+dstr+" and a.avail!=0 order by a.title "+limitstr
else:period=" and (registerdate>now()-INTERVAL %s DAY)"%new_period
sql="select SQL_CALC_FOUND_ROWS a.book_id,a.filename,a.path,a.registerdate,a.title,a.annotation,a.docdate,a.format,a.filesize,a.cover,a.cover_type from "+TBL_BOOKS+" a, "+TBL_BAUTHORS+" b where a.book_id=b.book_id and b.author_id="+str(author_id)+" and a.avail!=0 "+dstr+period+" order by a.title "+limitstr
sql="select SQL_CALC_FOUND_ROWS a.ser_id, a.ser, count(*) as cnt from "+TBL_SERIES+" a, "+TBL_BSERIES+" b, "+TBL_BOOKS+" c where a.ser_id=b.ser_id and b.book_id=c.book_id and TRIM(a.ser) like %s "+dstr+" and c.avail!=0 group by 1,2 order by 2 "+limitstr
else:period=" and (registerdate>now()-INTERVAL %s DAY) and a.ser_id in (select b.ser_id from bseries b left join books c on b.book_id=c.book_id where registerdate>now()-INTERVAL %s DAY group by b.ser_id)"%(new_period,new_period)
sql="select SQL_CALC_FOUND_ROWS a.ser_id, a.ser, count(*) as cnt from "+TBL_SERIES+" a, "+TBL_BSERIES+" b, "+TBL_BOOKS+" c where a.ser_id=b.ser_id and b.book_id=c.book_id and TRIM(a.ser) like %s and c.avail!=0 "+dstr+period+" group by 1,2 order by 2 "+limitstr
sql="select SQL_CALC_FOUND_ROWS a.book_id,a.filename,a.path,a.registerdate,a.title,a.annotation,a.docdate,a.format,a.filesize,a.cover,a.cover_type from "+TBL_BOOKS+" a, "+TBL_BSERIES+" b where a.book_id=b.book_id and b.ser_id="+str(ser_id)+dstr+" and a.avail!=0 order by a.title "+limitstr
else:period=" and (registerdate>now()-INTERVAL %s DAY)"%new_period
sql="select SQL_CALC_FOUND_ROWS a.book_id,a.filename,a.path,a.registerdate,a.title,a.annotation,a.docdate,a.format,a.filesize,a.cover,a.cover_type from "+TBL_BOOKS+" a, "+TBL_BSERIES+" b where a.book_id=b.book_id and b.ser_id="+str(ser_id)+" and a.avail!=0 "+dstr+period+" order by a.title "+limitstr