This commit is contained in:
ricterz 2024-09-20 23:34:26 +08:00
parent 4ed4523782
commit 29aac84d53
2 changed files with 7 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import tempfile
from urllib.parse import urlparse from urllib.parse import urlparse
from platform import system from platform import system
def get_nhentai_home() -> str: def get_nhentai_home() -> str:
home = os.getenv('HOME', tempfile.gettempdir()) home = os.getenv('HOME', tempfile.gettempdir())
@ -20,6 +21,7 @@ def get_nhentai_home() -> str:
# Use old default path in other systems # Use old default path in other systems
return os.path.join(home, '.nhentai') return os.path.join(home, '.nhentai')
DEBUG = os.getenv('DEBUG', False) DEBUG = os.getenv('DEBUG', False)
BASE_URL = os.getenv('NHENTAI', 'https://nhentai.net') BASE_URL = os.getenv('NHENTAI', 'https://nhentai.net')
@ -52,7 +54,8 @@ CONFIG = {
'cookie': '', 'cookie': '',
'language': '', 'language': '',
'template': '', 'template': '',
'useragent': 'nhentai command line client (https://github.com/RicterZ/nhentai)' 'useragent': 'nhentai command line client (https://github.com/RicterZ/nhentai)',
'max_filename': 85
} }
LANGUAGE_ISO = { LANGUAGE_ISO = {

View File

@ -327,7 +327,9 @@ def search_parser(keyword, sorting, page, is_page_all=False):
for row in response['result']: for row in response['result']:
title = row['title']['english'] title = row['title']['english']
title = title[:85] + '..' if len(title) > 85 else title title = title[:constant.CONFIG['max_filename']] + '..' if \
len(title) > constant.CONFIG['max_filename'] else title
result.append({'id': row['id'], 'title': title}) result.append({'id': row['id'], 'title': title})
not_exists_persist = False not_exists_persist = False