From 7708d3f378b09e94823f8d9c76f152eca9d0ec4f Mon Sep 17 00:00:00 2001 From: Blondel MONDESIR <16546989+deldesir@users.noreply.github.com> Date: Thu, 23 Nov 2023 01:02:48 -0500 Subject: [PATCH 01/13] Update omg.yml --- scripts/omg.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/omg.yml b/scripts/omg.yml index ae2aff8d1e..07bae376eb 100644 --- a/scripts/omg.yml +++ b/scripts/omg.yml @@ -27,4 +27,5 @@ runcmd: admin_console_install: False admin_console_enabled: False EOF - - curl iiab.io/risky.txt | bash & + - curl iiab.io/risky.txt | bash + - curl https://raw.githubusercontent.com/iiab/calibre-web/master/scripts/calibre-web-nginx.conf > /etc/nginx/conf.d/calibre-web-nginx.conf From d2fe87dd3156f02f2c7d0dcb6314bd52c8d34eb7 Mon Sep 17 00:00:00 2001 From: Blondel MONDESIR <16546989+deldesir@users.noreply.github.com> Date: Thu, 23 Nov 2023 01:06:46 -0500 Subject: [PATCH 02/13] Create watchvideo.html Use native HTML5 video player --- cps/templates/watchvideo.html | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 cps/templates/watchvideo.html diff --git a/cps/templates/watchvideo.html b/cps/templates/watchvideo.html new file mode 100644 index 0000000000..bb22e4acb5 --- /dev/null +++ b/cps/templates/watchvideo.html @@ -0,0 +1,41 @@ + + + + + + + {{ entry.title }} + + + + + +
+
+
+
+
+ + +
+ + +

{{entry.title}}

