mirror of
https://github.com/RicterZ/nhentai.git
synced 2025-04-20 11:01:17 +02:00
Merge pull request #84 from Alocks/master
new options added [--artist, --character, --parody, --group]
This commit is contained in:
commit
024f08ca97
@ -51,6 +51,10 @@ def cmd_parser():
|
|||||||
parser.add_option('--search', '-s', type='string', dest='keyword', action='store',
|
parser.add_option('--search', '-s', type='string', dest='keyword', action='store',
|
||||||
help='search doujinshi by keyword')
|
help='search doujinshi by keyword')
|
||||||
parser.add_option('--tag', type='string', dest='tag', action='store', help='download doujinshi by tag')
|
parser.add_option('--tag', type='string', dest='tag', action='store', help='download doujinshi by tag')
|
||||||
|
parser.add_option('--artist', type='string', dest='artist', action='store', help='download doujinshi by artist')
|
||||||
|
parser.add_option('--character', type='string', dest='character', action='store', help='download doujinshi by character')
|
||||||
|
parser.add_option('--parody', type='string', dest='parody', action='store', help='download doujinshi by parody')
|
||||||
|
parser.add_option('--group', type='string', dest='group', action='store', help='download doujinshi by group')
|
||||||
parser.add_option('--favorites', '-F', action='store_true', dest='favorites',
|
parser.add_option('--favorites', '-F', action='store_true', dest='favorites',
|
||||||
help='list or download your favorites.')
|
help='list or download your favorites.')
|
||||||
|
|
||||||
@ -107,7 +111,8 @@ def cmd_parser():
|
|||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
if args.main_viewer and not args.id and not args.keyword and \
|
if args.main_viewer and not args.id and not args.keyword and \
|
||||||
not args.tag and not args.favorites:
|
not args.tag and not args.artist and not args.character and \
|
||||||
|
not args.parody and not args.group and not args.favorites:
|
||||||
generate_main_html()
|
generate_main_html()
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
@ -167,12 +172,14 @@ def cmd_parser():
|
|||||||
args.id = set(map(int, filter(lambda id_: id_.isdigit(), _)))
|
args.id = set(map(int, filter(lambda id_: id_.isdigit(), _)))
|
||||||
|
|
||||||
if (args.is_download or args.is_show) and not args.id and not args.keyword and \
|
if (args.is_download or args.is_show) and not args.id and not args.keyword and \
|
||||||
not args.tag and not args.favorites:
|
not args.tag and not args.artist and not args.character and \
|
||||||
|
not args.parody and not args.group and not args.favorites:
|
||||||
logger.critical('Doujinshi id(s) are required for downloading')
|
logger.critical('Doujinshi id(s) are required for downloading')
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
if not args.keyword and not args.id and not args.tag and not args.favorites:
|
if not args.keyword and not args.id and not args.tag and not args.artist and \
|
||||||
|
not args.character and not args.parody and not args.group and not args.favorites:
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
@ -46,6 +46,30 @@ def main():
|
|||||||
if options.is_download and doujinshis:
|
if options.is_download and doujinshis:
|
||||||
doujinshi_ids = map(lambda d: d['id'], doujinshis)
|
doujinshi_ids = map(lambda d: d['id'], doujinshis)
|
||||||
|
|
||||||
|
elif options.artist:
|
||||||
|
doujinshis = tag_parser(options.artist, max_page=options.max_page, index=1)
|
||||||
|
print_doujinshi(doujinshis)
|
||||||
|
if options.is_download and doujinshis:
|
||||||
|
doujinshi_ids = map(lambda d: d['id'], doujinshis)
|
||||||
|
|
||||||
|
elif options.character:
|
||||||
|
doujinshis = tag_parser(options.character, max_page=options.max_page, index=2)
|
||||||
|
print_doujinshi(doujinshis)
|
||||||
|
if options.is_download and doujinshis:
|
||||||
|
doujinshi_ids = map(lambda d: d['id'], doujinshis)
|
||||||
|
|
||||||
|
elif options.parody:
|
||||||
|
doujinshis = tag_parser(options.parody, max_page=options.max_page, index=3)
|
||||||
|
print_doujinshi(doujinshis)
|
||||||
|
if options.is_download and doujinshis:
|
||||||
|
doujinshi_ids = map(lambda d: d['id'], doujinshis)
|
||||||
|
|
||||||
|
elif options.group:
|
||||||
|
doujinshis = tag_parser(options.group, max_page=options.max_page, index=4)
|
||||||
|
print_doujinshi(doujinshis)
|
||||||
|
if options.is_download and doujinshis:
|
||||||
|
doujinshi_ids = map(lambda d: d['id'], doujinshis)
|
||||||
|
|
||||||
elif options.keyword:
|
elif options.keyword:
|
||||||
doujinshis = search_parser(options.keyword, sorting=options.sorting, page=options.page)
|
doujinshis = search_parser(options.keyword, sorting=options.sorting, page=options.page)
|
||||||
print_doujinshi(doujinshis)
|
print_doujinshi(doujinshis)
|
||||||
|
@ -17,7 +17,12 @@ __api_suspended_SEARCH_URL = '%s/api/galleries/search' % BASE_URL
|
|||||||
DETAIL_URL = '%s/g' % BASE_URL
|
DETAIL_URL = '%s/g' % BASE_URL
|
||||||
SEARCH_URL = '%s/search/' % BASE_URL
|
SEARCH_URL = '%s/search/' % BASE_URL
|
||||||
|
|
||||||
TAG_URL = '%s/tag' % BASE_URL
|
TAG_URL = ['%s/tag' % BASE_URL,
|
||||||
|
'%s/artist' % BASE_URL,
|
||||||
|
'%s/character' % BASE_URL,
|
||||||
|
'%s/parody' % BASE_URL,
|
||||||
|
'%s/group' % BASE_URL]
|
||||||
|
|
||||||
TAG_API_URL = '%s/api/galleries/tagged' % BASE_URL
|
TAG_API_URL = '%s/api/galleries/tagged' % BASE_URL
|
||||||
LOGIN_URL = '%s/login/' % BASE_URL
|
LOGIN_URL = '%s/login/' % BASE_URL
|
||||||
CHALLENGE_URL = '%s/challenge' % BASE_URL
|
CHALLENGE_URL = '%s/challenge' % BASE_URL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user