ehentai 0.2.3__py2.py3-none-any.whl → 0.2.4__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
ehentai/__version__.py CHANGED
@@ -8,7 +8,7 @@
8
8
  """
9
9
  __title__="ehentai"
10
10
  __description__="Python for viewing e-hentai"
11
- __version__="0.2.3"
11
+ __version__="0.2.4"
12
12
  __url__="https://github.com/Homoarea/hentai"
13
13
  __build__=0x3f3f3f
14
14
  __author__="Homoarea"
ehentai/connect.py CHANGED
@@ -69,7 +69,7 @@ def keyword(
69
69
  # search_kw
70
70
  kw["f_search"]=f_search
71
71
  # category
72
- if f_cats or cats_list:kw["f_cats"]=get_f_cats(f_cats,cats_list),
72
+ kw["f_cats"]=get_f_cats(f_cats,cats_list),
73
73
  # advanced search
74
74
  # show advanced options
75
75
  if advsearch or f_sh or f_sto or f_spf or f_spt or f_srdd or f_sfl or f_sfu or f_sft:kw["advsearch"]=1
ehentai/eh.py CHANGED
@@ -1,6 +1,3 @@
1
- import sys
2
- import os
3
- import json
4
1
  import click
5
2
  import json
6
3
  from click import echo
@@ -8,7 +5,7 @@ from typing import List
8
5
  from ehentai.conf import *
9
6
  from ehentai import __version__
10
7
  from ehentai import Page,Gallery,get_search,get_popular
11
- from ehentai.utils import save_json,load_json
8
+ from ehentai.utils import save_Page,load_Page
12
9
 
13
10
  def echo_gl_table(detail=False,gl_table: List[Gallery]=None):
14
11
  if gl_table:
@@ -21,6 +18,11 @@ def echo_gl_table(detail=False,gl_table: List[Gallery]=None):
21
18
  else:
22
19
  echo("Page's Gallery Table is None.")
23
20
 
21
+ def echo_gl_comment(comment):
22
+ for nick,cs in comment:
23
+ echo(f"{FONT_STYLE.bold.value}{FONT_COLOR.green.value}{nick}{RESET}")
24
+ for c in cs:
25
+ echo(f"\t{c}")
24
26
 
25
27
  @click.group()
26
28
  def cli():
@@ -38,21 +40,20 @@ def version():
38
40
  echo(f"Version: {__version__.__version__}")
39
41
 
40
42
  @cli.command(help="|search from e-hentai")
41
- @click.option('--search-content','-s',default="",type=str,prompt=True,help="search content,tags")
43
+ @click.argument('search-content',default="")
42
44
  @click.option('--cats','-c',default=255,type=int,help="Doujinshi,Manga...")
43
45
  @click.option('--rating','-r',default=None,type=int,help="the minium rating")
44
46
  @click.option('--show-expunged/--no-show-expunged','-sh/',default=False,help="show the removed galleries")
45
47
  @click.option('--show-torrent/--no-show-torrent','-sto/',default=False,help="filter galleries have torrent")
46
- @click.option('--use-direct/--no-direct','-u',default=False,help="enable this to connect directly")
47
- def search(search_content,cats,rating,show_expunged,show_torrent,use_direct):
48
- page=get_search(search_content,cats,rating,show_expunged,show_torrent,direct=use_direct)
49
- save_json("page.json",page)
48
+ def search(search_content,cats,rating,show_expunged,show_torrent):
49
+ page=get_search(search_content,cats,rating,show_expunged,show_torrent)
50
+ save_Page(page)
50
51
  print(page)
51
52
 
52
53
  @cli.command(help="|show the fetched galleries")
53
54
  @click.option("--detailed/--no-detailed", "-d/", default=False)
54
55
  def list(detailed):
55
- page=load_json("page.json",Page)
56
+ page=load_Page()
56
57
  echo_gl_table(detailed,page.gl_table)
57
58
 
58
59
  @cli.command(help="|show and operate the gallery")
@@ -63,7 +64,7 @@ def list(detailed):
63
64
  @click.option('--stream/--no-stream','-s/',default=True,type=bool,help="enable stream download")
64
65
  @click.option('--comment/--no-comment', '-c/',default=False,help="echo the comment of gallery")
65
66
  def view(id,download,rename,path,stream,comment):
66
- page=load_json("page.json",Page)
67
+ page=load_Page()
67
68
  gl=page.gl_table[id]
68
69
  echo(gl)
69
70
  if download:
@@ -71,19 +72,15 @@ def view(id,download,rename,path,stream,comment):
71
72
  elif comment:
72
73
  comment=gl.comment()
73
74
  if comment:
74
- for nick,cs in comment:
75
- echo(f"{FONT_STYLE.bold.value}{FONT_COLOR.green.value}{nick}{RESET}")
76
- for c in cs:
77
- echo(f"\t{c}")
75
+ echo_gl_comment(comment)
78
76
  else:
79
77
  echo("no comments")
80
78
 
81
79
  @cli.command(help="|fetch popular galleries")
82
- @click.option('--use-direct/--no-direct','-u',default=False,help="enable this to connect directly")
83
- def popular(use_direct):
84
- page=get_popular(direct=use_direct)
80
+ def popular():
81
+ page=get_popular()
85
82
  echo(f"Currently Popular Recent Galleries:{len(page.gl_table)}")
86
- save_json("page.json",page)
83
+ save_Page(page)
87
84
 
88
85
  # testing
89
86
  # @cli.command()
ehentai/utils.py CHANGED
@@ -2,12 +2,13 @@ import json
2
2
  import os
3
3
  from PIL import Image
4
4
  import platform
5
+ from ehentai.api import get_Page,Page
5
6
 
6
7
  # home path
7
8
  HOME:str
8
9
  match platform.system():
9
- case 'Windows':HOME=os.path.abspath(os.path.join(os.getenv('HOMEPATH'),".hentai"))
10
- case _:HOME=os.path.abspath(os.path.join(os.getenv('HOME'),".hentai"))
10
+ case 'Windows':HOME=os.path.abspath(os.path.join(os.getenv('TEMP'),".hentai"))
11
+ case _:HOME=os.path.abspath(os.path.join(os.getenv('HOME'),".cache",".hentai"))
11
12
 
12
13
  # json data
13
14
  if not os.path.exists(HOME):
@@ -19,6 +20,15 @@ def load_json(filename: str,data_type):
19
20
  with open(os.path.join(HOME,filename),"r") as f:
20
21
  return data_type(**json.loads(f.read()))
21
22
 
23
+ # page
24
+ def load_Page()->Page:
25
+ return load_json("page.json",Page)
26
+ def save_Page(page):
27
+ save_json("page.json",page)
28
+
29
+ if not os.path.exists(os.path.join(HOME,"page.json")):
30
+ save_Page(get_Page())
31
+
22
32
  # args:list[Image]
23
33
  def merge_img():
24
34
  pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ehentai
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: Python for viewing e-hentai
5
5
  Home-page: https://github.com/Homoarea/hentai
6
6
  Author: Homoarea
@@ -14,6 +14,7 @@ Requires-Dist: click
14
14
  Requires-Dist: curl_cffi
15
15
  Requires-Dist: beautifulsoup4
16
16
  Requires-Dist: lxml
17
+ Requires-Dist: pillow
17
18
  Dynamic: author
18
19
  Dynamic: author-email
19
20
  Dynamic: home-page
@@ -0,0 +1,15 @@
1
+ ehentai/__init__.py,sha256=2nj4ZQ3qwERHMUCSE1S0I3wy0mDkCNwCxeSFk-QMZo4,52
2
+ ehentai/__version__.py,sha256=GguDToFIlSErZW130csurvT_XQLqtPKqYRqftig6Zww,1012
3
+ ehentai/api.py,sha256=IGCwJiGgQBu9Q0XNJb4_vbNsO7VPOzx31KkqQC2FmtI,1123
4
+ ehentai/conf.py,sha256=_58VU-o5T4k7X1bHLNp_iZXimj9T-JOYYP6PPmeIaFA,1115
5
+ ehentai/connect.py,sha256=CgcSpTuOD-XV3cyGCSxa-4ib9xsyvorGCMLqDHZrmvY,3823
6
+ ehentai/eh.py,sha256=4SmiWm0cCx5gA2L7ao3fAVVXw8-Qxbn-0iqAz7N5NcY,3885
7
+ ehentai/fetch.py,sha256=UxBFd8FpKXQ3KO746IpA7p3o8B0T7PKDt8ZLpoQ3Zo8,5171
8
+ ehentai/utils.py,sha256=n9W5GMfM_hr0Krq0JfIiAA7q2eu6VmIH1Tplp5jmWQI,983
9
+ ehentai-0.2.4.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
10
+ ehentai-0.2.4.dist-info/licenses/NOTICE,sha256=mTsYLHfcXGcFMSSdkQX-LbKWxxieIA2L4sMNXitGN4k,30
11
+ ehentai-0.2.4.dist-info/METADATA,sha256=umcqJwkcmaKEi0jW5_WpU4iFsH1nxqtpB4ER6gVdU4U,628
12
+ ehentai-0.2.4.dist-info/WHEEL,sha256=MAQBAzGbXNI3bUmkDsiV_duv8i-gcdnLzw7cfUFwqhU,109
13
+ ehentai-0.2.4.dist-info/entry_points.txt,sha256=lc9qUbtXSHccaXX_CLtlh605pt2r3zfw6Lbuem3mQO8,38
14
+ ehentai-0.2.4.dist-info/top_level.txt,sha256=NzB7Gi8Sxv8D3VNP4b9wiNdC-zQ4yntM0Uo9TAXnScE,8
15
+ ehentai-0.2.4.dist-info/RECORD,,
@@ -1,15 +0,0 @@
1
- ehentai/__init__.py,sha256=2nj4ZQ3qwERHMUCSE1S0I3wy0mDkCNwCxeSFk-QMZo4,52
2
- ehentai/__version__.py,sha256=rqpPrT4Y3eMAcfDqfstGBzzIbei-vK0ENoNe8H4mBUg,1012
3
- ehentai/api.py,sha256=IGCwJiGgQBu9Q0XNJb4_vbNsO7VPOzx31KkqQC2FmtI,1123
4
- ehentai/conf.py,sha256=_58VU-o5T4k7X1bHLNp_iZXimj9T-JOYYP6PPmeIaFA,1115
5
- ehentai/connect.py,sha256=F-TQNrKvTpR1vu4XyP8IlLRu8z8XwMteC-Mts0breVk,3846
6
- ehentai/eh.py,sha256=CcseQ1nXdjkjAwlcvCJpWE_pGAMVDJbaJcSJDxeWOZ8,4224
7
- ehentai/fetch.py,sha256=UxBFd8FpKXQ3KO746IpA7p3o8B0T7PKDt8ZLpoQ3Zo8,5171
8
- ehentai/utils.py,sha256=KP0O7zGJl7_gBz5II5Ls5KQljk2v6Q6SL_uggw6sCs8,727
9
- ehentai-0.2.3.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
10
- ehentai-0.2.3.dist-info/licenses/NOTICE,sha256=mTsYLHfcXGcFMSSdkQX-LbKWxxieIA2L4sMNXitGN4k,30
11
- ehentai-0.2.3.dist-info/METADATA,sha256=OxdQPeBFJ-AZVArBrpyxOaoZ9m4WnkJ7JJa7US_cFPs,606
12
- ehentai-0.2.3.dist-info/WHEEL,sha256=MAQBAzGbXNI3bUmkDsiV_duv8i-gcdnLzw7cfUFwqhU,109
13
- ehentai-0.2.3.dist-info/entry_points.txt,sha256=lc9qUbtXSHccaXX_CLtlh605pt2r3zfw6Lbuem3mQO8,38
14
- ehentai-0.2.3.dist-info/top_level.txt,sha256=NzB7Gi8Sxv8D3VNP4b9wiNdC-zQ4yntM0Uo9TAXnScE,8
15
- ehentai-0.2.3.dist-info/RECORD,,