mirror of
https://github.com/RicterZ/nhentai.git
synced 2025-04-20 11:01:17 +02:00
add main viewer
This commit is contained in:
parent
8e8f935a9b
commit
18bdab1962
@ -9,7 +9,7 @@ except ImportError:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
import nhentai.constant as constant
|
import nhentai.constant as constant
|
||||||
from nhentai.utils import urlparse, generate_html
|
from nhentai.utils import urlparse, generate_html, generate_main_html
|
||||||
from nhentai.logger import logger
|
from nhentai.logger import logger
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -60,6 +60,8 @@ def cmd_parser():
|
|||||||
help='uses a proxy, for example: --proxy "http://127.0.0.1:1080" or its alias "default"')
|
help='uses a proxy, for example: --proxy "http://127.0.0.1:1080" or its alias "default"')
|
||||||
parser.add_option('--html', dest='html_viewer', action='store_true',
|
parser.add_option('--html', dest='html_viewer', action='store_true',
|
||||||
help='generate a html viewer at current directory')
|
help='generate a html viewer at current directory')
|
||||||
|
parser.add_option('--gen-main', dest='main_viewer', action='store_true',
|
||||||
|
help='generate a main viewer contain all the doujin in the folder')
|
||||||
|
|
||||||
parser.add_option('--login', '-l', type='str', dest='login', action='store',
|
parser.add_option('--login', '-l', type='str', dest='login', action='store',
|
||||||
help='username:password pair of nhentai account')
|
help='username:password pair of nhentai account')
|
||||||
@ -86,6 +88,10 @@ def cmd_parser():
|
|||||||
generate_html()
|
generate_html()
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
|
if args.main_viewer:
|
||||||
|
generate_main_html()
|
||||||
|
exit(0)
|
||||||
|
|
||||||
if args.login:
|
if args.login:
|
||||||
try:
|
try:
|
||||||
_, _ = args.login.split(':', 1)
|
_, _ = args.login.split(':', 1)
|
||||||
|
@ -81,6 +81,12 @@ def generate_html(output_dir='.', doujinshi_obj=None):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning('Writen HTML Viewer failed ({})'.format(str(e)))
|
logger.warning('Writen HTML Viewer failed ({})'.format(str(e)))
|
||||||
|
|
||||||
|
def generate_main_html(output_dir='.'):
|
||||||
|
"""Generete a main html to show all the contain doujinshi.
|
||||||
|
With a link to thier `index.html`.
|
||||||
|
Default output folder will be the CLI path.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
def generate_cbz(output_dir='.', doujinshi_obj=None, rm_origin_dir=False):
|
def generate_cbz(output_dir='.', doujinshi_obj=None, rm_origin_dir=False):
|
||||||
if doujinshi_obj is not None:
|
if doujinshi_obj is not None:
|
||||||
|
1893
nhentai/viewer/main.css
Normal file
1893
nhentai/viewer/main.css
Normal file
File diff suppressed because it is too large
Load Diff
37
nhentai/viewer/main.html
Normal file
37
nhentai/viewer/main.html
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en" class=" theme-black">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="theme-color" content="#1f1f1f" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes, viewport-fit=cover" />
|
||||||
|
<title>
|
||||||
|
nHentai
|
||||||
|
» Viewer</title>
|
||||||
|
<link rel="stylesheet" href="https://static.nhentai.net/css/main_style.9bb9b703e601.css">
|
||||||
|
{STYLE}
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="content">
|
||||||
|
|
||||||
|
<h1>Main Folder<span class="count">({COUNT})</span></h1>
|
||||||
|
|
||||||
|
<div class="container" id="favcontainer">
|
||||||
|
|
||||||
|
{PICTURE}
|
||||||
|
<div class="gallery-favorite">
|
||||||
|
<div class="gallery">
|
||||||
|
<a href="/folder/index.html" class="cover" style="padding:0 0 141.6% 0"><img
|
||||||
|
src="/?.jpg" />
|
||||||
|
<div class="caption">{TITLE}</div>
|
||||||
|
</a></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div> <!-- container -->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
Loading…
x
Reference in New Issue
Block a user