Commit 37f0879a authored by mitshel's avatar mitshel
Browse files

Название файла nocover.jpg вынесено в модуль sopdscfg.py

при отсутсвии файла nocover (и если конечно обложки нет) выдается статус 404 Not Found
parent 5ec3c793
Loading
Loading
Loading
Loading
+1.72 KiB (22.2 KiB)

File changed.

No diff preview for this file type.

+9 −9
Original line number Diff line number Diff line
@@ -618,15 +618,15 @@ elif type_value==99:
           c0=0

   if c0==0: 
#      print('Status: 404 Not Found')
#      print()
      if os.path.exists(cfg.NOCOVER_IMG):
         enc_print('Content-Type: image/jpeg')
         enc_print()
      f=open('nocover.jpg',"rb")
         f=open(cfg.NOCOVER_IMG,"rb")
         sys.stdout.buffer.write(f.read())
         f.close()

      
      else:
         print('Status: 404 Not Found')
         print()

   opdsdb.closeDB()

+1 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ CFG_FILENAME='sopds.conf'
CFG_PATH_DEFAULT=ROOT_PATH+os.path.sep+'conf'+os.path.sep+CFG_FILENAME
CFG_PATH=CFG_PATH_DEFAULT
COVER_PATH=os.path.join(ROOT_PATH,'covers')
NOCOVER_IMG='nocover.jpg'

###########################################################################
# Считываем конфигурацию из конфигурационного файла
+1 −1
Original line number Diff line number Diff line
@@ -458,7 +458,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+" order by a.title "+limitstr
    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+" order by a.lang desc, a.title "+limitstr
    cursor=self.cnx.cursor()
    cursor.execute(sql)
    rows=cursor.fetchall()