add main viewer

This commit is contained in:
symant233 2019-05-05 19:44:44 +08:00
parent 8e8f935a9b
commit 18bdab1962
4 changed files with 1943 additions and 1 deletions

View File

@ -9,7 +9,7 @@ except ImportError:
pass
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
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"')
parser.add_option('--html', dest='html_viewer', action='store_true',
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',
help='username:password pair of nhentai account')
@ -86,6 +88,10 @@ def cmd_parser():
generate_html()
exit(0)
if args.main_viewer:
generate_main_html()
exit(0)
if args.login:
try:
_, _ = args.login.split(':', 1)

View File

@ -81,6 +81,12 @@ def generate_html(output_dir='.', doujinshi_obj=None):
except Exception as 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):
if doujinshi_obj is not None:

1893
nhentai/viewer/main.css Normal file

File diff suppressed because it is too large Load Diff

37
nhentai/viewer/main.html Normal file
View 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
&raquo; 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>