luejerry / html-mangareader

A lightweight offline CBZ/CBR and image viewer with full continuous scrolling
MIT License
168 stars 15 forks source link

for linux? #17

Closed NormTurtle closed 1 year ago

NormTurtle commented 2 years ago

yep , make it also for linux and also cross-platform :D

L-Yvelin commented 2 years ago

@omaru-ok Well, that's quite a change... Try it?

NormTurtle commented 2 years ago

@omaru-ok Well, that's quite a change... Try it?

huh? i din't get this?

LeXofLeviafan commented 1 year ago

Technically it's already usable on Linux; just download release sources, unpack and create an executable (chmod -x) script next to reader.py (e.g. reader.sh or simply reader); you can symlink it then into /usr/local/bin/ for sake of convenience.

#!/bin/sh
DIR=$(dirname "`readlink -f "$0"`")
cd "$DIR" && ([ -e ./venv/ ] || virtualenv venv >/dev/null) && . venv/bin/activate || exit 1
[ -e ./mangareader/build/ ] || (yarn && yarn compile || exit 1)
(pip install -r requirements.txt && cd -) >/dev/null && python "$DIR/reader.py" "$@"

Naturally, you need to have virtualenv and yarn in $PATH for it to work. You can also add --no-browser | xclip -sel clip to the last line to make it copy a URL to the clipboard instead of opening a tab in the main browser window.

There's a simpler version but it lacks a bunch of features:

virtualenv venv
. venv/bin/activate
yarn && yarn compile && pip install -r requirements.txt && python reader.py "$@"

(Namely, symlinking won't work with this one, it re-runs the entire installation process every time, and there's a lot of unnecessary output as well.)

LeXofLeviafan commented 1 year ago

Alternatively, the following script (based on build-win.cmd) can be used to generate a standalone (portable) executable named reader

virtualenv venv
. venv/bin/activate
pip install -r requirements.txt pyinstaller && \
yarn && yarn compile && \
pyi-makespec --add-data="mangareader/build/styles.css:mangareader/build" \
  --add-data="mangareader/build/scripts.js:mangareader/build" \
  --add-data="mangareader/static-assets/menu.svg:mangareader/static-assets" \
  --add-data="mangareader/static-assets/menu-light.svg:mangareader/static-assets" \
  --add-data="mangareader/static-assets/scroll.svg:mangareader/static-assets" \
  --add-data="mangareader/static-assets/scroll-light.svg:mangareader/static-assets" \
  --add-data="mangareader/static-assets/boot.template.html:mangareader/static-assets" \
  --add-data="mangareader/static-assets/doc.template.html:mangareader/static-assets" \
  --add-data="mangareader/static-assets/img.template.html:mangareader/static-assets" \
  --add-data="mangareader/static-assets/roboto-regular.woff2:mangareader/static-assets" \
  --add-data="mangareader/static-assets/roboto-bold.woff2:mangareader/static-assets" \
  --add-data="mangareader/static-assets/zenscroll.js:mangareader/static-assets" \
  --add-data="version:." \
  --icon="icon/air1.ico" \
  --name="reader" \
  --onefile reader.py && \
pyinstaller --noconfirm reader.spec --distpath .

(I changed the name from mangareader to avoid name collision with the resource folder.)

NormTurtle commented 1 year ago

i wonder if u just plan on making a X86 & linux pre-compilied binarys for sake of easy usability

LeXofLeviafan commented 1 year ago

The issue probably shouldn't be closed until a fix is committed to the repo (e.g. at least one of these scripts, via pull-request).

…There doesn't seem to be any activity in this repo since September, BTW.

ranenvious commented 1 year ago

Alternatively, the following script (based on build-win.cmd) can be used to generate a standalone (portable) executable named reader

virtualenv venv
. venv/bin/activate
pip install -r requirements.txt pyinstaller && \
yarn && yarn compile && \
pyi-makespec --add-data="mangareader/build/styles.css:mangareader/build" \
  --add-data="mangareader/build/scripts.js:mangareader/build" \
  --add-data="mangareader/static-assets/menu.svg:mangareader/static-assets" \
  --add-data="mangareader/static-assets/menu-light.svg:mangareader/static-assets" \
  --add-data="mangareader/static-assets/scroll.svg:mangareader/static-assets" \
  --add-data="mangareader/static-assets/scroll-light.svg:mangareader/static-assets" \
  --add-data="mangareader/static-assets/boot.template.html:mangareader/static-assets" \
  --add-data="mangareader/static-assets/doc.template.html:mangareader/static-assets" \
  --add-data="mangareader/static-assets/img.template.html:mangareader/static-assets" \
  --add-data="mangareader/static-assets/roboto-regular.woff2:mangareader/static-assets" \
  --add-data="mangareader/static-assets/roboto-bold.woff2:mangareader/static-assets" \
  --add-data="mangareader/static-assets/zenscroll.js:mangareader/static-assets" \
  --add-data="version:." \
  --icon="icon/air1.ico" \
  --name="reader" \
  --onefile reader.py && \
pyinstaller --noconfirm reader.spec --distpath .

(I changed the name from mangareader to avoid name collision with the resource folder.)

for some reason whenever I run the script it crashes during pyinstaller because a nonetype gets passed. As you mentioned the repo hasn't been touched since september, so I'm not sure what the issue is. This is the output from running the script https://anonfiles.com/75bdo9v7z3/OUTPUT_txt (github doesn't like my anti-fingerprinting extensions and doesn't let me upload anything in a message body)

LeXofLeviafan commented 1 year ago

anonfiles.com

Incidentally, rather than a generic filesharing service, you might want to use PasteBin for this purpose (or one of the many sites with identical purposes). IIRC it allows uploading texts anonymously and permanently (if desired), which are instantly viewable from their link (…unless the text triggers their profanity filter, at least).

html-mangareader-master

BTW, it's usually a good idea to run a stable release rather than a nightly build, unless you have a specific reason not to (such as a critical bug which smh hasn't made it into a release yet).

3810 INFO: Loading module hook 'hook-_tkinter.py' from '/home/userfolder/Downloads/html-mangareader-master/venv/lib/python3.11/site-packages/PyInstaller/hooks'...
Traceback (most recent call last):
  …
File "/home/userfolder/Downloads/html-mangareader-master/venv/lib/python3.11/site-packages/PyInstaller/utils/hooks/tcl_tk.py", line 205, in _find_tcl_tk
tk_dir = os.path.join(os.path.dirname(tcl_dir), f"tk{tk_version}")
^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen posixpath>", line 152, in dirname
TypeError: expected str, bytes or os.PathLike object, not NoneType

…I get a feeling that you don't have the Tk GUI library/bindings installed on your system (it's typically either a separate package named something like python3-tk, or in case of Gentoo it's installed by enabling the tk USE-flag on the python package… there's also a standalone tk package but I haven't checked if it's sufficient by itself for a venv; I believe it's pulled in as a dependency either way).