Commit ae476d10 authored by mitshel's avatar mitshel
Browse files

Ссылки на книги теперь выдаются без "промежуточного" варината. Сразу в превом...

Ссылки на книги теперь выдаются без "промежуточного" варината. Сразу в превом же списке книг теперь вся информация по книгам, авторы, жанры, аннотаици и т.д. включая ссылки на файлы книг.
parent 5a36f74f
Loading
Loading
Loading
Loading
+30 −22
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ def entry_authors(db,book_id,link_show=False):

def entry_genres(db,book_id):
   genres=""
   for (section,genre) in opdsdb.getgenres(slice_value):
   for (section,genre) in opdsdb.getgenres(book_id):
       enc_print('<category term="%s" label="%s" />'%(genre,genre))
       if len(genres)>0:
             genres+=', '
@@ -214,19 +214,19 @@ if type_value==0:
#
elif type_value==1:
   header()
   for (item_type,item_id,item_name,item_path,reg_date,item_title,cover,cover_type) in opdsdb.getitemsincat(slice_value,cfg.MAXITEMS,page_value):
       if item_type==1:
          id='01'+str(item_id)
       elif item_type==2:
          id='90'+str(item_id)
       else:
          id='00'
   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):
       entry_start()
       entry_head(item_title, reg_date, id_value)
       if item_type==1:
          id='01'+str(item_id)
          entry_link_subsection(id)
       if item_type==2:
          id='90'+str(item_id)
          entry_link_book(item_id,format)
          entry_covers(cover,cover_type,item_id)
          entry_authors(opdsdb,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)+'Кб')
       entry_finish()
   page_control(opdsdb,page_value,id_value)
   footer()
@@ -302,13 +302,15 @@ if type_value==13 or type_value==71:
      letter="%"+searchTerm

   header()
   for (book_id,book_name,book_path,reg_date,book_title,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,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)
       entry_link_subsection(id)
       entry_link_book(book_id,format)
       entry_covers(cover,cover_type,book_id)
       entry_authors(opdsdb,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)+'Кб')
       entry_finish()
   page_control(opdsdb,page_value,id_value)
   footer()
@@ -346,13 +348,15 @@ elif type_value==14:
#
if type_value==24:
   header()
   for (book_id,book_name,book_path,reg_date,book_title,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,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)
       entry_link_subsection(id)
       entry_link_book(book_id,format)
       entry_covers(cover,cover_type,book_id)
       entry_authors(opdsdb,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)+'Кб')
       entry_finish()
   page_control(opdsdb,page_value,id_value)
   footer()
@@ -362,13 +366,15 @@ if type_value==24:
#
elif type_value==5:
   header()
   for (book_id,book_name,book_path,reg_date,book_title,cover,cover_type) in opdsdb.getlastbooks(cfg.MAXITEMS):
   for (book_id,book_name,book_path,reg_date,book_title,annotation,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)
       entry_link_subsection(id)
       entry_link_book(book_id,format)
       entry_covers(cover,cover_type,book_id)
       entry_authors(opdsdb,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)+'Кб')
       entry_finish()
   footer()

@@ -422,13 +428,15 @@ if type_value==12 or type_value==72:
#
if type_value==22:
   header()
   for (book_id,book_name,book_path,reg_date,book_title,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,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)
       entry_link_subsection(id)
       entry_link_book(book_id,format)
       entry_covers(cover,cover_type,book_id)
       entry_authors(opdsdb,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)+'Кб')
       entry_finish()
   page_control(opdsdb,page_value,id_value)
   footer()
+6 −6
Original line number Diff line number Diff line
@@ -302,8 +302,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 cover, '' as cover_type from "+TBL_CATALOGS+" where parent_id="+str(cat_id)+" union all "
    "select 2,book_id,filename,path,registerdate,title,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 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)
    cursor=self.cnx.cursor()
    cursor.execute(sql_finditems)
    rows=cursor.fetchall()
@@ -373,7 +373,7 @@ class opdsDatabase:
       dstr=''
    else:
       dstr=' and doublicat=0 '
    sql="select SQL_CALC_FOUND_ROWS book_id,filename,path,registerdate,title,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,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()
@@ -421,7 +421,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.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.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()
@@ -441,7 +441,7 @@ class opdsDatabase:
       limitstr=""
    else:
       limitstr="limit "+str(limit)
    sql="select book_id,filename,path,registerdate,title,cover,cover_type from "+TBL_BOOKS+" where avail!=0 order by registerdate desc "+limitstr
    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
    cursor=self.cnx.cursor()
    cursor.execute(sql)
    rows=cursor.fetchall()
@@ -473,7 +473,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.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.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()