Git Product home page Git Product logo

epubhv's Introduction

yihong0618

😄 你好~ 我是 yihong0618,生活工作在大连。 喜爱游戏跑步读书,编程和有趣的东西。 项目大多和这些相关。

你可以到我的网站来玩, 📫 如果你想聊聊,可以给我发邮件, 也可以来到我的 tg 频道

也欢迎赞助我杯可乐 Sponsor Me

爱发电:s

Yesterday you said tomorrow.

记录下的跑步 13 年。

epubhv's People

Contributors

frostming avatar jiak94 avatar jt-wang avatar overflowcat avatar yihong0618 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

epubhv's Issues

ios端的a-shell安装epubhv遇到的fugashi问题,请教下。

  • a—shell mini
  • Python 3.11.0
  • pip 23.3.2

安装epubhv成功,运行却一直报错fugashi重装也没起作用,请指教。

[Documents]$ pip install epubhv
Defaulting to user installation because normal site-
packages is not writeable
Looking in indexes: https://pypi.tuna.tsinghua.edu.c
n/simple
Requirement already satisfied: epubhv in /var/mobile
/Containers/Data/Application/A3D6ABA5-6EFD-4792-9707
-EA0AE3678F47/Library/lib/python3.11/site-packages (
0.4.1)
Requirement already satisfied: beautifulsoup4==4.12.
2 in /var/mobile/Containers/Data/Application/A3D6ABA
5-6EFD-4792-9707-EA0AE3678F47/Library/lib/python3.11
/site-packages (from epubhv) (4.12.2)
Requirement already satisfied: cssutils==2.7.1 in /v
ar/mobile/Containers/Data/Application/A3D6ABA5-6EFD-
4792-9707-EA0AE3678F47/Library/lib/python3.11/site-p
ackages (from epubhv) (2.7.1)
Requirement already satisfied: lxml==4.9.3 in /priva
te/var/containers/Bundle/Application/C53C589E-EB81-4
638-9DF5-5656C96958CF/a-Shell-mini.app/Library/lib/p
ython3.11/site-packages (from epubhv) (4.9.3)
Requirement already satisfied: opencc-python-reimple
mented==0.1.7 in /var/mobile/Containers/Data/Applica
tion/A3D6ABA5-6EFD-4792-9707-EA0AE3678F47/Library/li
b/python3.11/site-packages (from epubhv) (0.1.7)
Requirement already satisfied: soupsieve==2.5 in /va
r/mobile/Containers/Data/Application/A3D6ABA5-6EFD-4
792-9707-EA0AE3678F47/Library/lib/python3.11/site-packages (from typed-argument-parser==1.8.1->e
pubhv) (0.15)
Requirement already satisfied: mypy-extensions>=0.3.0 in /var/mobile/Containers/Data/Application/A3D6ABA5-6EFD-4792-9707-EA0AE3678F47/Library/lib/python3.11/site-packages (from typing-inspect>=0.7.1->typed-argument-parser==1.8.1->epubhv) (1.0.0)
Requirement already satisfied: typing-extensions>=3.7.4 in /private/var/containers/Bundle/Application/C53C589E-EB81-4638-9DF5-5656C96958CF/a-Shell-mini.app/Library/lib/python3.11/site-packages (from typing-inspect>=0.7.1->typed-argument-parser==1.8.1->epubhv) (4.8.0)

[Documents]$ pip show epubhv
Name: epubhv
Version: 0.4.1
Summary: make your epub books vertical or horizontal.
Home-page:
Author:
Author-email: yihong0618 [email protected]
License: MIT
Location: /var/mobile/Containers/Data/Application/A3D6ABA5-6EFD-4792-9707-EA0AE3678F47/Library/lib/python3.11/site-packages
Requires: beautifulsoup4, cssutils, fugashi, jieba, lxml, opencc-python-reimplemented, pypinyin, soupsieve, typed-argument-parser, unidic_lite
Required-by:

