mirror of
https://github.com/RicterZ/nhentai.git
synced 2025-04-20 02:41:19 +02:00
rename some constants
This commit is contained in:
parent
2adf8ccc9d
commit
466fa4c094
@ -4,9 +4,8 @@ import tempfile
|
|||||||
|
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
BASE_URL = os.getenv('NHENTAI', 'https://nhentai.net')
|
|
||||||
|
|
||||||
__api_suspended_DETAIL_URL = f'{BASE_URL}/api/gallery'
|
BASE_URL = os.getenv('NHENTAI', 'https://nhentai.net')
|
||||||
|
|
||||||
DETAIL_URL = f'{BASE_URL}/g'
|
DETAIL_URL = f'{BASE_URL}/g'
|
||||||
LEGACY_SEARCH_URL = f'{BASE_URL}/search/'
|
LEGACY_SEARCH_URL = f'{BASE_URL}/search/'
|
||||||
@ -17,13 +16,14 @@ LOGIN_URL = f'{BASE_URL}/login/'
|
|||||||
CHALLENGE_URL = f'{BASE_URL}/challenge'
|
CHALLENGE_URL = f'{BASE_URL}/challenge'
|
||||||
FAV_URL = f'{BASE_URL}/favorites/'
|
FAV_URL = f'{BASE_URL}/favorites/'
|
||||||
|
|
||||||
u = urlparse(BASE_URL)
|
IMAGE_URL = f'{urlparse(BASE_URL).scheme}://i.{urlparse(BASE_URL).hostname}/galleries'
|
||||||
IMAGE_URL = f'{u.scheme}://i.{u.hostname}/galleries'
|
|
||||||
|
|
||||||
NHENTAI_HOME = os.path.join(os.getenv('HOME', tempfile.gettempdir()), '.nhentai')
|
NHENTAI_HOME = os.path.join(os.getenv('HOME', tempfile.gettempdir()), '.nhentai')
|
||||||
NHENTAI_HISTORY = os.path.join(NHENTAI_HOME, 'history.sqlite3')
|
NHENTAI_HISTORY = os.path.join(NHENTAI_HOME, 'history.sqlite3')
|
||||||
NHENTAI_CONFIG_FILE = os.path.join(NHENTAI_HOME, 'config.json')
|
NHENTAI_CONFIG_FILE = os.path.join(NHENTAI_HOME, 'config.json')
|
||||||
|
|
||||||
|
__api_suspended_DETAIL_URL = f'{BASE_URL}/api/gallery'
|
||||||
|
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
'proxy': {'http': '', 'https': ''},
|
'proxy': {'http': '', 'https': ''},
|
||||||
'cookie': '',
|
'cookie': '',
|
||||||
@ -32,7 +32,7 @@ CONFIG = {
|
|||||||
'useragent': 'nhentai command line client (https://github.com/RicterZ/nhentai)'
|
'useragent': 'nhentai command line client (https://github.com/RicterZ/nhentai)'
|
||||||
}
|
}
|
||||||
|
|
||||||
LANGUAGEISO = {
|
LANGUAGE_ISO = {
|
||||||
'english': 'en',
|
'english': 'en',
|
||||||
'chinese': 'zh',
|
'chinese': 'zh',
|
||||||
'japanese': 'ja',
|
'japanese': 'ja',
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
from xml.sax.saxutils import escape
|
from xml.sax.saxutils import escape
|
||||||
from nhentai.constant import LANGUAGEISO
|
from nhentai.constant import LANGUAGE_ISO
|
||||||
|
|
||||||
|
|
||||||
def serialize_json(doujinshi, output_dir):
|
def serialize_json(doujinshi, output_dir):
|
||||||
@ -67,8 +67,8 @@ def serialize_comic_xml(doujinshi, output_dir):
|
|||||||
if doujinshi.info.languages:
|
if doujinshi.info.languages:
|
||||||
languages = [i.strip() for i in doujinshi.info.languages.split(',')]
|
languages = [i.strip() for i in doujinshi.info.languages.split(',')]
|
||||||
xml_write_simple_tag(f, 'Translated', 'Yes' if 'translated' in languages else 'No')
|
xml_write_simple_tag(f, 'Translated', 'Yes' if 'translated' in languages else 'No')
|
||||||
[xml_write_simple_tag(f, 'LanguageISO', LANGUAGEISO[i]) for i in languages
|
[xml_write_simple_tag(f, 'LanguageISO', LANGUAGE_ISO[i]) for i in languages
|
||||||
if (i != 'translated' and i in LANGUAGEISO)]
|
if (i != 'translated' and i in LANGUAGE_ISO)]
|
||||||
|
|
||||||
f.write('</ComicInfo>')
|
f.write('</ComicInfo>')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user