### Start Calibre-Web Service Source: https://github.com/janeczku/calibre-web/blob/master/README.md Starts the Calibre-Web application after installation. This command assumes the virtual environment is active. ```bash cps ``` -------------------------------- ### Start Calibre-Web from Source Source: https://github.com/janeczku/calibre-web/wiki/How-To:-Windows-Installation Run the Calibre-Web application using the Python interpreter after installing from source. Adjust the path to match your installation directory. ```cmd python c:\Install_Folder\Calibre-Web\cps.py ``` -------------------------------- ### Example Systemd Service File Source: https://github.com/janeczku/calibre-web/wiki/Setup-Service-on-Linux A concrete example of a Systemd service file for Calibre-Web, showing typical paths for a virtual environment installation. ```ini [Unit] Description=Calibre-Web [Service] Type=simple User=ubuntu ExecStart=/opt/calibre-web/venv/bin/python3 /opt/calibre-web/cps.py WorkingDirectory=/opt/calibre-web/ [Install] WantedBy=multi-user.target ``` -------------------------------- ### Run Calibre-Web (Windows) Source: https://github.com/janeczku/calibre-web/wiki/Manual-Installation Starts the Calibre-Web application on Windows. Executed from the Calibre-Web installation folder. ```cmd .\venv\Scripts\python3.exe cps.py ``` -------------------------------- ### Install Calibre-Web Requirements from Source Source: https://github.com/janeczku/calibre-web/wiki/How-To:-Windows-Installation Navigate to the Calibre-Web directory and install the necessary requirements using pip. This is part of the source installation process. ```cmd cd C:\Install_Folder\Calibre-Web python -m pip install -r requirements.txt ``` -------------------------------- ### Start Calibre-Web Service with OpenRC Source: https://github.com/janeczku/calibre-web/wiki/Setup-Service-on-Linux Use this command to start the Calibre-Web service after configuring the OpenRC init script. ```shell doas rc-service calibre-web start ``` -------------------------------- ### Install Kobo Dependencies Source: https://github.com/janeczku/calibre-web/wiki/Kobo-Integration Installs necessary Python dependencies for Kobo integration. Ensure you have a virtual environment set up. ```bash ./venv/bin/python3 -m pip install -r kobo-requirements.txt ``` -------------------------------- ### Install Python dependencies (Windows) Source: https://github.com/janeczku/calibre-web/wiki/Manual-Installation Installs required Python packages from requirements.txt within the Windows virtual environment. Executed from the Calibre-Web installation folder. ```cmd .\venv\Scripts\python3.exe -m pip install -r requirements.txt ``` -------------------------------- ### Start Calibre-Web Systemd Service Source: https://github.com/janeczku/calibre-web/wiki/Setup-Service-on-Linux Command to manually start the Calibre-Web service. ```shell sudo systemctl start cps.service ``` -------------------------------- ### Install dependencies (Linux) Source: https://github.com/janeczku/calibre-web/wiki/Manual-Installation Installs necessary packages like git, imagemagick, pip, and venv using apt. ```bash apt install git imagemagick python3-pip python3-venv ``` -------------------------------- ### Install Python Pip on Linux Mint 20 Source: https://github.com/janeczku/calibre-web/wiki/How-To:-Install-Calibre-Web-in-Linux Installs the python3-pip package, a prerequisite for installing Calibre-Web on Linux Mint 20. ```shell sudo apt install python3-pip ``` -------------------------------- ### Install Calibre-Web via pip Source: https://github.com/janeczku/calibre-web/blob/master/README.md Installs the Calibre-Web application using pip within an activated virtual environment. Ensure you have pip installed and updated. ```bash pip install calibreweb ``` -------------------------------- ### Install Calibre-Web with Optional Features via Pip Source: https://github.com/janeczku/calibre-web/wiki/Dependencies-in-Calibre-Web-Linux-and-Windows Use this command to install Calibre-Web with specific optional features enabled. The brackets `[]` are part of the command syntax. ```bash pip install 'calibreweb[extraname]' ``` -------------------------------- ### Run Calibre-Web (Linux) Source: https://github.com/janeczku/calibre-web/wiki/Manual-Installation Starts the Calibre-Web application. The command will not return to the prompt. ```bash ./venv/bin/python3 cps.py ``` -------------------------------- ### Install Calibre-Web on Alpine Linux Source: https://github.com/janeczku/calibre-web/wiki/How-To:-Install-Calibre-Web-in-Linux Installs the Calibre-Web package within the created virtual environment on Alpine Linux. ```shell /opt/calibre-web/bin/python3 -m pip install calibreweb ``` -------------------------------- ### Install Calibre-Web on Linux Mint 20 Source: https://github.com/janeczku/calibre-web/wiki/How-To:-Install-Calibre-Web-in-Linux Installs Calibre-Web using pip within the newly created virtual environment on Linux Mint 20. ```shell ./venv/bin/python3 -m pip install calibreweb ``` -------------------------------- ### Install Prerequisites on Linux Mint 19 Source: https://github.com/janeczku/calibre-web/wiki/How-To:-Install-Calibre-Web-in-Linux Installs necessary packages including python3-pip, python3-dev, setuptools, and wheel on Linux Mint 19. ```shell sudo apt install python3-pip sudo apt install python3-dev python3 -m pip install --upgrade setuptools python3 -m pip install wheel ``` -------------------------------- ### Run Multiple Calibre-Web Instances Source: https://github.com/janeczku/calibre-web/wiki/FAQ Use command-line options to start multiple instances of Calibre-Web, each configured for a different Calibre library. This approach avoids duplicating the Calibre-Web code. ```bash nohup python3 [path to calibre-web]cps.py -p /[path to calibre-web instance1.db] ``` ```bash nohup python3 [path to calibre-web]cps.py -p /[path to calibre-web instance2.db] ``` ```bash nohup python3 [path to calibre-web]cps.py -p /[path to calibre-web instanceN.db] ``` -------------------------------- ### Enable Calibre-Web Systemd Service Source: https://github.com/janeczku/calibre-web/wiki/Setup-Service-on-Linux Command to ensure the Calibre-Web service starts automatically on boot. ```shell sudo systemctl enable cps.service ``` -------------------------------- ### Systemd Service File (manual installation) Source: https://github.com/janeczku/calibre-web/wiki/Setup-Service-on-Linux Template for a Systemd service file for manual installations. Specify the Python executable and the path to cps.py, along with the working directory. ```ini [Unit] Description=Calibre-Web [Service] Type=simple User={Username} ExecStart={path to python} {/PATH/TO/cps.py including cps.py} WorkingDirectory={/PATH/OF/CPS.PY without cps.py} [Install] WantedBy=multi-user.target ``` -------------------------------- ### Install Calibre-Web using pip Source: https://github.com/janeczku/calibre-web/wiki/How-To:-Windows-Installation Use this command to install Calibre-Web and its dependencies via pip. Ensure Python is added to your system's environmental variables. ```cmd python -m pip install calibreweb ``` -------------------------------- ### Create virtual environment (Windows) Source: https://github.com/janeczku/calibre-web/wiki/Manual-Installation Sets up an isolated Python environment for Calibre-Web on Windows. Assumes Python is installed in 'c:\python'. ```cmd c:\python\python.exe -m venv venv ``` -------------------------------- ### Install cryptography package (Linux) Source: https://github.com/janeczku/calibre-web/wiki/Manual-Installation Manually installs the 'cryptography' Python package, which may be necessary on some systems. ```bash ./venv/bin/python3 -m pip install cryptography ``` -------------------------------- ### Systemd Service File (pip installation) Source: https://github.com/janeczku/calibre-web/wiki/Setup-Service-on-Linux Template for a Systemd service file when Calibre-Web is installed via pip. Replace placeholders like {Username} and {path to starterfile}. ```ini [Unit] Description=Calibre-Web [Service] Type=simple User={Username} ExecStart={path to starterfile} [Install] WantedBy=multi-user.target ``` -------------------------------- ### Install Python dependencies (Linux) Source: https://github.com/janeczku/calibre-web/wiki/Manual-Installation Installs required Python packages listed in requirements.txt within the virtual environment. ```bash ./venv/bin/python3 -m pip install -r requirements.txt ``` -------------------------------- ### Run Calibre-Web on Linux Mint 20 Source: https://github.com/janeczku/calibre-web/wiki/How-To:-Install-Calibre-Web-in-Linux Starts Calibre-Web using the Python interpreter from the virtual environment on Linux Mint 20. Ensure the terminal remains open. ```shell ./venv/bin/cps # or ./venv/bin/python3 -m calibreweb ``` -------------------------------- ### Create virtual environment with system site packages (Linux) Source: https://github.com/janeczku/calibre-web/wiki/Manual-Installation Creates a virtual environment that has access to globally installed Python packages, useful for resolving dependency issues like 'cryptography' on Raspberry Pi OS. ```bash python3 -m venv venv --system-site-packages ``` -------------------------------- ### Install cargo (Linux) Source: https://github.com/janeczku/calibre-web/wiki/Manual-Installation Installs the 'cargo' build tool, which may be required for compiling Rust-based dependencies like 'cryptography'. ```bash apt install cargo ``` -------------------------------- ### Run Calibre-Web in background (Linux) Source: https://github.com/janeczku/calibre-web/wiki/Manual-Installation Starts Calibre-Web and allows the terminal prompt to return, running the process in the background. ```bash nohup ./venv/bin/python3 cps.py ``` -------------------------------- ### Install Python Packages on Alpine Linux Source: https://github.com/janeczku/calibre-web/wiki/How-To:-Install-Calibre-Web-in-Linux Installs necessary Python 3 packages and build tools for compiling wheel extensions on Alpine Linux. ```shell doas apk add python3 py3-pip py3-virtualenv py3-virtualenv-pyc ``` ```shell doas apk add build-base linux-headers python3-dev ``` -------------------------------- ### Install requirements with system flag (Ubuntu) Source: https://github.com/janeczku/calibre-web/wiki/Manual-Installation Installs Python dependencies using the '--system' flag to resolve 'can't combine user with prefix' errors on certain Ubuntu versions. ```bash ./venv/bin/python3 -m pip install --system -r requirements.txt ``` -------------------------------- ### Switch to root user (Linux) Source: https://github.com/janeczku/calibre-web/wiki/Manual-Installation Use this command to gain root privileges for system-wide installations. ```bash sudo -i ``` -------------------------------- ### Run Calibre-Web on Alpine Linux Source: https://github.com/janeczku/calibre-web/wiki/How-To:-Install-Calibre-Web-in-Linux Starts the Calibre-Web application using the Python interpreter from the virtual environment on Alpine Linux. ```shell /opt/calibre-web/bin/python3 -m calibreweb # alternatively /opt/calibre-web/bin/cps ``` -------------------------------- ### Create Virtual Environment on Linux Mint 20 Source: https://github.com/janeczku/calibre-web/wiki/How-To:-Install-Calibre-Web-in-Linux Installs the venv module and creates a virtual environment for Calibre-Web on Linux Mint 20. ```shell python3 -m pip install venv python3 -m venv venv ``` -------------------------------- ### OPDS Authentication URL Examples Source: https://github.com/janeczku/calibre-web/wiki/FAQ These examples show how to include authentication credentials directly in the OPDS catalogue URL if your reader does not have a dedicated field for them. Ensure special characters are URL-encoded. ```url https://calibre-web.example.com/opds?auth=username:password ``` ```url https://username:password@calibre-web.example.com/opds ``` -------------------------------- ### Activate Python Virtual Environment Source: https://github.com/janeczku/calibre-web/blob/master/README.md Activates the previously created virtual environment. This must be done before installing or running Calibre-Web. ```bash source calibre-web-env/bin/activate ``` -------------------------------- ### Calibre-Web Kobo Sync Log Output Source: https://github.com/janeczku/calibre-web/wiki/Kobo-Integration Example log output from Calibre-Web during a Kobo library sync request. Useful for diagnosing sync issues. ```log [2022-03-24 18:25:57,201] INFO {cps.kobo:140} Kobo library sync request received. [2022-03-24 18:25:57,201] DEBUG {cps.kobo:141} SyncToken: 0001-01-01 00:00:00,0001-01-01 00:00:00,0001-01-01 00:00:00,0001-01-01 00:00:00,0001-01-01 00:00:00, [2022-03-24 18:25:57,201] DEBUG {cps.kobo:143} Kobo: Received unproxied request, changed request port to external server port [2022-03-24 18:25:57,300] DEBUG {cps.kobo:215} Books to Sync: 4 [2022-03-24 18:25:57,492] DEBUG {cps.kobo:280} Remaining books to Sync: 0 ``` -------------------------------- ### Batch Script to Run Calibre-Web Source: https://github.com/janeczku/calibre-web/wiki/How-To:-Windows-Installation Create a batch file to automatically start Calibre-Web. This script specifies the Python executable path and the Calibre-Web application script. Place this file outside the Calibre-Web directory to prevent overwrites during updates. ```cmd "C:\Users\UserName\AppData\Local\Programs\Python\Python37-32\python.exe" "C:\Install_Folder\Calibre-Web\cps.py" ``` -------------------------------- ### Kubernetes ingress-nginx with Authelia Annotations Source: https://github.com/janeczku/calibre-web/wiki/Setup-Reverse-Proxy This example demonstrates how to configure ingress-nginx on Kubernetes to use Authelia for proxy authentication. It specifies the authentication method, URL, sign-in redirect, and response headers. ```yaml apiVersion: networking.k8s.io/v1 kind: Ingress metadata: annotations: nginx.ingress.kubernetes.io/auth-method: "GET" nginx.ingress.kubernetes.io/auth-url: "http://authelia.auth.svc.cluster.local:9091/api/authz/auth-request" nginx.ingress.kubernetes.io/auth-signin: "https://authelia.YOUR_DOMAIN.TLD?rm=$request_method" nginx.ingress.kubernetes.io/auth-response-headers: "Remote-User,Remote-Name,Remote-Groups,Remote-Email" ``` -------------------------------- ### LDAP Search Commands Source: https://github.com/janeczku/calibre-web/wiki/LDAP-Login Example commands using ldapsearch to query for group members and user attributes. Replace placeholders with your actual server details and passwords. ```bash ldapsearch -H ldap://my-computer.com -D "cn=root,dc=calibreweb,dc=com" -w -b 'dc=calibreweb,dc=com' '(&(objectclass=groupofnames)(cn=cps))' member ``` ```bash ldapsearch -H ldap://my-computer.com -D "cn=root,dc=calibreweb,dc=com" -w -b 'dc=calibreweb,dc=com' '(uid=john)' * ``` -------------------------------- ### SoundManager Setup for MP3 Playback Source: https://github.com/janeczku/calibre-web/blob/master/cps/templates/listenmp3.html Configures SoundManager to use HTML5 audio for MP3 playback. Includes options for SWF file path and readiness/timeout callbacks. This is essential for initializing the audio player. ```javascript soundManager.setup({ useHTML5Audio: true, preferFlash: false, url: '/path/to/swf-files/', onready: function() { var mySound = soundManager.createSound({ // id: 'aSound', // url: "{{ url_for('web.serve_book', book_id=mp3file,book_format=audioformat)}}" }); mySound.play(); }, ontimeout: function() { // Hrmm, SM2 could not start. Missing SWF? Flash blocked? Show an error, etc.? } }); ``` -------------------------------- ### Nginx-manager Configuration for HTTPS Source: https://github.com/janeczku/calibre-web/wiki/Kobo-Integration Example Nginx-manager configuration for Truenas Scale over HTTPS, including headers for scheme and connection. This setup is for Calibre-Web reverse proxying. ```nginx proxy_busy_buffers_size 1024k; proxy_buffers 4 512k; proxy_buffer_size 512k; location / { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Host $http_host; proxy_set_header X-Forwarded-Proto https; proxy_set_header X-Scheme https; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $http_connection; proxy_http_version 1.1; proxy_pass http://truenasIP:calibre-web-container-port; # e.g. proxy_pass http://192.168.2.3:31067; } ``` -------------------------------- ### OpenRC Service File for Calibre-Web Source: https://github.com/janeczku/calibre-web/wiki/Setup-Service-on-Linux Create this file in /etc/init.d/ to manage Calibre-Web as a service with OpenRC. Customize command, arguments, and user. ```shell #!/sbin/openrc-run description="Calibre-Web" depend() { need net after firewall } # Calibre-Web does not know how to background itself command_background=true # Insert the command you decided to use to start calibre-web command="/opt/calibre-web/bin/cps" # Change if needed command_args="-o /var/log/calibre-web.log" # RC_SVCNAME variable contains the name of this service pidfile="/run/${RC_SVCNAME}.pid" # user:group the command should run under command_user="calibreweb:calibreweb" ``` -------------------------------- ### Create virtual environment (Linux) Source: https://github.com/janeczku/calibre-web/wiki/Manual-Installation Sets up an isolated Python environment for Calibre-Web dependencies. ```bash python3 -m venv venv ``` -------------------------------- ### Install Missing Python Module Source: https://github.com/janeczku/calibre-web/wiki/FAQ Use this command to install a missing Python module if you encounter an 'ImportError' during installation. Pip3 is typically used for Python 3.x. ```bash pip[3] --target vendor install [module-name] ``` -------------------------------- ### Upgrade Pip and Install Cargo on Raspberry Pi OS Source: https://github.com/janeczku/calibre-web/blob/master/README.md Workaround for potential installation issues on Raspberry Pi OS. This involves upgrading pip and installing the 'cargo' build tool. ```bash ./venv/bin/python3 -m pip install --upgrade pip sudo apt install cargo ``` -------------------------------- ### Create Python Virtual Environment Source: https://github.com/janeczku/calibre-web/blob/master/README.md Essential for isolating Calibre-Web and avoiding dependency conflicts. Run this command in your project directory. ```bash python3 -m venv calibre-web-env ``` -------------------------------- ### Assertion Error Example Source: https://github.com/janeczku/calibre-web/blob/master/test/Calibre-Web TestSummary_Linux.html This snippet shows an example of an assertion error during testing, indicating a mismatch in expected and actual values. ```python self.assertEqual(20746, len(epub_content)) AssertionError: 20746 != 6972 ``` -------------------------------- ### Download Sample Database Source: https://github.com/janeczku/calibre-web/blob/master/README.md Download a sample metadata.db file if you do not have an existing Calibre database. Ensure this file is moved out of the Calibre-Web folder after download to prevent it from being overwritten. ```text https://github.com/janeczku/calibre-web/raw/master/library/metadata.db ``` -------------------------------- ### Traceback Example - AttributeError Source: https://github.com/janeczku/calibre-web/blob/master/test/Calibre-Web TestSummary_Linux.html This snippet illustrates a traceback resulting from an AttributeError, where an object does not have the expected attribute. ```python Traceback (most recent call last): File "/home/ozzie/Development/calibre-web-test/test/test_list_orders.py", line 434, in test_order_authors_all_links self.check_element_on_page((By.ID, "asc")).click() AttributeError: 'bool' object has no attribute 'click' ``` -------------------------------- ### Create Virtual Environment on Alpine Linux Source: https://github.com/janeczku/calibre-web/wiki/How-To:-Install-Calibre-Web-in-Linux Creates a virtual environment for Calibre-Web using either venv or virtualenv on Alpine Linux. ```shell # venv doas python3 -m venv /opt/calibre-web # virtualenv doas python3 -m virtualenv /opt/calibre-web ``` -------------------------------- ### Traceback Example - AssertionError Source: https://github.com/janeczku/calibre-web/blob/master/test/Calibre-Web TestSummary_Linux.html This snippet shows a traceback with an AssertionError, indicating a failed assertion during test execution. ```python Traceback (most recent call last): File "/home/ozzie/Development/calibre-web-test/test/test_list_orders.py", line 548, in test_language_click_none self.assertEqual(int(element['count']), len(books[1])) AssertionError: 5 != 0 ``` -------------------------------- ### Initialize Calibre-Web Reader Configuration Source: https://github.com/janeczku/calibre-web/blob/master/cps/templates/read.html Initializes the global `calibre` object with necessary paths and URLs for the reader functionality. It also retrieves and sets the custom theme color from local storage if available. ```javascript window.calibre = { filePath: "{{ url_for('static', filename='js/libs/') }}", cssPath: "{{ url_for('static', filename='css/') }}", bookmarkUrl: "{{ url_for('web.set_bookmark', book_id=bookid, book_format=book_format) }}", bookUrl: "{{ url_for('web.serve_book', book_id=bookid, book_format=book_format, anyname='file.epub') }}", bookmark: "{{ bookmark.bookmark_key if bookmark != None }}", useBookmarks: "{{ current_user.is_authenticated | tojson }}" }; // load custom theme color from localStorage (if any) var _savedCustomThemeColor = null; try { _savedCustomThemeColor = localStorage.getItem( "calibre.reader.customTheme" ); } catch (e) {} ``` -------------------------------- ### Traceback Example - UnboundLocalError Source: https://github.com/janeczku/calibre-web/blob/master/test/Calibre-Web TestSummary_Linux.html This snippet displays a traceback with an UnboundLocalError, occurring when a local variable is accessed before it has been assigned a value. ```python Traceback (most recent call last): File "/home/ozzie/Development/calibre-web-test/test/test_list_orders.py", line 557, in test_publisher_click_none self.assertTrue(int(element['count']) > 0) ^^^^^^^ UnboundLocalError: cannot access local variable 'element' where it is not associated with a value ``` -------------------------------- ### Create Calibre Database Source: https://github.com/janeczku/calibre-web/wiki/Configuration Use this command to create a Calibre database if one does not exist. Ensure the specified directory is accessible. ```bash calibredb restore_database --really-do-it --with-library /books ``` -------------------------------- ### Configure SSL via Command Line Source: https://github.com/janeczku/calibre-web/wiki/Configuration Override SSL certificate and key file locations using command-line options. Use empty strings to revert to non-SSL mode. ```bash cps.py -c [certfile location] -k [keyfile location] ```