mirror of
				https://github.com/iiab/iiab.git
				synced 2025-03-09 15:40:17 +00:00 
			
		
		
		
	Merge pull request #3678 from holta/calibreweb-venv-wipe
Introduce var 'calibreweb_venv_wipe: False' for TDD (test-driven development) of Calibre-Web
This commit is contained in:
		
						commit
						e71f013ea1
					
				
					 2 changed files with 19 additions and 7 deletions
				
			
		|  | @ -17,6 +17,7 @@ | |||
| calibreweb_repo_url: https://github.com/janeczku/calibre-web | ||||
| calibreweb_version: master    # WAS: master, 0.6.4, 0.6.5, 0.6.6, 0.6.7, 0.6.8, 0.6.9 | ||||
| 
 | ||||
| calibreweb_venv_wipe: False    # 2023-12-04: NEW default TDD (Test-Driven Dev!) | ||||
| calibreweb_venv_path: /usr/local/calibre-web-py3 | ||||
| calibreweb_exec_path: "{{ calibreweb_venv_path }}/cps.py" | ||||
| 
 | ||||
|  |  | |||
|  | @ -27,10 +27,16 @@ | |||
|     line: '  <policy domain="coder" rights="read" pattern="PDF" />' | ||||
|     state: present | ||||
| 
 | ||||
| - name: Remove previous virtual environment {{ calibreweb_venv_path }} | ||||
| - name: "Remove previous virtual environment {{ calibreweb_venv_path }} -- if 'calibreweb_venv_wipe: True'" | ||||
|   file: | ||||
|     path: "{{ calibreweb_venv_path }}" | ||||
|     state: absent | ||||
|   when: calibreweb_venv_wipe | ||||
| 
 | ||||
| - name: Does {{ calibreweb_venv_path }} exist? | ||||
|   stat: | ||||
|     path: "{{ calibreweb_venv_path }}"    # /usr/local/calibre-web-py3 | ||||
|   register: calibreweb_venv | ||||
| 
 | ||||
| - name: "Create 3 Calibre-Web folders to store data and config files: {{ calibreweb_home }}, {{ calibreweb_venv_path }}, {{ calibreweb_config }} (all set to {{ calibreweb_user }}:{{ apache_user }}) (default to 0755)" | ||||
|   file: | ||||
|  | @ -41,7 +47,7 @@ | |||
|   with_items: | ||||
|     - "{{ calibreweb_home }}"         # /library/calibre-web | ||||
|     - "{{ calibreweb_config }}"       # /library/calibre-web/config | ||||
|     - "{{ calibreweb_venv_path }}"    # /usr/local/calibre-web-py3 | ||||
|     - "{{ calibreweb_venv_path }}" | ||||
| 
 | ||||
| # FYI since May 2021, Calibre-Web (major releases) can be installed with pip: | ||||
| # https://pypi.org/project/calibreweb/ | ||||
|  | @ -50,21 +56,26 @@ | |||
| # https://github.com/janeczku/calibre-web/pull/927 | ||||
| # https://github.com/janeczku/calibre-web/pull/1459 | ||||
| 
 | ||||
| - name: Clone i.e. download Calibre-Web ({{ calibreweb_version }}) from {{ calibreweb_repo_url }} to {{ calibreweb_venv_path }} (~94 MB initially, ~115+ MB later) | ||||
| - name: "Clone i.e. download Calibre-Web ({{ calibreweb_version }}) from {{ calibreweb_repo_url }} to {{ calibreweb_venv_path }} (~94 MB initially, ~115+ MB later) -- if {{ calibreweb_venv_path }} created just above" | ||||
|   git: | ||||
|     repo: "{{ calibreweb_repo_url }}"    # e.g. https://github.com/janeczku/calibre-web | ||||
|     dest: "{{ calibreweb_venv_path }}" | ||||
|     force: yes | ||||
|     #depth: 1    # 2023-11-04: Full clone for now, to help @deldesir & wider community testing | ||||
|     version: "{{ calibreweb_version }}"    # e.g. master, 0.6.21 | ||||
|   when: not calibreweb_venv.stat.exists | ||||
| 
 | ||||
| - name: If Calibre-Web is being enhanced with audio/video "books" too, install additional prereqs (CAN TAKE 3+ MINUTES, WIP) | ||||
| - name: If Calibre-Web is being enhanced with audio/video "books" too, install/upgrade additional prereqs (CAN TAKE 3+ MINUTES, WIP) | ||||
|   shell: | | ||||
|     if [ -f {{ calibreweb_venv_path }}/scripts/lb-wrapper ]; then | ||||
|         apt install ffmpeg pipx -y | ||||
|         pipx install xklb | ||||
|         ln -sf /root/.local/bin/lb /usr/local/bin/lb | ||||
|         ln -sf /root/.local/pipx/venvs/xklb/bin/yt-dlp /usr/local/bin/yt-dlp | ||||
|         if lb --version; then | ||||
|             pipx upgrade --include-injected xklb | ||||
|         else | ||||
|             pipx install xklb | ||||
|             ln -sf /root/.local/bin/lb /usr/local/bin/lb | ||||
|             ln -sf /root/.local/pipx/venvs/xklb/bin/yt-dlp /usr/local/bin/yt-dlp | ||||
|         fi | ||||
|         cp {{ calibreweb_venv_path }}/scripts/lb-wrapper /usr/local/bin/lb-wrapper | ||||
|         chmod a+x /usr/local/bin/lb-wrapper | ||||
|     fi | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue