Commit 294c6ff5 authored by mitshel's avatar mitshel
Browse files

Merge branch 'v0.15-1-sql-event'

Conflicts:
	py/__pycache__/sopdscfg.cpython-33.pyc
	py/__pycache__/sopdsdb.cpython-33.pyc
parents 0f895582 3a01aaa7
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
Simple OPDS Catalog
Простой OPDS Каталог
Author: Dmitry V.Shelepnev
Версия 0.10.1
Версия 0.15

Установка Simple OPDS в Fedora:

@@ -92,6 +92,3 @@ Alias /opds "/home/www/opds"
     fb2toepub=../fb2epub/fb2epub
     temp_dir=/tmp


   
+5 −0
Original line number Diff line number Diff line
@@ -108,6 +108,11 @@ alphabet_menu = yes
# по умолчанию new_period = 7
new_period = 7 

# Установка параметра book_shelf = yes приведет к появлению в основном меню Книжной полки для пользователя (если настроена авторизация web-сервером)
# Здесь будут запоминаться скачанные пользователем книги. Это удобно при использование нескольких устройств.
# При установке book_shelf = no Книжная полка в главном меню отображаться не будет, также не будет происходить запоминание загружаемых книг
book_shelf = yes

[site]
id=http://sopds.ru/
title=SOPDS.RU | OPDS Catalog
+28 −4
Original line number Diff line number Diff line
@@ -89,17 +89,26 @@ PRIMARY KEY(book_id,ser_id),
INDEX(ser_id));
commit;

drop table if exists bookshelf;
create table bookshelf(
user VARCHAR(32) not NULL,
book_id INT not NULL,
readtime TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
INDEX(user,readtime));
commit;

drop table if exists dbver;
create table dbver(
ver varchar(5));
commit;

insert into dbver(ver) values("0.14");
insert into dbver(ver) values("0.15");
commit;
insert into authors(author_id,last_name) values(1,"Неизвестный Автор");
insert into authors(author_id,last_name,first_name) values(1,"Неизвестный Автор","");
commit;

DROP PROCEDURE IF EXISTS sp_update_dbl;
DROP PROCEDURE IF EXISTS sp_newinfo;
DELIMITER //

CREATE PROCEDURE sp_update_dbl()
@@ -130,8 +139,23 @@ BEGIN
  CLOSE cur;
END //

DELIMITER ;
CREATE PROCEDURE sp_newinfo(period INT)
BEGIN
  DECLARE min_book_id INT;

  select MIN(book_id) into min_book_id from books where registerdate>now()-INTERVAL period DAY;
  select 1 s, count(*) from books where book_id>=min_book_id and avail!=0 and doublicat=0
  union all
  select 2 s, count(*) from (select author_id from bauthors where book_id>=min_book_id group by author_id) a
  union all
  select 3 s, count(*) from (select genre_id from bgenres where book_id>=min_book_id group by genre_id) a
  union all
  select 4 s, count(*) from (select ser_id from bseries where book_id>=min_book_id group by ser_id) a
  order by s;

END //

commit;

DELIMITER ;
commit;
+33 −0
Original line number Diff line number Diff line
update dbver set ver="0.15";
update authors set first_name="" where author_id=1;

drop table if exists bookshelf;
create table bookshelf(
user VARCHAR(32) not NULL,
book_id INT not NULL,
readtime TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
INDEX(user,readtime));
commit;

DROP PROCEDURE IF EXISTS sp_newinfo;

DELIMITER //

CREATE PROCEDURE sp_newinfo(period INT)
BEGIN
  DECLARE min_book_id INT;

  select MIN(book_id) into min_book_id from books where registerdate>now()-INTERVAL period DAY;
  select 1 s, count(*) from books where book_id>=min_book_id and avail!=0 and doublicat=0
  union all
  select 2 s, count(*) from (select author_id from bauthors where book_id>=min_book_id group by author_id) a
  union all
  select 3 s, count(*) from (select genre_id from bgenres where book_id>=min_book_id group by genre_id) a
  union all
  select 4 s, count(*) from (select ser_id from bseries where book_id>=min_book_id group by ser_id) a
  order by s;
END //

DELIMITER ;
commit;
Loading