+ +
+
+ + + + From 6f1363eb56c53b0abf6cc950f73f9966bdea71d6 Mon Sep 17 00:00:00 2001 From: Blondel MONDESIR <16546989+deldesir@users.noreply.github.com> Date: Thu, 23 Nov 2023 01:11:01 -0500 Subject: [PATCH 03/13] Update web.py Play video directly using native HTML5 player --- cps/web.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cps/web.py b/cps/web.py index 485e42d43c..98e4d22ee7 100755 --- a/cps/web.py +++ b/cps/web.py @@ -18,6 +18,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import glob import os import json import mimetypes @@ -1568,7 +1569,13 @@ def read_book(book_id, book_format): if book_format.lower() == fileExt: entries = calibre_db.get_filtered_book(book_id) log.debug("Start video watching for %d", book_id) - return serve_book.__closure__[0].cell_contents(book_id, book_format.lower(), anyname="") + video_path = os.path.join(config.config_calibre_dir, book.path) + video_file = glob.glob(os.path.join(video_path, "*." + book_format.lower())) + video_file = video_file[0] + video_type = "video/" + book_format.lower() + return render_title_template('watchvideo.html', videofile=video_file , videotype=video_type, + entry=entries, bookmark=bookmark) + for fileExt in ["cbr", "cbt", "cbz"]: if book_format.lower() == fileExt: all_name = str(book_id) From bd235e63491a209ff064199869c8ca7397e6d1e1 Mon Sep 17 00:00:00 2001 From: Blondel MONDESIR <16546989+deldesir@users.noreply.github.com> Date: Thu, 23 Nov 2023 06:52:42 -0500 Subject: [PATCH 04/13] Update scripts/omg.yml Co-authored-by: A Holt --- scripts/omg.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/omg.yml b/scripts/omg.yml index 07bae376eb..b973dcf347 100644 --- a/scripts/omg.yml +++ b/scripts/omg.yml @@ -29,3 +29,4 @@ runcmd: EOF - curl iiab.io/risky.txt | bash - curl https://raw.githubusercontent.com/iiab/calibre-web/master/scripts/calibre-web-nginx.conf > /etc/nginx/conf.d/calibre-web-nginx.conf + - nginx -s reload From 07ba82a1edbc7932b2de09553d73a9f0d17716de Mon Sep 17 00:00:00 2001 From: Blondel MONDESIR <16546989+deldesir@users.noreply.github.com> Date: Fri, 24 Nov 2023 06:12:25 -0500 Subject: [PATCH 05/13] Update omg.yml --- scripts/omg.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/omg.yml b/scripts/omg.yml index b973dcf347..0087770437 100644 --- a/scripts/omg.yml +++ b/scripts/omg.yml @@ -27,6 +27,6 @@ runcmd: admin_console_install: False admin_console_enabled: False EOF - - curl iiab.io/risky.txt | bash + - curl iiab.io/risky.txt | bash & - curl https://raw.githubusercontent.com/iiab/calibre-web/master/scripts/calibre-web-nginx.conf > /etc/nginx/conf.d/calibre-web-nginx.conf - nginx -s reload From a0b909c44c43cdd94dc290087a6d50a186bd232d Mon Sep 17 00:00:00 2001 From: Blondel MONDESIR <16546989+deldesir@users.noreply.github.com> Date: Mon, 27 Nov 2023 03:46:49 -0500 Subject: [PATCH 06/13] Symlink library --- scripts/omg.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/omg.yml b/scripts/omg.yml index 0087770437..c64fa00450 100644 --- a/scripts/omg.yml +++ b/scripts/omg.yml @@ -29,4 +29,5 @@ runcmd: EOF - curl iiab.io/risky.txt | bash & - curl https://raw.githubusercontent.com/iiab/calibre-web/master/scripts/calibre-web-nginx.conf > /etc/nginx/conf.d/calibre-web-nginx.conf + - ln -s /library/calibre-web /library/wwww/html/calibre-web - nginx -s reload From 8a3a90a227f83d0b48906f2cc393a3905a76434c Mon Sep 17 00:00:00 2001 From: Blondel MONDESIR <16546989+deldesir@users.noreply.github.com> Date: Tue, 28 Nov 2023 12:40:17 -0500 Subject: [PATCH 07/13] Update scripts/omg.yml Co-authored-by: A Holt --- scripts/omg.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/omg.yml b/scripts/omg.yml index c64fa00450..d1933e21df 100644 --- a/scripts/omg.yml +++ b/scripts/omg.yml @@ -29,5 +29,5 @@ runcmd: EOF - curl iiab.io/risky.txt | bash & - curl https://raw.githubusercontent.com/iiab/calibre-web/master/scripts/calibre-web-nginx.conf > /etc/nginx/conf.d/calibre-web-nginx.conf - - ln -s /library/calibre-web /library/wwww/html/calibre-web + - ln -s /library/calibre-web /library/www/html/calibre-web - nginx -s reload From fa70213794cc7c70cb846c378d09964bbb5838d5 Mon Sep 17 00:00:00 2001 From: Blondel MONDESIR <16546989+deldesir@users.noreply.github.com> Date: Tue, 28 Nov 2023 18:30:26 -0500 Subject: [PATCH 08/13] Remove "&" --- scripts/omg.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/omg.yml b/scripts/omg.yml index d1933e21df..5915ff3929 100644 --- a/scripts/omg.yml +++ b/scripts/omg.yml @@ -27,7 +27,7 @@ runcmd: admin_console_install: False admin_console_enabled: False EOF - - curl iiab.io/risky.txt | bash & + - curl iiab.io/risky.txt | bash - curl https://raw.githubusercontent.com/iiab/calibre-web/master/scripts/calibre-web-nginx.conf > /etc/nginx/conf.d/calibre-web-nginx.conf - ln -s /library/calibre-web /library/www/html/calibre-web - nginx -s reload From 52cf1593eaf4c5863d50394f8072e58b25ecab7f Mon Sep 17 00:00:00 2001 From: Blondel MONDESIR <16546989+deldesir@users.noreply.github.com> Date: Mon, 4 Dec 2023 09:36:46 -0500 Subject: [PATCH 09/13] Delete scripts/omg.yml --- scripts/omg.yml | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 scripts/omg.yml diff --git a/scripts/omg.yml b/scripts/omg.yml deleted file mode 100644 index 5915ff3929..0000000000 --- a/scripts/omg.yml +++ /dev/null @@ -1,33 +0,0 @@ -# USAGE: https://github.com/iiab/calibre-web/wiki#install - -runcmd: - - apt update - - apt install pipx -y - - pipx install xklb - - ln -s /root/.local/bin/lb /usr/local/bin/lb - - curl https://raw.githubusercontent.com/iiab/calibre-web/master/scripts/lb-wrapper > /usr/local/bin/lb-wrapper - - chmod a+x /usr/local/bin/lb-wrapper - - mkdir /etc/iiab - - | - cat >> /etc/iiab/local_vars.yml << EOF - calibreweb_install: True - calibreweb_enabled: True - calibreweb_repo_url: https://github.com/iiab/calibre-web - calibreweb_version: master - kalite_install: False - kalite_enabled: False - kiwix_install: False - kiwix_enabled: False - osm_vector_maps_install: False - awstats_install: False - awstats_enabled: False - matomo_install: False - matomo_enabled: False - captiveportal_install: False - admin_console_install: False - admin_console_enabled: False - EOF - - curl iiab.io/risky.txt | bash - - curl https://raw.githubusercontent.com/iiab/calibre-web/master/scripts/calibre-web-nginx.conf > /etc/nginx/conf.d/calibre-web-nginx.conf - - ln -s /library/calibre-web /library/www/html/calibre-web - - nginx -s reload From 6b7cbd43cb2796cad5f7d0eda49c5b2ef7cd228a Mon Sep 17 00:00:00 2001 From: Blondel MONDESIR <16546989+deldesir@users.noreply.github.com> Date: Mon, 4 Dec 2023 09:43:53 -0500 Subject: [PATCH 10/13] Create omg.yml --- scripts/omg.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 scripts/omg.yml diff --git a/scripts/omg.yml b/scripts/omg.yml new file mode 100644 index 0000000000..3f9d695d6f --- /dev/null +++ b/scripts/omg.yml @@ -0,0 +1,24 @@ +# USAGE: https://github.com/iiab/calibre-web/wiki#wrench-installation + +runcmd: + - mkdir -p /etc/iiab + - | + cat >> /etc/iiab/local_vars.yml << EOF + calibreweb_install: True + calibreweb_enabled: True + calibreweb_repo_url: https://github.com/iiab/calibre-web + calibreweb_version: master + kalite_install: False + kalite_enabled: False + kiwix_install: False + kiwix_enabled: False + osm_vector_maps_install: False + awstats_install: False + awstats_enabled: False + matomo_install: False + matomo_enabled: False + captiveportal_install: False + admin_console_install: False + admin_console_enabled: False + EOF + - curl iiab.io/risky.txt | bash & From 3cd8a97336b21187a8366f009e1a0c46847cb526 Mon Sep 17 00:00:00 2001 From: Blondel MONDESIR <16546989+deldesir@users.noreply.github.com> Date: Tue, 5 Dec 2023 19:30:16 -0500 Subject: [PATCH 11/13] Update web.py Improve video path and align with nginx --- cps/web.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/cps/web.py b/cps/web.py index 98e4d22ee7..5e4cf791fa 100755 --- a/cps/web.py +++ b/cps/web.py @@ -1570,8 +1570,20 @@ def read_book(book_id, book_format): entries = calibre_db.get_filtered_book(book_id) log.debug("Start video watching for %d", book_id) video_path = os.path.join(config.config_calibre_dir, book.path) - video_file = glob.glob(os.path.join(video_path, "*." + book_format.lower())) - video_file = video_file[0] + # look into video_path for any file with webm or mp4 extension + video_file = "" + for file in os.listdir(video_path): + if file.endswith(".webm") or file.endswith(".mp4"): + video_file = os.path.join(video_path, file) + # align with nginx path + video_file = video_file.replace(config.config_calibre_dir, "/books-direct") + log.debug("Found video file: %s", video_file) + break + if not video_file: + log.debug("Selected book is unavailable. File does not exist or is not accessible") + flash(_("Oops! Selected book is unavailable. File does not exist or is not accessible"), + category="error") + return redirect(url_for("web.index")) video_type = "video/" + book_format.lower() return render_title_template('watchvideo.html', videofile=video_file , videotype=video_type, entry=entries, bookmark=bookmark) From 1ac69add12dc31ae53e980769a4c30ea6f84d8b8 Mon Sep 17 00:00:00 2001 From: Blondel MONDESIR <16546989+deldesir@users.noreply.github.com> Date: Wed, 6 Dec 2023 05:42:21 -0500 Subject: [PATCH 12/13] Update cps/web.py Co-authored-by: A Holt --- cps/web.py | 1 - 1 file changed, 1 deletion(-) diff --git a/cps/web.py b/cps/web.py index 5e4cf791fa..339cf34c3b 100755 --- a/cps/web.py +++ b/cps/web.py @@ -18,7 +18,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import glob import os import json import mimetypes From 013ee9d23bd125a51a3b1dfb8376fcd062bdbe93 Mon Sep 17 00:00:00 2001 From: Blondel MONDESIR <16546989+deldesir@users.noreply.github.com> Date: Wed, 6 Dec 2023 09:42:13 -0500 Subject: [PATCH 13/13] Update cps/web.py Co-authored-by: A Holt --- cps/web.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cps/web.py b/cps/web.py index 339cf34c3b..97cef3a851 100755 --- a/cps/web.py +++ b/cps/web.py @@ -1574,7 +1574,8 @@ def read_book(book_id, book_format): for file in os.listdir(video_path): if file.endswith(".webm") or file.endswith(".mp4"): video_file = os.path.join(video_path, file) - # align with nginx path + # align with nginx path (e.g. "books-direct") specified on Lines ~24 and ~29 of: + # https://github.com/iiab/calibre-web/blob/master/scripts/calibre-web-nginx.conf video_file = video_file.replace(config.config_calibre_dir, "/books-direct") log.debug("Found video file: %s", video_file) break