Giter VIP home page Giter VIP logo

calibre-web's Introduction

Sharing the World's Free Knowledge

Internet-in-a-Box (IIAB)

Internet-in-a-Box (IIAB) is a “learning hotspot” that brings the Internet's crown jewels (Wikipedia in any language, thousands of Khan Academy videos, zoomable OpenStreetMap, electronic books, WordPress journaling, “Toys from Trash” electronics projects, ETC) to those without Internet.

You can build your own tiny, affordable server (an offline digital library) for your school, your medical clinic, your prison, your region and/or your very own family — accessible with any nearby smartphone, tablet or laptop.

Internet-in-a-Box gives you the DIY tools to:

  1. Download then drag-and-drop to arrange the very best of the World’s Free Knowledge.
  2. Choose among 30+ powerful educational apps for your school or learning/teaching community, optionally with a complete LMS (learning management system).
  3. Exchange local/indigenous knowledge with nearby communities, using our Manage Content interface and possible mesh networking.

FYI this community product is enabled by professional volunteers working side-by-side with schools, clinics and libraries around the world. Thank you for being a part of our http://OFF.NETWORK grassroots technology movement!

Installation

Install Internet-in-a-Box (IIAB) from: download.iiab.io

Please see FAQ.IIAB.IO which has 40+ questions and answers to help you along the way (e.g. “Is a quick installation possible?”) as you put together the “local learning hotspot” most suitable for your own teaching/learning community. Here are 2 ways to install IIAB:

Our HOW-TO videos can be very helpful and the Installation wiki page has more intricate details e.g. if you're trying to install Internet-in-a-Box (IIAB) onto a another Linux that has not yet been tried.

See our Tech Docs Wiki for more about the underlying nuts and bolts.

After you've installed the software, you should add content, which can of course take time when downloading multi-gigabyte Content Packs!

Finally, you can customize your Internet-in-a-Box home page (typically http://box or http://box.lan) using our drag-and-drop Admin Console (http://box.lan/admin) — to arrange Content Packs and IIAB Apps (services) for your local community's needs.

Community

Global community updates and videos are regularly posted to: @internet_in_box

Internet-in-a-Box (IIAB) greatly welcomes contributions from educators, librarians and IT/UX/QA people of all kinds!

If you would like to volunteer, please make contact after looking over “How can I help?” at: FAQ.IIAB.IO

To learn more about our open community architecture for “offline” learning, check out “What technical documentation exists?” FYI we use Ansible to install, deploy, configure and manage the various software components.

Thank you for helping us enable offline access to the Internet's free/open knowledge jewels, as well as “Sneakernet-of-Alexandria” distribution of local/indigenous content, when mass media channels do not serve grassroots voices.

Versions

Pre-releases of Internet-in-a-Box (IIAB) undergo continuous QA / continuous integration / continuous deployment and are strongly recommended!

Install our latest pre-release using the 1-line installer at: download.iiab.io

You can also consider earlier official releases at: github.com/iiab/iiab/releases

For much older versions, see: github.com/xsce, schoolserver.org

calibre-web's People

Contributors

andy29485 avatar blitzmann avatar bodybybuddha avatar cbartondock avatar cervinko avatar deldesir avatar elquimm avatar ghighi3f avatar hexeth avatar holta avatar idalin avatar irfan-ansari-au28 avatar jkrehm avatar jvoisin avatar knepherbird avatar krakinou avatar kyosfonica avatar leram84 avatar mmonkey avatar nykul avatar ok11 avatar otapi avatar ozzieisaacs avatar pwr avatar quarz12 avatar radoslawkierznowski avatar shavitmichael avatar subdiox avatar xlivevil avatar xzvb12 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

calibre-web's Issues

Remove orphan (empty) directories, residual in /library/downloads/calibre-web

PR #82 fixed #45 but still leaves orphan (empty) directories like:

/library/downloads/calibre-web/Youtube/CNBC
/library/downloads/calibre-web/Youtube/ESPN_College_Football
...

All such directories (as above) should definitely be removed, the moment after they're no long needed.

(Even if that's NOT the most urgent fix needed at this time — with far more serious bugs/issues needing immediate attention below...)

https://github.com/iiab/calibre-web/issues

Originally posted by @holta in #82 (comment)

'Download' button needs to work regardless what page you're starting from (when logged in!)

This is a longstanding issue, whose severity/priority is now much higher.

(As a result of more people beginning to explore, hence more people getting confused by this!)

RECAP: The Download button fails to show a modal / pop-up or do anything at all, when starting from many different Calibre-Web pages. The user is currently forced to click on some of the pages under "BROWSE" on the left. And/or the user is forced to click into many different pages within Calibre-Web, until (seemingly randomly, from their perspective) finding a page where the Download button begins to work.

Should bare URLs like "youtu.be/Mt187r0Ec9A" work in future?

@deldesir FYI attempting https://www.youtube.com/shorts/Mt187r0Ec9A returned "Invalid YouTube URL"

So I tried bare URL "youtu.be/Mt187r0Ec9A" (which works in a browser).

FWIW it failed with tail -f /var/log/calibre-log showing the following:

[2023-10-12 20:54:34,980] ERROR {cps.editbooks:338} Subprocess error (return code 1): WARNING: [generic] The url doesn't specify the protocol, trying with http
Importing playlist-less media youtu.be/Mt187r0Ec9A
, --------YB LOG--------\n\n
2023-10-12 20:54:30 - Moving /var/tmp/download.db aside if it already exists.
--------YB LOG--------\n\n
2023-10-12 20:54:30 - Running command: lb tubeadd /var/tmp/download.db youtu.be/Mt187r0Ec9A && lb dl /var/tmp/download.db --video youtu.be/Mt187r0Ec9A

--------YB LOG--------\n\n
2023-10-12 20:54:34 - An error occurred while running the command. Please check /var/log/yb.log  for more details.

[2023-10-12 20:54:34,983]  INFO {cps.editbooks:364} Subprocess result: (False, "Subprocess error (return code 1): WARNING: [generic] The url doesn't specify the protocol, trying with http\nImporting playlist-less media youtu.be/Mt187r0Ec9A\n, --------YB LOG--------\\n\\n\n2023-10-12 20:54:30 - Moving /var/tmp/download.db aside if it already exists.\n--------YB LOG--------\\n\\n\n2023-10-12 20:54:30 - Running command: lb tubeadd /var/tmp/download.db youtu.be/Mt187r0Ec9A && lb dl /var/tmp/download.db --video youtu.be/Mt187r0Ec9A\n\n--------YB LOG--------\\n\\n\n2023-10-12 20:54:34 - An error occurred while running the command. Please check /var/log/yb.log  for more details.\n", '--------YB LOG--------\\n\\n\n2023-10-12 20:54:30 - Moving /var/tmp/download.db aside if it already exists.\n--------YB LOG--------\\n\\n\n2023-10-12 20:54:30 - Running command: lb tubeadd /var/tmp/download.db youtu.be/Mt187r0Ec9A && lb dl /var/tmp/download.db --video youtu.be/Mt187r0Ec9A\n\n--------YB LOG--------\\n\\n\n2023-10-12 20:54:34 - An error occurred while running the command. Please check /var/log/yb.log  for more details.\n', "WARNING: [generic] The url doesn't specify the protocol, trying with http\nImporting playlist-less media youtu.be/Mt187r0Ec9A\n")
[2023-10-12 20:54:37,994] ERROR {cps.editbooks:338} Subprocess error (return code 1): WARNING: [generic] The url doesn't specify the protocol, trying with http
Importing playlist-less media youtu.be/Mt187r0Ec9A
, --------YB LOG--------\n\n
2023-10-12 20:54:34 - Moving /var/tmp/download.db aside if it already exists.
--------YB LOG--------\n\n
2023-10-12 20:54:34 - Running command: lb tubeadd /var/tmp/download.db youtu.be/Mt187r0Ec9A && lb dl /var/tmp/download.db --video youtu.be/Mt187r0Ec9A

--------YB LOG--------\n\n
2023-10-12 20:54:37 - An error occurred while running the command. Please check /var/log/yb.log  for more details.

[2023-10-12 20:54:37,994]  INFO {cps.editbooks:364} Subprocess result: (False, "Subprocess error (return code 1): WARNING: [generic] The url doesn't specify the protocol, trying with http\nImporting playlist-less media youtu.be/Mt187r0Ec9A\n, --------YB LOG--------\\n\\n\n2023-10-12 20:54:34 - Moving /var/tmp/download.db aside if it already exists.\n--------YB LOG--------\\n\\n\n2023-10-12 20:54:34 - Running command: lb tubeadd /var/tmp/download.db youtu.be/Mt187r0Ec9A && lb dl /var/tmp/download.db --video youtu.be/Mt187r0Ec9A\n\n--------YB LOG--------\\n\\n\n2023-10-12 20:54:37 - An error occurred while running the command. Please check /var/log/yb.log  for more details.\n", '--------YB LOG--------\\n\\n\n2023-10-12 20:54:34 - Moving /var/tmp/download.db aside if it already exists.\n--------YB LOG--------\\n\\n\n2023-10-12 20:54:34 - Running command: lb tubeadd /var/tmp/download.db youtu.be/Mt187r0Ec9A && lb dl /var/tmp/download.db --video youtu.be/Mt187r0Ec9A\n\n--------YB LOG--------\\n\\n\n2023-10-12 20:54:37 - An error occurred while running the command. Please check /var/log/yb.log  for more details.\n', "WARNING: [generic] The url doesn't specify the protocol, trying with http\nImporting playlist-less media youtu.be/Mt187r0Ec9A\n")
# cat /var/log/yb.log
No media found
No media found
# lb --version
2.2.112

"Download to IIAB" worked 5 out of 15 tries (trying to d/l individual YouTube videos) — "Tasks" view screenshots show the 10 failures [e.g. formerly live videos]

Screenshots from @nzola show 5 successes + 10 failures = 15 total attempts.

This is on his Raspberry Pi 4 where he installed IIAB's version of Calibre-Web a week ago:

image

image

HIS OBSERVATIONS:

  • He noticed that gigantic/long videos sometimes work and small/short videos sometimes fail.

  • He noticed that failed attempts seem to (always or almost always) display "100%" in the Tasks view almost immediately.

QUESTION FOR @deldesir:

  • Can you use the above list of 10 failed YouTube video downloads to try to reproduce & diagnose these failures?

Possibly related:

Display video/bookshelf original URL (or canonical URL if possible!) to all users [ASIDE: upload of offline video works, despite red error "Failed to Move Cover File" in web UI]

Is your feature request related to a problem? Please describe.
After I downloaded a video, I could not easily find the source URL from the Books or Edit Metadata page.

Describe the solution you'd like
When viewing or editing a downloaded media, in addition to publisher, it would be helpful to see the source URL. This can be for testing purposes (my use case), but I can also see educators wanting to view source URL to verify veracity or accuracy of content.
e.g., https://www.youtube.com/watch?v=OnTYLyNUPMc

Describe alternatives you've considered
I can see the source URL on the Tasks page, but this requires me inferring which video URL refers to which downloaded video available on the Books page. Also I expect that some educators using an IIAB install may not be Admins and hence not able to access the Tasks page.

Additional context
These are the 2 pages where seeing the source URL will be helpful. You could make it so that the field is not editable on the edit page if you want to restrict changing the URL after downlaoding.

Screenshot 2024-01-20 at 6 24 18 PM Screenshot 2024-01-20 at 6 24 27 PM

Broken/Extra (wrapped) lines arise from ASCII control characters in xklb.log

Just 300 lines were requested by iiab-diagnostics but...

332 lines in total appear in the end...
https://sprunge.us/5sVvxN?en#n-2407

The 32 broken lines (extra lines!) arising from /var/log/xklb.log appear likely reproducible (and likely fixable!) using...

https://www.youtube.com/@iogacademy/playlists

If we believe Line 2396 here...
https://sprunge.us/5sVvxN?en#n-2396

Cleaning up all our log file messes is a priority. So that we're not building on a foundation of (quick)sand!

Tangentially related tickets:

Use existing job queuing system for downloads

Describe the bug/problem

Calibre-Web currently has apscheduler for managing various tasks, including format conversions, uploads, and metadata-related activities. While the present job queuing system functions adequately, there's a need to further optimize and adapt this mechanism specifically for download tasks.

The existing job queuing mechanism, for its general functionality and reliability, can be retained and optimized to better accommodate and efficiently manage download-related tasks within the Calibre-Web environment per feature #7.

The following changes are proposed:

  1. Fine-tuning for Downloads: Optimize the current job queue to better handle and prioritize download-related tasks.
  2. Load Distribution: Explore methods to evenly distribute and manage the load when handling concurrent or multiple downloads.
  3. Error Handling and Monitoring: Enhance error handling and monitoring within the job queuing system to ensure the smooth execution of download tasks.

To Reproduce

There is no specific bug to reproduce; this issue pertains to code consistency and best practices within the Calibre-Web project.

Expected behavior

By optimizing the current job queuing mechanism specifically for download tasks, the goal is to ensure smoother and more efficient download operations while maintaining the reliability and stability of the existing system.

Environment (please complete the following information):

  • OS: Ubuntu 23.10
  • Python version: 3.11.6
  • Calibre-Web version: 0.6.21 - Romesa (customized per #7 )
  • Docker container: No
  • Special Hardware: No
  • Browser: Firefox Nightly 121.0a1 (2023-10-31) (64-bit)

Additional Context

The intention is to build upon the strengths of the current job queuing system, ensuring it's well-suited for download-related tasks without requiring a complete overhaul. This approach aims to maintain compatibility and stability while improving the efficiency of download task management within Calibre-Web.

Some videos download as overweight (giant) files that (1) are not appropriate for schools, and (2) crash Calibre-Web with "502 Bad Gateway"

EXAMPLE: The button "Download to IIAB" was used to download 23m44s video https://youtu.be/sqoOzGMqCQU which eventually downloaded into Calibre-Web (about 6min later... depending on the IIAB's Internet bandwidth of course!)

HOWEVER: Clicking either of the 2 blue buttons below [ "WEBM (4.7GB)" or "Watch in Browser - webm" ] at https://box/live/book/222 appears to cause a serious crash of... all of Calibre-Web? (or some core piece of its infra?)

image

QUESTION: @deldesir what is your technique for bringing NGINX and/or Calibre-Web back to life in these "502 Bad Gateway" situations? (It appears you have a technique to restart some service[s] that does not require a full system reboot?!)

CONTEXT: Just FYI this problem occurred with the latest code (from https://github.com/iiab/calibre-web) installed on a high-powered Ubuntu Server 22.04 VM with 8GB RAM, plenty of disk, and the following kernel...

# uname -a
Linux lrn2 5.15.0-88-generic #98-Ubuntu SMP Mon Oct 2 15:18:56 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

MP4 files failed to upload [WebM too, for large video files?]

"Upload" of MP4 files won't work on fresh install (http://sprunge.us/2OkfiI?en) that includes PR #59?

Internet in a Box
        
500 Internal Server Error
        
The server encountered an internal error and was unable to complete your request. There is an error in the application.      
        
Traceback (most recent call last):

  File "/usr/local/calibre-web-py3/lib/python3.11/site-packages/flask/app.py", line 2190, in wsgi_app

    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/calibre-web-py3/lib/python3.11/site-packages/flask/app.py", line 1486, in full_dispatch_request

    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/calibre-web-py3/lib/python3.11/site-packages/flask/app.py", line 1484, in full_dispatch_request
        
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
        
  File "/usr/local/calibre-web-py3/lib/python3.11/site-packages/flask/app.py", line 1469, in dispatch_request

    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/calibre-web-py3/cps/usermanagement.py", line 34, in decorated_view
        
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/calibre-web-py3/cps/editbooks.py", line 72, in inner

    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^

  File "/usr/local/calibre-web-py3/cps/editbooks.py", line 263, in upload

    meta, error = file_handling_on_upload(requested_file)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/calibre-web-py3/cps/editbooks.py", line 913, in file_handling_on_upload

    meta = uploader.upload(requested_file, config.config_rarfile_location)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/calibre-web-py3/cps/uploader.py", line 372, in upload
        
    return process(tmp_file_path, filename_root, file_extension, rar_excecutable)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/calibre-web-py3/cps/uploader.py", line 100, in process

    if not meta.title.strip():
           ^^^^^^^^^^

AttributeError: 'NoneType' object has no attribute 'title'
 
Please report this issue with all related information:
        Create Issue
    
        Return to Home

Clicking "Watch in Browser - MP4" works w/ 8GB RAM but crashes calibre-web.service w/ 2GB RAM / memory (MP4 is 1.0GB; users see "502 Bad Gateway" due to OOM crash)

1h41m video (https://youtu.be/vbXu7WaifAo) is downloadable to IIAB even on VM's with 1.5GB RAM or less, and thumbnail/cover/poster seems to appear properly every time. However:

  • Clicking "Watch in Browser - MP4" (top-right of "Book Details" pop-up) consistently causes calibre-web.service to crash, on regular VM's with 2GB or less.
  • Whereas VM's with a gigantic amounts of RAM (e.g. 8GB) do allow clicking "Watch in Browser - MP4" to play the video.

Service crashing needs to be solved not just mitigated.

Hiding the problem is not a healthy option in my opinion — e.g. at this time I'm personally not in favor of partial solutions like these 2 proposed workarounds:

Basic diagnostics below, towards getting us on the road to a proper fix:

root@box:~# cat /etc/issue
Ubuntu Noble Numbat (development branch) \n \l
root@box:/usr/local/calibre-web-py3# git log --oneline | head
e83c81e5 Merge branch 'janeczku:master' into master
4c64662b README.md: "Internet-in-a-Box does not support Docker"
2f7413cb Merge pull request #75 from deldesir/deldesir-tornado
93791b3a Increase Buffersize to 10GB
25fb8d93 Merge remote-tracking branch 'nl/master'
b456263d Merge pull request #72 from deldesir/deldesir-mp4-cover
525cd2fe Support case insensitive ext
bc0ebdb7 Updated Dutch translation.
cdfd9b31 Merge pull request #71 from deldesir/deldesir-description
04306ba2 Pull description
root@box:~# free -h
               total        used        free      shared  buff/cache   available
Mem:           1.9Gi       372Mi       1.5Gi        21Mi       162Mi       1.5Gi
Swap:             0B          0B          0B
root@box:~# df -h .
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       8.7G  5.8G  3.0G  67% /
root@box:~# cat /var/log/calibre-web.log
[2023-12-24 17:32:39,037]  INFO {cps:168} *** "greenlet" version does not meet the requirements. Should: <2.1.0, Found: 3.0.3, please consider installing required version ***
[2023-12-24 17:32:39,037]  INFO {cps:177} Starting Calibre Web...
[2023-12-24 17:32:39,044] DEBUG {cps.services:26} Cannot import goodreads, showing authors-metadata will not work: No module named 'betterreads'
[2023-12-24 17:32:39,045] DEBUG {cps.services:34} Cannot import simpleldap, logging in with ldap will not work: No module named 'flask_simpleldap'
[2023-12-24 17:32:39,079] DEBUG {cps.services:49} Cannot import gmail, sending books via Gmail Oauth2 Verification will not work: No module named 'google_auth_oauthlib'
[2023-12-24 17:32:39,096]  WARN {py.warnings:109} /usr/local/calibre-web-py3/lib/python3.11/site-packages/flask_limiter/extension.py:336: UserWarning: Using the in-memory storage for tracking rate limits as no storage was explicitly specified. This is not recommended for production use. See: https://flask-limiter.readthedocs.io#configuring-a-storage-backend for documentation about configuring the storage backend.
  warnings.warn(

[2023-12-24 17:32:39,240] DEBUG {cps.gdriveutils:81} Cannot import pydrive, httplib2, using gdrive will not work: No module named 'pydrive'
[2023-12-24 17:32:39,512]  INFO {apscheduler.scheduler:181} Scheduler started
[2023-12-24 17:32:39,512]  INFO {apscheduler.scheduler:895} Added job "end scheduled task" to job store "default"
[2023-12-24 17:32:39,642] DEBUG {cps.comic:46} Cannot import comicapi, extracting comic metadata will not work: No module named 'comicapi'
[2023-12-24 17:32:39,643] DEBUG {cps.comic:53} Cannot import rarfile, extracting cover files from rar files will not work: No module named 'rarfile'
[2023-12-24 17:32:39,643] DEBUG {cps.comic:59} Cannot import py7zr, extracting cover files from CB7 files will not work: No module named 'py7zr'
[2023-12-24 17:32:39,721] DEBUG {cps.admin:81} Cannot import Flask-Dance, login with Oauth will not work: No module named 'flask_dance'
[2023-12-24 17:32:39,726] DEBUG {cps.gdrive:44} Cannot import googleapiclient, using GDrive will not work: No module named 'googleapiclient'
[2023-12-24 17:32:39,768] DEBUG {cps.search_metadata:62} Import error for metadata source: scholar - No module named 'scholarly'
[2023-12-24 17:32:39,799] DEBUG {cps.search_metadata:62} Import error for metadata source: lubimyczytac - No module named 'html2text'
[2023-12-24 17:32:39,809] DEBUG {cps.search_metadata:62} Import error for metadata source: amazon - No module named 'bs4'
[2023-12-24 17:32:39,810] DEBUG {cps.search_metadata:62} Import error for metadata source: douban - No module named 'html2text'
[2023-12-24 17:32:39,911]  INFO {cps.server:267} Starting Tornado server on :8083
[2023-12-24 17:34:58,223] DEBUG {cps.web:1410} You are now logged in as: 'Admin'
[2023-12-24 17:34:58,243] DEBUG {cps.ub:82} Login and store session : 8b1f3e026c99c26da2710a803e79fd8c3731814f5a5be1b048a9411edb469756fa361953799483455066116aa7c0ded030ea40dafe80a1633b5985cd2bc19327
[2023-12-24 17:34:58,244] DEBUG {cps.ub:84} Found stored session: 8b1f3e026c99c26da2710a803e79fd8c3731814f5a5be1b048a9411edb469756fa361953799483455066116aa7c0ded030ea40dafe80a1633b5985cd2bc19327
[2023-12-24 17:35:05,991] DEBUG {cps.services.worker:91} Add Task for user: Admin - Download https://www.youtube.com/watch?v=vbXu7WaifAo
[2023-12-24 17:35:05,992]  INFO {cps.tasks.download:28} Starting download task for URL: https://www.youtube.com/watch?v=vbXu7WaifAo
[2023-12-24 17:35:05,992]  INFO {cps.tasks.download:37} Subprocess args: ['lb-wrapper', 'https://www.youtube.com/watch?v=vbXu7WaifAo']
[2023-12-24 17:35:05,996]  INFO {cps.tasks.download:50} /usr/local/bin/lb

[2023-12-24 17:36:12,661]  INFO {cps.editbooks:382} Requested files list: ['/library/downloads/calibre-web/Youtube/MMTV_NEWLOOK/URGENT_PANIQUE_CHEZ_FATSHI_COU.P_D_ETAT_EN_COURS_SOULEVEMENT_POPULAIRES_DANS_LA_DIASPORA_15.90k_[vbXu7WaifAo].mp4']
[2023-12-24 17:36:12,662]  INFO {cps.editbooks:388} Processing file: <_io.BufferedReader name='/library/downloads/calibre-web/Youtube/MMTV_NEWLOOK/URGENT_PANIQUE_CHEZ_FATSHI_COU.P_D_ETAT_EN_COURS_SOULEVEMENT_POPULAIRES_DANS_LA_DIASPORA_15.90k_[vbXu7WaifAo].mp4'>
[2023-12-24 17:36:12,663] DEBUG {cps.uploader:371} Temporary file: /tmp/calibre_web/a47764e9ecae51b20547d3f41ae2b1d0
[2023-12-24 17:36:15,488] DEBUG {cps.helper:543} Moving title: /tmp/calibre_web/a47764e9ecae51b20547d3f41ae2b1d0 to /library/calibre-web/MMTV NEWLOOK/URGENT PANIQUE CHEZ FATSHI,COU.P D'ÉTAT EN COURS, SOULÈVEMENT POPULAIRES DANS LA DIASPORA (1)/URGENT PANIQUE CHEZ FATSHI,COU.P D'ÉTAT EN COURS, SOULÈVEMENT POPULAIRES DANS LA DIASPORA - MMTV NEWLOOK
[2023-12-24 17:36:15,509] DEBUG {cps.services.worker:91} Add Task for user: Admin - Upload URGENT PANIQUE CHEZ FATSHI,COU.P D&#39;ÉTAT EN COURS, SOULÈVEMENT POPULAIRES DANS LA DIASPORA
[2023-12-24 17:36:15,517]  INFO {cps.tasks.download:79} Successfully sent the list of requested files to http://192.168.0.173/books/meta
[2023-12-24 17:36:24,632] DEBUG {cps.web:1577} Start video watching for 1
[2023-12-24 17:36:24,634]  INFO {cps.web:1214} Serving book: URGENT PANIQUE CHEZ FATSHI,COU.P D'ÉTAT E - MMTV NEWLOOK
root@box:~# systemctl status calibre-web.service
× calibre-web.service - Calibre-Web
     Loaded: loaded (/etc/systemd/system/calibre-web.service; enabled; preset: enabled)
     Active: failed (Result: oom-kill) since Sun 2023-12-24 17:36:33 EST; 25min ago
   Duration: 3min 54.843s
    Process: 3550 ExecStart=/usr/local/calibre-web-py3/bin/python3 /usr/local/calibre-web-py3/cps.py -p /library/calibre-web/config/app.db (code=killed, signal=KILL)
   Main PID: 3550 (code=killed, signal=KILL)
        CPU: 30.887s

Dec 24 17:32:38 box systemd[1]: Started calibre-web.service - Calibre-Web.
Dec 24 17:36:32 box systemd[1]: calibre-web.service: A process of this unit has been killed by the OOM killer.
Dec 24 17:36:33 box systemd[1]: calibre-web.service: Main process exited, code=killed, status=9/KILL
Dec 24 17:36:33 box systemd[1]: calibre-web.service: Failed with result 'oom-kill'.
Dec 24 17:36:33 box systemd[1]: calibre-web.service: Consumed 30.887s CPU time.
root@box:~# journalctl -u calibre-web
Dec 24 17:32:38 box systemd[1]: Started calibre-web.service - Calibre-Web.
Dec 24 17:36:32 box systemd[1]: calibre-web.service: A process of this unit has been killed by the OOM killer.
Dec 24 17:36:33 box systemd[1]: calibre-web.service: Main process exited, code=killed, status=9/KILL
Dec 24 17:36:33 box systemd[1]: calibre-web.service: Failed with result 'oom-kill'.
Dec 24 17:36:33 box systemd[1]: calibre-web.service: Consumed 30.887s CPU time.
root@box:~# hostname -I
10.181.233.208 192.168.0.173 10.8.0.46 fd42:fb6b:9c93:d2f1:5054:ff:fefe:fe43
root@box:~# hostname -A
t6.lxd box box t6.lxd
root@box:/library/downloads/calibre-web# tree
.
├── Youtube
│   └── MMTV_NEWLOOK
│       └── URGENT_PANIQUE_CHEZ_FATSHI_COU.P_D_ETAT_EN_COURS_SOULEVEMENT_POPULAIRES_DANS_LA_DIASPORA_15.90k_[vbXu7WaifAo].mp4
└── survey.db

3 directories, 2 files
root@box:/library/calibre-web# tree
.
├── MMTV NEWLOOK
│   └── URGENT PANIQUE CHEZ FATSHI,COU.P D'ÉTAT EN COURS, SOULÈVEMENT POPULAIRES DANS LA DIASPORA (1)
│       ├── URGENT PANIQUE CHEZ FATSHI,COU.P D'ÉTAT E - MMTV NEWLOOK.mp4
│       └── cover.jpg
├── config
│   └── app.db
├── metadata.db
└── metadata_db_prefs_backup.json

4 directories, 5 files
root@box:~# cat /var/log/xklb.log
2023-12-24 17:35:06 - Running command: lb tubeadd /library/downloads/calibre-web/survey.db https://www.youtube.com/watch?v=vbXu7WaifAo --verbose && lb dl /library/downloads/calibre-web/survey.db --prefix /library/downloads/calibre-web --write-thumbnail --format best --format-sort 'tbr~1000' --video https://www.youtube.com/watch?v=vbXu7WaifAo --verbose
2023-12-24 17:36:12 - Download completed successfully.
root@box:~# lb --version
2.2.192
root@box:~# yt-dlp --version
2023.11.16

Related:

/var/log/calibre-web.log shows "WARN {py.warnings:109} /usr/local/calibre-web-py3/lib/python3.11/site-packages/flask_limiter/extension.py:336: UserWarning: Using the in-memory storage for tracking rate limits as no storage was explicitly specified. This is not recommended for production use. See: https://flask-limiter.readthedocs.io#configuring-a-storage-backend for documentation about configuring the storage backend. warnings.warn("

@deldesir any idea how serious this warning is? /var/log/calibre-web.log shows the following warning — followed by a mysterious blank line:

WARN {py.warnings:109} /usr/local/calibre-web-py3/lib/python3.11/site-packages/flask_limiter/extension.py:336: UserWarning: Using the in-memory storage for tracking rate limits as no storage was explicitly specified. This is not recommended for production use. See: https://flask-limiter.readthedocs.io#configuring-a-storage-backend for documentation about configuring the storage backend. warnings.warn(

Example/details to reproduce this:

Enhance download task messages for improved information when downloading a video

Is your feature request related to a problem? Please describe.
The current download task messages lack sufficient detail, leading to a less informative monitoring.

Describe the solution you'd like
I would like to enhance the download task messages by updating them dynamically. This improvement aims to provide context-specific status information during the download process.

Describe alternatives you've considered
Alternative solutions include sticking with the existing messaging approach or implementing a less comprehensive update. However, these alternatives may not address the need for improved user understanding and monitoring capabilities as effectively.

Additional context
The proposed changes align with the work already done in PR #88 . This feature request is driven by the intention to provide insights during the download process. We will track it in PR 90.

TaskDownload failed

Describe the bug/problem
The WorkerThread class has methods for adding tasks, maintaining a queue, and running tasks. TaskDownload from download.py uses it but its run(), responsible for executing the tasks from the queue failed. This method is a thread that keeps running as long as the main thread is alive.

AttributeError on Response object

Weird issue even when the request succeeds:

Traceback (most recent call last): File "/usr/local/calibre-web-py3/lib/python3.10/site-packages/flask/app.py", line 2190, in wsgi_app response = self.full_dispatch_request() File "/usr/local/calibre-web-py3/lib/python3.10/site-packages/flask/app.py", line 1487, in full_dispatch_request return self.finalize_request(rv) File "/usr/local/calibre-web-py3/lib/python3.10/site-packages/flask/app.py", line 1506, in finalize_request response = self.make_response(rv) File "/usr/local/calibre-web-py3/lib/python3.10/site-packages/flask/app.py", line 1851, in make_response rv.status_code = status File "/usr/local/calibre-web-py3/lib/python3.10/site-packages/werkzeug/sansio/response.py", line 182, in status_code self.status = code # type: ignore File "/usr/local/calibre-web-py3/lib/python3.10/site-packages/werkzeug/sansio/response.py", line 191, in status self._status, self._status_code = self._clean_status(value) File "/usr/local/calibre-web-py3/lib/python3.10/site-packages/werkzeug/sansio/response.py", line 197, in _clean_status value = value.strip() AttributeError: 'Response' object has no attribute 'strip'

Context Upfront: videos & shelves w/ vital metadata AND details on playing page?

The following metadata are already available in the modal dialog for every video we click on (prior to watching). Would it be practical to also have them below the video while watching? Currently only the title is displayed (can be removed on demand)

_Author Name

Publisher

Description/Caption_


What is missing but can be useful if added:

Online URL, to provide a direct link to the online source or webpage associated with the video content. This would enable users to access additional information, related content, or the original source.

Thumbnail of ["Downloaded to IIAB"] video is cut off & many files fail to be copied to /library/calibre-web [intermittent failures?]

Describe the bug/problem
I downloaded a YouTube video through the IIAB [Calibre-Web] interface. The video [downloaded to IIAB] and plays successfully locally but the [thumbnail] is cutoff. See attached image.

To Reproduce
Steps to reproduce the behavior:

  1. Go to http://box/books/?data=root&sort_param=stored
  2. Click on 'Download to IIAB'
  3. Download video: https://www.youtube.com/watch?v=ehSIhj2-qPM
  4. Go to: http://box/books/?data=root&sort_param=stored and in the Discover (Random Books) section, you will see the video linked with the thumbnail cut off. Screenshot attached.

Logfile
http://sprunge.us/XhS2Y3

Expected behavior
For step 4 above, I expect the full thumbnail to show.

Screenshots
Screenshot 2023-12-23 at 2 48 07 PM

Environment (please complete the following information):

  • OS: Mac OSX
  • Python version: Python 3.10.12
  • Calibre-Web version: 0.6.22 Beta
  • Docker container: [None/LinuxServer]: None, using Multipass 1.12.2
  • Special Hardware: Macbook Pro, Apple M1 Chip, 8GB RAM
  • Browser: Safari 17.0

Upgrade Calibre-Web to latest IIAB version [works! But Vimeo download glitch] [intermittent failure?]

Describe the bug/problem
Upgraded iiab small size OK.MP4 videos downloaded ok from Youtube and Vimeo.
one of vimeo videos downloaded 100% in task but not showing in books page.
https://vimeo.com/238136107
Upload of red ears https://vp.nyt.com/video/2023/10/23/112532_1_opdoc-redears_wg_1080p.mp4 causes bad gateway crash and access to Calibre not achievable after. I managed to reboot server in admin console and all came back Ok but without history of downloaded tasks .All videos still showed Ok.

To Reproduce
Upgrade IIAB and test again.

Logfile
root@box:/# pastebinit -b sprunge.us /var/log/calibre-web.log
http://sprunge.us/y5kuXE?en
root@box:/# pastebinit -b sprunge.us /var/log/xklb.log
http://sprunge.us/yvtnHw?en
IIAB diagnostics after upgrade-http://sprunge.us/5uNQ3M?en
IIAB diagnostics after video downloads -http://sprunge.us/3SKXUE?en
IIAB diagnostics after video upload red ears https://vp.nyt.com/video/2023/10/23/112532_1_opdoc-redears_wg_1080p.mp4 - http://sprunge.us/D8wjT3?en

Expected behavior
Upgrade works as expected minus known outstanding issues with Calibre-Web

Screenshots
Screenshot from 2023-12-22 18-05-35
Screenshot from 2023-12-22 17-23-23

Environment (please complete the following information):

Screenshot from 2023-12-22 18-17-23

Additional context
Add any other context about the problem here. [e.g. access via reverse proxy, database background sync, special database location]

Pressing 'Enter' fails to advance the 'Download' modal, regardless whether it contains a valid URL or not

Custom UX work is definitely not the goal!

But yesterday's long discussion in these 2 places does not correspond to reality:

The reality is that pressing Enter does not currently advance the Download modal, as if the Start button was pressed.

(So articulated intention needs to be aligned with code — in the simplest possible way, in one way or another — avoiding custom UX code as much as humanly possible anyway!)

Redirect to tasks route not working [or better yet educate users, so they click on "Tasks"]

Describe the bug/problem

We wanted to test the idea of helping the user to know what's happening when a download is initiated. Currently this is being worked as a feature since any commit is not done yet enabling this. A quick addition of "return redirect(url_for('tasks.get_tasks_status') in editbooks.py relevant functions does not work yet. Investigating....

To Reproduce

There is no specific bug to reproduce; this issue happens while developing towards this change.

Expected behavior

A redirect to "tasks" page is expected to monitor download/upload progress.

Environment (please complete the following information):

  • OS: Ubuntu 23.10
  • Python version: 3.11.6
  • Calibre-Web version: 0.6.21 - Romesa (customized per #7 )
  • Docker container: No
  • Special Hardware: No
  • Browser: Firefox Nightly 121.0a1 (2023-11-3) (64-bit)

Additional Context

The intention is to redirect to the "tasks" page upon initiating a download.

Downloaded large playlist does not show its content on Calibre-web Books homepage.

Describe the bug/problem
Test playlist download via Calibre-Web ,downloads results in 100% success in admin tasks but no videos are available in Books home page. Op-Docs | The New York Times https://youtube.com/playlist?list=PL4CGYNsoW2iCb4uQUNgWK6TJJgNVp-MpP. This playlist contains 242 videos.
To Reproduce
Steps to reproduce the behavior:
Another attempt will be done with a larger size Multipass instance 40-50GB.

Logfile
iiab-diagnostics
http://sprunge.us/X60dTt?en

root@box:/# pastebinit -b sprunge.us /var/log/calibre-web.log
http://sprunge.us/566JAH?en

root@box:/# pastebinit -b sprunge.us /var/log/xklb.log
http://sprunge.us/l2rDCb?en

Expected behavior
Videos expected to show automatically on Calibre home page (Books)

Screenshots
Screenshot from 2023-12-21 17-45-29
Screenshot from 2023-12-21 17-48-15
Screenshot from 2023-12-21 17-47-07

Environment (please complete the following information):
-Multipass instance 20GB used.

Additional context
Screenshot from 2023-12-21 18-08-16

"Task progress should within [0, 1] range" appeared in Tasks, on downloading 36-video playlist

An attempt to download a 36 video playlist https://www.youtube.com/playlist?list=PLU6sEQK7ize-4xjVnhQhgDQVcRaHO_y8p went successfully although initially gives failed:Task progress should be within [0,1 ] range.All videos downloaded successfully though.I have ran diagnostics again ,this is the very last part of my tests.
IIAB-DIAGNOSTICS http://sprunge.us/Colc0b?en
Screenshot from 2024-02-09 22-56-44

Originally posted by @EMG70 in #125 (comment)

Metadata failed to be added

Describe the bug/problem

Metadata extraction failed and no cover(s) is added for newly downloaded learning mediafile(s).

To Reproduce

Submit a download task

Expected behavior

Metadata should be added and covers moved/generated

Environment (please complete the following information):

  • OS: Ubuntu 23.10
  • Python version: 3.11.6
  • Calibre-Web version: 0.6.21 - Romesa (customized per #7 )
  • Docker container: No
  • Special Hardware: No
  • Browser: Firefox Nightly 121.0a1 (2023-11-03) (64-bit)

Additional context
Hint: "list index out of range" in the logs

Download tasks don't seem to run simultaneously, causing delays

Issue/Problem

The current task processing mechanism in Calibre-Web relies on apscheduler for managing various tasks, including format conversions, uploads, and metadata-related activities. It has been recently optimized to support downloads (see #9). While apscheduler is functional, there have been observations that tasks might not be processed concurrently in an asynchronous manner, causing potential delays in download task execution.

Proposed Solution

To enhance the processing of tasks within Calibre-Web, I propose either leveraging apsheduler.AsyncScheduler (https://apscheduler.readthedocs.io/en/master/api.html#apscheduler.AsyncScheduler) or integrating Redis Queue (RQ) as an alternative job queuing system (https://python-rq.org/).

Dialog modal do not dismiss when "Enter" key is pressed

Describe the bug/problem

When submitting a download task, the dialog modal does not disappear on Enter key press even though this does not prevent the process from being run.

To Reproduce

Press Enter key submitting a URL in the "Download" form.

Expected behavior

The dialog modal should just dismiss.

Environment (please complete the following information):

  • OS: Ubuntu 23.10
  • Python version: 3.11.6
  • Calibre-Web version: 0.6.21 - Romesa (customized per #7 )
  • Docker container: No
  • Special Hardware: No
  • Browser: Firefox Nightly 121.0a1 (2023-11-3) (64-bit)

Additional Context

This is about the Dialog modal displayed when clicking on the "Download" button.

Serve videos [using Video.js ?]

Is using a background task scheduler to asynchronously buffer video segments and serving them on-demand is a good solution in terms of mitigating the memory overloads as seen in #37

Why does calibre-web.log show blank lines?

Is this an upstream issue in Calibre-Web?

Regardless: Can we fix it and how?

MOTIVATION: IIAB's version of Calibre-Web needs extremely Clean + Meaningful logging — as literally every aspect of growing communities depends on this foundation.

Example:

/var/log/calibre-web.log blank lines on 962 and 1001

Related:

"Download to IIAB" of Vimeo video ("Staff Pick" URL or regular URL) does not download [and 1 YouTube video too, then 2 YouTube videos worked]

  1. No video was downloaded to /library/calibre-web after I clicked on "Download to IIAB" with https://vimeo.com/channels/staffpicks/893773360 :

image

  1. Subsequently trying again with equivalent/short URL https://vimeo.com/893773360 led to the exact same result.

Do the diagnostics below help?

root@lrn2:/library/downloads/calibre-web# tree
.
├── survey.db
├── survey.db.2023-11-28_12:45:50_CST
├── survey.db.2023-12-24_10:49:40_CST
└── Vimeo
    └── Mattias_Evangelista
        └── Actual_Air_5.53k_[893773360].jpg

2 directories, 4 files
root@lrn2:/library/downloads/calibre-web# ls -l Vimeo/Mattias_Evangelista/Actual_Air_5.53k_\[893773360\].jpg
-rw-r--r-- 1 root root 110760 Dec 24 10:49 'Vimeo/Mattias_Evangelista/Actual_Air_5.53k_[893773360].jpg'
root@lrn2:/library/downloads/calibre-web# mediainfo Vimeo/Mattias_Evangelista/Actual_Air_5.53k_\[893773360\].jpg
General
Complete name                            : Vimeo/Mattias_Evangelista/Actual_Air_5.53k_[893773360].jpg
Format                                   : JPEG
File size                                : 108 KiB

Image
Format                                   : JPEG
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Compression mode                         : Lossy
Stream size                              : 108 KiB (100%)
root@lrn2:~# tail -25 /var/log/calibre-log
[2023-12-24 10:46:51,585] DEBUG {cps.web:1410} You are now logged in as: 'Admin'
[2023-12-24 10:46:51,631] DEBUG {cps.ub:82} Login and store session : 7b51c8cd1a0300222e238fbe082b17560b5df60de619e059735108f54051dc2c033fb410262fb79e726b514223d132e68554a42ff0bd1c630ecc051fe2771fde
[2023-12-24 10:46:51,639] DEBUG {cps.ub:84} Found stored session: 7b51c8cd1a0300222e238fbe082b17560b5df60de619e059735108f54051dc2c033fb410262fb79e726b514223d132e68554a42ff0bd1c630ecc051fe2771fde
[2023-12-24 10:49:40,375] DEBUG {cps.services.worker:91} Add Task for user: Admin - Download https://vimeo.com/channels/staffpicks/893773360
[2023-12-24 10:49:40,377]  INFO {cps.tasks.download:28} Starting download task for URL: https://vimeo.com/channels/staffpicks/893773360
[2023-12-24 10:49:40,377]  INFO {cps.tasks.download:37} Subprocess args: ['lb-wrapper', 'https://vimeo.com/channels/staffpicks/893773360']
[2023-12-24 10:49:40,395]  INFO {cps.tasks.download:50} /usr/local/bin/lb

[2023-12-24 10:49:53,953]  INFO {cps.editbooks:382} Requested files list: ['https://vimeo.com/channels/staffpicks/893773360']
[2023-12-24 10:49:53,954] ERROR {cps:1414} Exception on /meta [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 2190, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 1486, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/usr/local/calibre-web-py3/cps/editbooks.py", line 471, in meta
    if move_mediafile(requested_files, current_user_name, shelf_title):
  File "/usr/local/calibre-web-py3/cps/editbooks.py", line 384, in move_mediafile
    requested_file = open(requested_file, "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'https://vimeo.com/channels/staffpicks/893773360'
[2023-12-24 10:49:54,045] ERROR {cps.tasks.download:81} Failed to send the list of requested files to https://lrn2.org/live/meta
root@lrn2:~# tail -4 /var/log/xklb.log
2023-11-28 12:45:57 - An error occurred while running the command. Output:
2023-12-24 10:49:40 - Old /library/downloads/calibre-web/survey.db moved aside.
2023-12-24 10:49:40 - Running command: lb tubeadd /library/downloads/calibre-web/survey.db https://vimeo.com/channels/staffpicks/893773360 --verbose && lb dl /library/downloads/calibre-web/survey.db --prefix /library/downloads/calibre-web --write-thumbnail --format best --format-sort 'tbr~1000' --video https://vimeo.com/channels/staffpicks/893773360 --verbose
2023-12-24 10:49:53 - Download completed successfully.
root@lrn2:/usr/local/calibre-web-py3# git log --oneline | head
e83c81e5 Merge branch 'janeczku:master' into master
4c64662b README.md: "Internet-in-a-Box does not support Docker"
2f7413cb Merge pull request #75 from deldesir/deldesir-tornado
93791b3a Increase Buffersize to 10GB
25fb8d93 Merge remote-tracking branch 'nl/master'
b456263d Merge pull request #72 from deldesir/deldesir-mp4-cover
525cd2fe Support case insensitive ext
bc0ebdb7 Updated Dutch translation.
cdfd9b31 Merge pull request #71 from deldesir/deldesir-description
04306ba2 Pull description
root@lrn2:~# cat /etc/issue
Ubuntu 22.04.3 LTS \n \l
root@lrn2:~# lb --version
2.2.192
root@lrn2:~# yt-dlp --version
2023.10.13

ASIDE: Since then I tried to upgrade yt-dlp...

root@lrn2:~# pipx upgrade --include-injected xklb
xklb is already at latest version 2.2.192 (location: /root/.local/pipx/venvs/xklb)

That was not sufficient — so in the end the much slower pipx reinstall xklb did finally force yt-dlp to upgrade...

root@lrn2:~# yt-dlp --version
2023.11.16

...either way that did not help, when I later tried downloading the same video using its shorter URL https://vimeo.com/893773360 — though with a different failure pattern in /var/log/calibre-log :

root@lrn2:~# tail -6 /var/log/calibre-log
[2023-12-24 11:37:04,820] DEBUG {cps.services.worker:91} Add Task for user: Admin - Download https://vimeo.com/893773360
[2023-12-24 11:37:04,822]  INFO {cps.tasks.download:28} Starting download task for URL: https://vimeo.com/893773360
[2023-12-24 11:37:04,823]  INFO {cps.tasks.download:37} Subprocess args: ['lb-wrapper', 'https://vimeo.com/893773360']
[2023-12-24 11:37:04,829]  INFO {cps.tasks.download:50} /usr/local/bin/lb

[2023-12-24 11:37:15,284] ERROR {cps.tasks.download:81} Failed to send the list of requested files to https://lrn2.org/live/media?data=root&sort_param=stored
root@lrn2:~# tail -3 /var/log/xklb.log
2023-12-24 11:37:04 - Old /library/downloads/calibre-web/survey.db moved aside.
2023-12-24 11:37:04 - Running command: lb tubeadd /library/downloads/calibre-web/survey.db https://vimeo.com/893773360 --verbose && lb dl /library/downloads/calibre-web/survey.db --prefix /library/downloads/calibre-web --write-thumbnail --format best --format-sort 'tbr~1000' --video https://vimeo.com/893773360 --verbose
2023-12-24 11:37:15 - Download completed successfully.

Possibly related:

Automate bookshelves creation and population

Describe the Problem

Currently, in Calibre-Web, the creation and population of bookshelves are manual processes, dependent on user decisions after each upload/download. This manual approach can become time-consuming and less user-friendly, especially when multiple downloads occur.

The proposal is to automate the process of creating and populating bookshelves upon the occurrence of multiple downloads. This automation should streamline the organization of downloaded content and enhance user experience by reducing manual efforts.

Proposed Changes

  1. Automated Bookshelf Creation: Implement a feature to automatically create bookshelves based on specified criteria (e.g., playlist title, custom name) for downloaded content.
  2. Populating Bookshelves: Upon download completion, the system will automatically organize and populate the appropriate bookshelves based on predefined rules or user settings.
  3. Customizable Automation: Provide users with the flexibility to customize the automation settings, allowing for personalized organization rules and preferences. This should be defaulted to available collection title. The current frontend code for the download modal dialog is misleading. It must be removed or optimized for custom naming/renaming of bookshelves.
  4. User Notification: Notify users about the automated creation and population of bookshelves, ensuring transparency and awareness of the organization process.

Expected Outcomes

By automating the creation and population of bookshelves upon multiple downloads, the goal is to significantly reduce manual efforts for users, improving the organization and accessibility of downloaded content within Calibre-Web.

Additional Context

The aim of this proposed change is to enhance the user experience by automating the organization process without compromising user control. This enhancement seeks to minimize the burden on users in organizing downloaded content while allowing for customization and user-defined parameters for automation.

Support additional media upload and download

Problem Statement:
Calibre-Web is a robust platform designed for managing e-books efficiently. However, users often find the need to organize their personal multimedia content (videos, photos, audios) alongside their digital book collection. Presently, there's no seamless provision to integrate and manage these diverse media types within Calibre-Web.

Proposed Solution:
This expansion to support multimedia content is crucial. By incorporating support for various media formats (videos, photos, audios), users can effortlessly upload, organize, and manage their diverse digital media collections. Ensuring metadata persistence in the database will allow for easy categorization and searching. Additionally, implementing a feature to download videos from popular platforms directly into Calibre-Web would significantly enhance its utility.

Detailed Feature Specifications:

  1. Multimedia Upload Support: Enable the uploading of various media formats supported by major browsers (e.g., MP4, WEBM for videos; JPEG, PNG for images; MP3, OGG and WAV for audios).
  2. Metadata Handling: Implement a system to persist metadata associated with each uploaded media file (e.g., title, description, author, date, etc.).
  3. Integration with Online Platforms: Provide an option to download videos directly from popular platforms (such as YouTube, Vimeo) for seamless integration and management.
    Screenshot from 2023-11-01 10-35-11

Alternatives Considered:

  • Custom Plugin Development: While a custom plugin could address this need, maintaining it separately might introduce complexities. Integrating these features directly within Calibre-Web would provide a more seamless and integrated solution for users.

"Download to IIAB" failures must be shown in "Tasks" view with explanation [e.g. "Media check failed (will try again later)" "Failed reading header" with .mhtml] [e.g. `YouTube_Movies_TV` channel encrypted w/ browser-based DRM?]

Summary:

  1. Calibre-Web's "Tasks" view must acknowledge all "Download to IIAB" and "Upload" button failures.
  2. Regardless what the error appears to be, some version of the error must be shown in "Tasks" view. Calibre-Web's Python needs to be revised to surface (display) the most meaningful errors possible.
  3. EXAMPLE: The 97min video below does not currently work with "Download to IIAB": https://youtu.be/HPkDFc8hq5c
    • What is the reason for this failure?
    • Why is a video not downloaded to /library/downloads/calibre-web/Youtube/YouTube_Movies_TV/ ? For now instead of a video, a 1-to-3 MB .html file (e.g. Mean_Girls_3.10M_[HPkDFc8hq5c].mhtml) is placed in /library/downloads/calibre-web/Youtube/YouTube_Movies_TV/
    • What's the most meaningful error that can be passed automatically to "Tasks" view? Is the following 2-lines error (resulting from lb dl ... -vv below) perhaps the best we can do today?
      [https://www.youtube.com/watch?v=HPkDFc8hq5c]: Media check failed (will try again later)
      Failed reading header. /library/downloads/calibre-web/Youtube/YouTube_Movies_TV/Mean_Girls_3.11M_[HPkDFc8hq5c].mhtml
      
    • What does the above error mean?
root@box:/library/downloads/calibre-web# tree -h
[4.0K]  .
├── [4.0K]  Youtube
│   └── [4.0K]  YouTube_Movies_TV
│       ├── [2.5M]  Mean_Girls_3.10M_[HPkDFc8hq5c].mhtml
│       └── [228K]  Mean_Girls_3.10M_[HPkDFc8hq5c].webp
└── [132K]  survey.db

3 directories, 3 files
root@box:~# tree /library/calibre-web/
/library/calibre-web/
├── config
│   └── app.db
├── metadata.db
└── metadata_db_prefs_backup.json

2 directories, 3 files
root@box:~# lb --version
2.3.001
root@box:~# yt-dlp --version
2023.12.30
root@box:~# hostname -I
10.181.233.173 192.168.0.235 10.8.0.58 fd42:fb6b:9c93:d2f1:5054:ff:fe7f:2f9d
root@box:~# hostname -A
t5.lxd box box t5.lxd
root@box:~# systemctl status calibre-web
● calibre-web.service - Calibre-Web
     Loaded: loaded (/etc/systemd/system/calibre-web.service; enabled; preset: enabled)
     Active: active (running) since Tue 2024-01-02 22:10:33 EST; 4min 56s ago
   Main PID: 3942 (python3)
      Tasks: 4 (limit: 2300)
     Memory: 173.5M
        CPU: 7.367s
     CGroup: /system.slice/calibre-web.service
             └─3942 /usr/local/calibre-web-py3/bin/python3 /usr/local/calibre-web-py3/cps.py -p /library/calibre-web/config/app.db

Jan 02 22:10:33 box systemd[1]: Started calibre-web.service - Calibre-Web.
root@box:~# cat /var/log/calibre-web.log
[2024-01-02 22:10:34,597]  INFO {cps:168} *** "greenlet" version does not meet the requirements. Should: <2.1.0, Found: 3.0.3, please consider installing required version ***
[2024-01-02 22:10:34,597]  INFO {cps:177} Starting Calibre Web...
[2024-01-02 22:10:34,603] DEBUG {cps.services:26} Cannot import goodreads, showing authors-metadata will not work: No module named 'betterreads'
[2024-01-02 22:10:34,605] DEBUG {cps.services:34} Cannot import simpleldap, logging in with ldap will not work: No module named 'flask_simpleldap'
[2024-01-02 22:10:34,637] DEBUG {cps.services:49} Cannot import gmail, sending books via Gmail Oauth2 Verification will not work: No module named 'google_auth_oauthlib'
[2024-01-02 22:10:34,652]  WARN {py.warnings:109} /usr/local/calibre-web-py3/lib/python3.11/site-packages/flask_limiter/extension.py:336: UserWarning: Using the in-memory storage for tracking rate limits as no storage was explicitly specified. This is not recommended for production use. See: https://flask-limiter.readthedocs.io#configuring-a-storage-backend for documentation about configuring the storage backend.
  warnings.warn(

[2024-01-02 22:10:34,780] DEBUG {cps.gdriveutils:81} Cannot import pydrive, httplib2, using gdrive will not work: No module named 'pydrive'
[2024-01-02 22:10:35,026]  INFO {apscheduler.scheduler:181} Scheduler started
[2024-01-02 22:10:35,026]  INFO {apscheduler.scheduler:895} Added job "end scheduled task" to job store "default"
[2024-01-02 22:10:35,140] DEBUG {cps.comic:46} Cannot import comicapi, extracting comic metadata will not work: No module named 'comicapi'
[2024-01-02 22:10:35,141] DEBUG {cps.comic:53} Cannot import rarfile, extracting cover files from rar files will not work: No module named 'rarfile'
[2024-01-02 22:10:35,141] DEBUG {cps.comic:59} Cannot import py7zr, extracting cover files from CB7 files will not work: No module named 'py7zr'
[2024-01-02 22:10:35,211] DEBUG {cps.admin:81} Cannot import Flask-Dance, login with Oauth will not work: No module named 'flask_dance'
[2024-01-02 22:10:35,215] DEBUG {cps.gdrive:44} Cannot import googleapiclient, using GDrive will not work: No module named 'googleapiclient'
[2024-01-02 22:10:35,254] DEBUG {cps.search_metadata:62} Import error for metadata source: scholar - No module named 'scholarly'
[2024-01-02 22:10:35,262] DEBUG {cps.search_metadata:62} Import error for metadata source: douban - No module named 'html2text'
[2024-01-02 22:10:35,270] DEBUG {cps.search_metadata:62} Import error for metadata source: lubimyczytac - No module named 'dateutil'
[2024-01-02 22:10:35,271] DEBUG {cps.search_metadata:62} Import error for metadata source: amazon - No module named 'bs4'
[2024-01-02 22:10:35,342]  INFO {cps.server:267} Starting Tornado server on :8083
[2024-01-02 22:12:28,769] DEBUG {cps.web:1410} You are now logged in as: 'Admin'
[2024-01-02 22:12:28,789] DEBUG {cps.ub:82} Login and store session : 8b1f3e026c99c26da2710a803e79fd8c3731814f5a5be1b048a9411edb469756fa361953799483455066116aa7c0ded030ea40dafe80a1633b5985cd2bc19327
[2024-01-02 22:12:28,790] DEBUG {cps.ub:84} Found stored session: 8b1f3e026c99c26da2710a803e79fd8c3731814f5a5be1b048a9411edb469756fa361953799483455066116aa7c0ded030ea40dafe80a1633b5985cd2bc19327
[2024-01-02 22:14:58,237] DEBUG {cps.services.worker:91} Add Task for user: Admin - Download https://www.youtube.com/watch?v=HPkDFc8hq5c
[2024-01-02 22:14:58,241]  INFO {cps.tasks.download:28} Starting download task for URL: https://www.youtube.com/watch?v=HPkDFc8hq5c
[2024-01-02 22:14:58,242]  INFO {cps.tasks.download:37} Subprocess args: ['lb-wrapper', 'https://www.youtube.com/watch?v=HPkDFc8hq5c']
[2024-01-02 22:14:58,263]  INFO {cps.tasks.download:50} /usr/local/bin/lb

[2024-01-02 22:15:07,115]  INFO {cps.editbooks:382} Requested files list: ['https://www.youtube.com/watch?v=HPkDFc8hq5c']
[2024-01-02 22:15:07,115] ERROR {cps:1414} Exception on /meta [GET]
Traceback (most recent call last):
  File "/usr/local/calibre-web-py3/lib/python3.11/site-packages/flask/app.py", line 2190, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/calibre-web-py3/lib/python3.11/site-packages/flask/app.py", line 1486, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/calibre-web-py3/lib/python3.11/site-packages/flask/app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/calibre-web-py3/lib/python3.11/site-packages/flask/app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/calibre-web-py3/cps/editbooks.py", line 471, in meta
    if move_mediafile(requested_files, current_user_name, shelf_title):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/calibre-web-py3/cps/editbooks.py", line 384, in move_mediafile
    requested_file = open(requested_file, "rb")
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'https://www.youtube.com/watch?v=HPkDFc8hq5c'
[2024-01-02 22:15:07,125] ERROR {cps.tasks.download:81} Failed to send the list of requested files to http://192.168.0.235/books/meta
root@box:~# cat /var/log/xklb.log
2024-01-02 22:14:58 - Running command: lb tubeadd /library/downloads/calibre-web/survey.db https://www.youtube.com/watch?v=HPkDFc8hq5c --verbose && lb dl /library/downloads/calibre-web/survey.db --prefix /library/downloads/calibre-web --write-thumbnail --format best --format-sort 'tbr~1000' --video https://www.youtube.com/watch?v=HPkDFc8hq5c --verbose
2024-01-02 22:15:07 - Download completed successfully.
root@box:~# lb dl /library/downloads/calibre-web/survey.db --prefix /library/downloads/calibre-web --write-thumbnail --format best --format-sort 'tbr~1000' --video https://www.youtube.com/watch?v=HPkDFc8hq5c -vv
library v2.3.001
['/usr/local/bin/lb', 'dl', '/library/downloads/calibre-web/survey.db', '--prefix', '/library/downloads/calibre-web', '--write-thumbnail', '--format', 'best', '--format-sort', 'tbr~1000', '--video', 'https://www.youtube.com/watch?v=HPkDFc8hq5c', '-vv']
{'profile': 'video', 'extractor_config': {}, 'extra_media_data': {}, 'extra_playlist_data': {}, 'prefix': '/library/downloads/calibre-web', 'sort': 'm.path like "http%"\n        , m.title IS NOT NULL desc\n        , m.path\n        , random()', 'where': [], 'include': [], 'exclude': [], 'limit': 7200, 'retry_delay': '14 days', 'db': <Database <sqlite3.Connection object at 0x7f70976e63e0>>, 'verbose': 2, 'database': '/library/downloads/calibre-web/survey.db', 'playlists': [], 'defaults': ['sort', 'limit'], 'unk': ['--write-thumbnail', '--format', 'best', '--format-sort', 'tbr~1000', 'https://www.youtube.com/watch?v=HPkDFc8hq5c'], 'action': 'download'}
None
{'path': 'https://www.youtube.com/watch?v=HPkDFc8hq5c', 'title': 'Mean Girls', 'duration': 5810, 'time_created': 1704254287, 'size': 0, 'time_modified': 0, 'time_downloaded': 0, 'time_deleted': 0, 'extractor_key': 'Playlist-less media'}
{'noprogress': True, 'lazy_playlist': True, 'noplaylist': True, 'no_check_certificate': True, 'ignore_no_formats_error': True, 'skip_playlist_after_errors': 21, 'playlistend': 20000, 'extractor_args': {'youtube': {'skip': ['authcheck']}}, 'logger': <xklb.tube_backend.download.<locals>.DictLogger object at 0x7f70975a5610>, 'postprocessors': [{'key': 'FFmpegMetadata'}, {'key': 'FFmpegEmbedSubtitle'}], 'restrictfilenames': True, 'playlist_items': '1', 'extractor_retries': 3, 'retries': 12, 'retry_sleep_functions': {'extractor': <function download.<locals>.<lambda> at 0x7f7096ba5b20>, 'http': <function download.<locals>.<lambda> at 0x7f7096ba5bc0>, 'fragment': <function download.<locals>.<lambda> at 0x7f7096ba5c60>}, 'outtmpl': {'default': '/library/downloads/calibre-web/%(extractor_key,extractor)s/%(uploader,uploader_id)s/%(title).200B_%(view_count)3.2D_[%(id).60B].%(ext)s', 'chapter': '/library/downloads/calibre-web/%(extractor_key,extractor)s/%(uploader,uploader_id)s/%(title).200B_%(section_number)03d_%(section_title)s_%(view_count)3.2D_[%(id).60B].%(ext)s'}, 'subtitlesformat': 'srt/best', 'format': 'best', 'format_sort': ['tbr~1000'], 'writethumbnail': True, '_warnings': ['"-f best" selects the best pre-merged format which is often not the best option.\n         To let yt-dlp download and merge the best available formats, simply do not pass any format selection.\n         If you know what you are doing and want only the best pre-merged format, use "-f b" instead to suppress this warning']}
[https://www.youtube.com/watch?v=HPkDFc8hq5c]: Media check failed (will try again later)
Failed reading header. /library/downloads/calibre-web/Youtube/YouTube_Movies_TV/Mean_Girls_3.11M_[HPkDFc8hq5c].mhtml
(b'{\n\n}\n', b'ffprobe version 6.1-5ubuntu1 Copyright (c) 2007-2023 the FFmpeg developers\n  built with gcc 13 (Ubuntu 13.2.0-7ubuntu1)\n  configuration: --prefix=/usr --extra-version=5ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libharfbuzz --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-libjxl --enable-pocketsphinx --enable-librsvg --enable-libvpl --disable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libsvtav1 --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared\n  libavutil      58. 29.100 / 58. 29.100\n  libavcodec     60. 31.102 / 60. 31.102\n  libavformat    60. 16.100 / 60. 16.100\n  libavdevice    60.  3.100 / 60.  3.100\n  libavfilter     9. 12.100 /  9. 12.100\n  libswscale      7.  5.100 /  7.  5.100\n  libswresample   4. 12.100 /  4. 12.100\n  libpostproc    57.  3.100 / 57.  3.100\n/library/downloads/calibre-web/Youtube/YouTube_Movies_TV/Mean_Girls_3.11M_[HPkDFc8hq5c].mhtml: Invalid data found when processing input\n')
Extra media data {'rows': 5, 'columns': 5, 'corruption': 50}

Similar "FileNotFoundError: [Errno 2] No such file or directory:" error with Vimeo 9 days ago:

Testing scenarios for multimedia downloads using iiab/calibre-web [TDD, Gherkin Stories]

This is a placeholder for testing scenarios pertaining to the media download feature:

  1. Valid Download with Progress Observation:

    • Provide a valid media URL.
    • Observe the progress during the download of each video when a playlist URL is submitted.
    • Ensure the download completes successfully.
    • Verify that the progress reaches 100% and the success message is displayed.
  2. Invalid URL:

    • Provide an invalid media URL (e.g., a URL that doesn't exist or is unreachable or a known YouTube or Vimeo one that will fail).
    • Confirm that the error handling correctly detects the failure.
    • Check that the progress is set to 0, and an appropriate error message is displayed in Tasks.
  3. No Requested Files in the Database:

    • Ensure the SQLite database contains no requested files by providing a YouTube live video URL.
    • Run the download task and verify that it logs "No requested files found in the database."
    • Check that the progress is set to 0 and an error is displayed in Tasks.
  4. Shelf Title Retrieval:

    • Intentionally provide a short playlist URL.
    • Confirm that the bookshelf is named after the playlist title, and appropriate messages are displayed in Tasks.
    • Check that the progress is set accordingly (100% if successful).
  5. Download Cancellation:

    • Provide a valid media URL.
    • During the download process, attempt to cancel the task.
    • Confirm that the cancellation is handled correctly, and the progress is set to 0.

Full description missing for downloaded videos

Screenshot 2023-12-18 114636

Full description(s) text/paragraphs now appear missing — see the screenshot above — apparently due to an upstream change or regression in xklb ?

root@box:~# yt-dlp --version
2023.11.16
root@box:~# lb --version
2.2.186
root@box:~# hostname -I
10.181.233.245 192.168.0.117 10.8.0.46 fd42:fb6b:9c93:d2f1:5054:ff:fe1b:116f
root@box:~# hostname -A
t4.lxd box box t4.lxd
root@box:~# cat /etc/issue
Ubuntu Noble Numbat (development branch) \n \l

Originally posted by @holta in #65 (comment)

Ensure existing subprocess wrapper is called

Describe the bug/problem

The current implementation in editbooks.py utilizes direct imports from the subprocess module, which diverges from the consistent practice within the Calibre-Web codebase. To ensure uniformity and maintain code standardization, the file should use the subproc_wrapper.py as an interface for interacting with subprocesses, for #6.

To Reproduce

There is no specific bug to reproduce; this issue pertains to code consistency and best practices within the Calibre-Web project.

Expected behavior

Refactoring the code in editbooks.py to utilize the subproc_wrapper.py should lead to seamless subprocess operations in line with the established code standards.

Environment (please complete the following information):

  • OS: Ubuntu 23.10
  • Python version: 3.11.6
  • Calibre-Web version: 0.6.21 - Romesa (customized per #7 )
  • Docker container: No
  • Special Hardware: No
  • Browser: Firefox Nightly 121.0a1 (2023-10-31) (64-bit)

Additional context

It's recommended to review the code changes thoroughly, ensuring that the substitution from direct subprocess imports to the subproc_wrapper.py maintains or improves the functionality without introducing any regressions. The modification should promote uniformity in the codebase and simplify future maintenance tasks related to subprocess interactions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.