[Documents]$ epubhv 浮木.epub --h --ruby
Traceback (most recent call last):
File "/var/mobile/Containers/Data/Application/A3D6ABA5-6EFD-4792-9707-EA0AE3678F47/Library/bin/epubhv", line 5, in
from epubhv.cli import main
File "/var/mobile/Containers/Data/Application/A3D6ABA5-6EFD-4792-9707-EA0AE3678F47/Library/lib/python3.11/site-packages/epubhv/cli.py", line 5, in
from epubhv.epubhv import EPUBHV, list_all_epub_in_dir
File "/var/mobile/Containers/Data/Application/A3D6ABA5-6EFD-4792-9707-EA0AE3678F47/Library/lib/python3.11/site-packages/epubhv/epubhv.py", line 20, in
from epubhv.yomituki import RubySoup, string_con
tainers
File "/var/mobile/Containers/Data/Application/A3D6
ABA5-6EFD-4792-9707-EA0AE3678F47/Library/lib/python3
.11/site-packages/epubhv/yomituki.py", line 14, in <
module>
from fugashi import Tagger
File "/var/mobile/Containers/Data/Application/A3D6
ABA5-6EFD-4792-9707-EA0AE3678F47/Library/lib/python3
.11/site-packages/fugashi/init.py", line 1, in <
module>
from .fugashi import *
ImportError: dlopen(/private/var/containers/Bundle/A
pplication/C53C589E-EB81-4638-9DF5-5656C96958CF/a-Sh
ell-mini.app/Frameworks/python3_ios-fugashi.fugashi.
framework/python3_ios-fugashi.fugashi, 0x0002): trie
d: '/private/var/containers/Bundle/Application/C53C5
89E-EB81-4638-9DF5-5656C96958CF/a-Shell-mini.app/Fra
meworks/python3_ios-fugashi.fugashi.framework/python
3_ios-fugashi.fugashi' (errno=2), '/private/preboot/
Cryptexes/OS/private/var/containers/Bundle/Applicati
on/C53C589E-EB81-4638-9DF5-5656C96958CF/a-Shell-mini
.app/Frameworks/python3_ios-fugashi.fugashi.framewor
k/python3_ios-fugashi.fugashi' (errno=2), '/private/
var/containers/Bundle/Application/C53C589E-EB81-4638
-9DF5-5656C96958CF/a-Shell-mini.app/Frameworks/pytho
n3_ios-fugashi.fugashi.framework/python3_ios-fugashi
.fugashi' (errno=2)

`*** is to_vertical`、书名不支持特殊字符

WX20240104-112401@2x
测试所有命令都提示*** is to_vertical,pip install -U 更新后问题依旧。
另外文件会延迟一些输出,让人误以为失败了,也许有个进度预期?
测试文件:仓库里的 sanguo.epub


WX20240104-112718@2x
书名包含()[]等字符时无法识,返回zsh: no matches found: a[spe].epub
更复杂的情况,返回zsh: unknown file attribute: ^#
比如:

epubhv 10堂极简概率课 (【美】佩尔西·戴康尼斯, 【美】布赖恩·斯科姆斯, 胡小锐) (Z-Library).epub
epubhv 你当像鸟飞往你的山 (塔拉·韦斯特弗(Tara Westover)) (Z-Library).epub

简体中文无法直接转粤拼 && 并且书中有代码时会对代码也尝试注音

首先感谢yihong大佬开发的工具!

如题,我发现使用 epubhv fff.epub --h --ruby --cantonese命令的时候,如果我原来的epub是简体中文,此时它只会生成拼音,而不能直接生成粤拼。

此时还产生的另一个问题则如下图所示:
image

可以看到python代码上也进行了“注音”hhh,期待大佬的下一波更新!

繁体转简体好像有问题

PS C:\Users\LuQQ\Downloads\Telegram Desktop> epubhv d.epub --h --convert t2s
d.epub is to_horizontal
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\Python311\Scripts\epubhv.exe_main
.py", line 7, in
File "C:\Python311\Lib\site-packages\epubhv\cli.py", line 85, in main
e.run(method)
File "C:\Python311\Lib\site-packages\epubhv\epubhv.py", line 288, in run
self.change_epub_to_horizontal()
File "C:\Python311\Lib\site-packages\epubhv\epubhv.py", line 205, in change_epub_to_horizontal
soup = load_opf_meta_data(self.opf_file)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\epubhv\epubhv.py", line 51, in load_opf_meta_data
content = f.read()
^^^^^^^^
UnicodeDecodeError: 'gbk' codec can't decode byte 0x89 in position 267: illegal multibyte sequence

Thoughts on smaller methods, and more on extensibility

Hi @yihong0618, thanks for building this great project! As I have touched more on it, I came up with some thoughts to share with you.

Separate the methods

Currently, the project is relatively short - only several hundreds of code. However, there is still space of improvement, especially in further separate the methods into smaller ones or into their own modules. e.g.

utility:

  1. File system management utils (create temp & remove temp directories and files)
  2. File processing utils (dealing with anything with creating intermediate helper files to be processed by bs4 or cssutils)
  3. HTML processing utils (mainly bs4 relevant)
  4. CSS processing utils (cssutils-relevant)

and

pluggable functionality module:

  1. direction-changing module
  2. openCC convert module
  3. punctuation convert module

and

User Interface:
It can be totally decoupled from utility and pluggable functionality module:,
e.g.

  1. CLI that contains both args parsing and CLI output
  2. Since it's already decoupled, it can unblock EPUBHV's potentials to be integrated into various services. e.g. can be exposed to https://github.com/yihong0618/bilingual_book_maker as an optional module too.

Let me how you think about it :)

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.