Commit febb83de authored by mitshel's avatar mitshel
Browse files

В текстовое описание добавлена дата правки книги(из файла fb2)

parent 320726c1
Loading
Loading
Loading
Loading
+22 −16
Original line number Diff line number Diff line
@@ -233,7 +233,7 @@ if type_value==0:
#
elif type_value==1:
   header()
   for (item_type,item_id,item_name,item_path,reg_date,item_title,annotation,format,fsize,cover,cover_type) in opdsdb.getitemsincat(slice_value,cfg.MAXITEMS,page_value):
   for (item_type,item_id,item_name,item_path,reg_date,item_title,annotation,docdate,format,fsize,cover,cover_type) in opdsdb.getitemsincat(slice_value,cfg.MAXITEMS,page_value):
       entry_start()
       entry_head(item_title, reg_date, id_value)
       if item_type==1:
@@ -245,7 +245,8 @@ elif type_value==1:
          entry_covers(cover,cover_type,item_id)
          authors=entry_authors(opdsdb,item_id,True)
          genres=entry_genres(opdsdb,item_id)
          entry_content(annotation+'\n\nНазвание книги: '+item_title+'\nАвтор(ы): '+authors+'\nЖанры: '+genres+'\nФайл : '+item_name+'\nРазмер файла : '+str(fsize//1000)+'Кб')
          if docdate!='': docdate=' \nДата правки: '+docdate
          entry_content(annotation+'\n\nНазвание книги: '+item_title+'\nАвтор(ы): '+authors+'\nЖанры: '+genres+'\nФайл: '+item_name+'\nРазмер файла: '+str(fsize//1000)+'Кб'+docdate)
       entry_finish()
   page_control(opdsdb,page_value,id_value)
   footer()
@@ -321,7 +322,7 @@ if type_value==13 or type_value==71:
      letter="%"+searchTerm

   header()
   for (book_id,book_name,book_path,reg_date,book_title,annotation,format,fsize,cover,cover_type) in opdsdb.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) in opdsdb.getbooksfortitle(letter,cfg.MAXITEMS,page_value,cfg.DUBLICATES_SHOW):
       id='90'+str(book_id)
       entry_start()
       entry_head(book_title, reg_date, id_value)
@@ -329,7 +330,8 @@ if type_value==13 or type_value==71:
       entry_covers(cover,cover_type,book_id)
       authors=entry_authors(opdsdb,book_id,True)
       genres=entry_genres(opdsdb,book_id)
       entry_content(annotation+'\n\nНазвание книги: '+book_title+'\nАвтор(ы): '+authors+'\nЖанры: '+genres+'\nФайл : '+book_name+'\nРазмер файла : '+str(fsize//1000)+'Кб')
       if docdate!='': docdate=' \nДата правки: '+docdate
       entry_content(annotation+'\n\nНазвание книги: '+book_title+'\nАвтор(ы): '+authors+'\nЖанры: '+genres+'\nФайл: '+book_name+'\nРазмер файла: '+str(fsize//1000)+'Кб'+docdate)
       entry_finish()
   page_control(opdsdb,page_value,id_value)
   footer()
@@ -367,7 +369,7 @@ elif type_value==14:
#
if type_value==24:
   header()
   for (book_id,book_name,book_path,reg_date,book_title,annotation,format,fsize,cover,cover_type) in opdsdb.getbooksforgenre(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) in opdsdb.getbooksforgenre(slice_value,cfg.MAXITEMS,page_value,cfg.DUBLICATES_SHOW):
       id='90'+str(book_id)
       entry_start()
       entry_head(book_title, reg_date, id_value)
@@ -375,7 +377,8 @@ if type_value==24:
       entry_covers(cover,cover_type,book_id)
       authors=entry_authors(opdsdb,book_id,True)
       genres=entry_genres(opdsdb,book_id)
       entry_content(annotation+'\n\nНазвание книги: '+book_title+'\nАвтор(ы): '+authors+'\nЖанры: '+genres+'\nФайл : '+book_name+'\nРазмер файла : '+str(fsize//1000)+'Кб')
       if docdate!='': docdate=' \nДата правки: '+docdate
       entry_content(annotation+'\n\nНазвание книги: '+book_title+'\nАвтор(ы): '+authors+'\nЖанры: '+genres+'\nФайл: '+book_name+'\nРазмер файла: '+str(fsize//1000)+'Кб'+docdate)
       entry_finish()
   page_control(opdsdb,page_value,id_value)
   footer()
@@ -385,7 +388,7 @@ if type_value==24:
#
elif type_value==5:
   header()
   for (book_id,book_name,book_path,reg_date,book_title,annotation,format,fsize,cover,cover_type) in opdsdb.getlastbooks(cfg.MAXITEMS):
   for (book_id,book_name,book_path,reg_date,book_title,annotation,docdate,format,fsize,cover,cover_type) in opdsdb.getlastbooks(cfg.MAXITEMS):
       id='90'+str(book_id)
       entry_start()
       entry_head(book_title, reg_date, id_value)
@@ -393,7 +396,8 @@ elif type_value==5:
       entry_covers(cover,cover_type,book_id)
       authors=entry_authors(opdsdb,book_id,True)
       genres=entry_genres(opdsdb,book_id)
       entry_content(annotation+'\n\nНазвание книги: '+book_title+'\nАвтор(ы): '+authors+'\nЖанры: '+genres+'\nФайл : '+book_name+'\nРазмер файла : '+str(fsize//1000)+'Кб')
       if docdate!='': docdate=' \nДата правки: '+docdate
       entry_content(annotation+'\n\nНазвание книги: '+book_title+'\nАвтор(ы): '+authors+'\nЖанры: '+genres+'\nФайл: '+book_name+'\nРазмер файла: '+str(fsize//1000)+'Кб'+docdate)
       entry_finish()
   footer()

@@ -447,7 +451,7 @@ if type_value==12 or type_value==72:
#
if type_value==22:
   header()
   for (book_id,book_name,book_path,reg_date,book_title,annotation,format,fsize,cover,cover_type) in opdsdb.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) in opdsdb.getbooksforautor(slice_value,cfg.MAXITEMS,page_value,cfg.DUBLICATES_SHOW):
       id='90'+str(book_id)
       entry_start()
       entry_head(book_title, reg_date, id_value)
@@ -455,7 +459,8 @@ if type_value==22:
       entry_covers(cover,cover_type,book_id)
       authors=entry_authors(opdsdb,book_id,True)
       genres=entry_genres(opdsdb,book_id)
       entry_content(annotation+'\n\nНазвание книги: '+book_title+'\nАвтор(ы): '+authors+'\nЖанры: '+genres+'\nФайл : '+book_name+'\nРазмер файла : '+str(fsize//1000)+'Кб')
       if docdate!='': docdate=' \nДата правки: '+docdate
       entry_content(annotation+'\n\nНазвание книги: '+book_title+'\nАвтор(ы): '+authors+'\nЖанры: '+genres+'\nФайл: '+book_name+'\nРазмер файла: '+str(fsize//1000)+'Кб'+docdate)
       entry_finish()
   page_control(opdsdb,page_value,id_value)
   footer()
@@ -467,14 +472,15 @@ elif type_value==90:
   id='90'+str(slice_value)
   header()
   enc_print('<link type="application/atom+xml;profile=opds-catalog;kind=acquisition" rel="self" href="sopds.cgi?id='+id+'"/>')
   (book_name,book_path,reg_date,format,title,annotation,cat_type,cover,cover_type,fsize)=opdsdb.getbook(slice_value)
   (book_name,book_path,reg_date,format,title,annotation,docdate,cat_type,cover,cover_type,fsize)=opdsdb.getbook(slice_value)
   entry_start()
   entry_head(title, reg_date, id_value)
   entry_link_book(slice_value,format)
   entry_covers(cover,cover_type,slice_value)
   authors=entry_authors(opdsdb,slice_value,True)
   genres=entry_genres(opdsdb,slice_value)
   entry_content(annotation+'\n\nНазвание книги: '+title+'\nАвтор(ы): '+authors+'\nЖанры: '+genres+'\nФайл : '+book_name+'\nРазмер файла : '+str(fsize//1000)+'Кб')
   if docdate!='': docdate=' \nДата правки: '+docdate
   entry_content(annotation+'\n\nНазвание книги: '+title+'\nАвтор(ы): '+authors+'\nЖанры: '+genres+'\nФайл: '+book_name+'\nРазмер файла: '+str(fsize//1000)+'Кб'+docdate)
   entry_finish()
   footer()

@@ -482,7 +488,7 @@ elif type_value==90:
# Выдача файла книги
#
elif type_value==91:
   (book_name,book_path,reg_date,format,title,annotation,cat_type,cover,cover_type,fsize)=opdsdb.getbook(slice_value)
   (book_name,book_path,reg_date,format,title,annotation,docdate,cat_type,cover,cover_type,fsize)=opdsdb.getbook(slice_value)
   full_path=os.path.join(cfg.ROOT_LIB,book_path)
   if cfg.TITLE_AS_FN: transname=translit(title+'.'+format)
   else: transname=translit(book_name)
@@ -516,7 +522,7 @@ elif type_value==91:
# Выдача файла книги в ZIP формате
#
elif type_value==92:
   (book_name,book_path,reg_date,format,title,annotation,cat_type,cover,cover_type,fsize)=opdsdb.getbook(slice_value)
   (book_name,book_path,reg_date,format,title,annotation,docdate,cat_type,cover,cover_type,fsize)=opdsdb.getbook(slice_value)
   full_path=os.path.join(cfg.ROOT_LIB,book_path)
   if cfg.TITLE_AS_FN: transname=translit(title+'.'+format)
   else: transname=translit(book_name)
@@ -557,7 +563,7 @@ elif type_value==92:
# Выдача файла книги после конвертации в EPUB
#
elif type_value==93:
   (book_name,book_path,reg_date,format,title,annotation,cat_type,cover,cover_type,fsize)=opdsdb.getbook(slice_value)
   (book_name,book_path,reg_date,format,title,annotation,docdate,cat_type,cover,cover_type,fsize)=opdsdb.getbook(slice_value)
   full_path=os.path.join(cfg.ROOT_LIB,book_path)
   (n,e)=os.path.splitext(book_name)
   if cfg.TITLE_AS_FN: transname=translit(title)+'.epub'
@@ -600,7 +606,7 @@ elif type_value==93:
# Выдача Обложки На лету
#
elif type_value==99:
   (book_name,book_path,reg_date,format,title,annotation,cat_type,cover,cover_type,fsize)=opdsdb.getbook(slice_value)
   (book_name,book_path,reg_date,format,title,annotation,docdate,cat_type,cover,cover_type,fsize)=opdsdb.getbook(slice_value)
   c0=0
   if format=='fb2':
      full_path=os.path.join(cfg.ROOT_LIB,book_path)
+7 −7
Original line number Diff line number Diff line
@@ -290,8 +290,8 @@ class opdsDatabase:
       limitstr=""
    else:
       limitstr="limit "+str(limit*page)+","+str(limit)
    sql_finditems=("select SQL_CALC_FOUND_ROWS 1,cat_id,cat_name,path,now(),cat_name as title,'' as annotation,'cat' as format, 0 as filesize, '' as cover, '' as cover_type from "+TBL_CATALOGS+" where parent_id="+str(cat_id)+" union all "
    "select 2,book_id,filename,path,registerdate,title,annotation,format,filesize,cover,cover_type from "+TBL_BOOKS+" where cat_id="+str(cat_id)+" and avail!=0 order by 1,6 "+limitstr)
    sql_finditems=("select SQL_CALC_FOUND_ROWS 1,cat_id,cat_name,path,now(),cat_name as title,'' as docdate,'' as annotation,'cat' as format, 0 as filesize, '' as cover, '' as cover_type from "+TBL_CATALOGS+" where parent_id="+str(cat_id)+" union all "
    "select 2,book_id,filename,path,registerdate,title,annotation,docdate,format,filesize,cover,cover_type from "+TBL_BOOKS+" where cat_id="+str(cat_id)+" and avail!=0 order by 1,6 "+limitstr)
    cursor=self.cnx.cursor()
    cursor.execute(sql_finditems)
    rows=cursor.fetchall()
@@ -307,7 +307,7 @@ class opdsDatabase:
    return rows

  def getbook(self,book_id):
    sql_getbook=("select filename, path, registerdate, format, title, annotation, cat_type, cover, cover_type, filesize from "+TBL_BOOKS+" where book_id="+str(book_id)+" and avail!=0")
    sql_getbook=("select filename, path, registerdate, format, title, annotation, docdate,cat_type, cover, cover_type, filesize from "+TBL_BOOKS+" where book_id="+str(book_id)+" and avail!=0")
    cursor=self.cnx.cursor()
    cursor.execute(sql_getbook)
    row=cursor.fetchone()
@@ -361,7 +361,7 @@ class opdsDatabase:
       dstr=''
    else:
       dstr=' and doublicat=0 '
    sql="select SQL_CALC_FOUND_ROWS book_id,filename,path,registerdate,title,annotation,format,filesize,cover,cover_type from "+TBL_BOOKS+" where title like '"+letters+"%' "+dstr+" and avail!=0 order by title "+limitstr
    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
    cursor=self.cnx.cursor()
    cursor.execute(sql)
    rows=cursor.fetchall()
@@ -409,7 +409,7 @@ class opdsDatabase:
       dstr=''
    else:
       dstr=' and a.doublicat=0 '
    sql="select SQL_CALC_FOUND_ROWS a.book_id,a.filename,a.path,a.registerdate,a.title,a.annotation,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
    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
    cursor=self.cnx.cursor()
    cursor.execute(sql)
    rows=cursor.fetchall()
@@ -429,7 +429,7 @@ class opdsDatabase:
       limitstr=""
    else:
       limitstr="limit "+str(limit)
    sql="select book_id,filename,path,registerdate,title,annotation,format,filesize,cover,cover_type from "+TBL_BOOKS+" where avail!=0 order by registerdate desc "+limitstr
    sql="select book_id,filename,path,registerdate,title,annotation,docdate,format,filesize,cover,cover_type from "+TBL_BOOKS+" where avail!=0 order by registerdate desc "+limitstr
    cursor=self.cnx.cursor()
    cursor.execute(sql)
    rows=cursor.fetchall()
@@ -461,7 +461,7 @@ class opdsDatabase:
       dstr=''
    else:
       dstr=' and a.doublicat=0 '
    sql="select SQL_CALC_FOUND_ROWS a.book_id,a.filename,a.path,a.registerdate,a.title,a.annotation,a.format,a.filesize,a.cover,a.cover_type from "+TBL_BOOKS+" a, "+TBL_BGENRES+" b where a.book_id=b.book_id and b.genre_id="+str(genre_id)+dstr+" and a.avail!=0 order by a.lang desc, a.title "+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_BGENRES+" b where a.book_id=b.book_id and b.genre_id="+str(genre_id)+dstr+" and a.avail!=0 order by a.lang desc, a.title "+limitstr
    cursor=self.cnx.cursor()
    cursor.execute(sql)
    rows=cursor.fetchall()