mirror of
				https://github.com/RicterZ/nhentai.git
				synced 2025-11-03 18:50:53 +01:00 
			
		
		
		
	Merge branch 'master' of github.com:RicterZ/nhentai
This commit is contained in:
		@@ -140,6 +140,7 @@ Format output doujinshi folder name:
 | 
			
		||||
Supported doujinshi folder formatter:
 | 
			
		||||
 | 
			
		||||
- %i: Doujinshi id
 | 
			
		||||
- %f: Doujinshi favorite count
 | 
			
		||||
- %t: Doujinshi name
 | 
			
		||||
- %s: Doujinshi subtitle (translated name)
 | 
			
		||||
- %a: Doujinshi authors' name
 | 
			
		||||
 
 | 
			
		||||
@@ -29,11 +29,12 @@ class DoujinshiInfo(dict):
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Doujinshi(object):
 | 
			
		||||
    def __init__(self, name=None, pretty_name=None, id=None, img_id=None,
 | 
			
		||||
    def __init__(self, name=None, pretty_name=None, id=None, favorite_counts=0, img_id=None,
 | 
			
		||||
                 ext='', pages=0, name_format='[%i][%a][%t]', **kwargs):
 | 
			
		||||
        self.name = name
 | 
			
		||||
        self.pretty_name = pretty_name
 | 
			
		||||
        self.id = id
 | 
			
		||||
        self.favorite_counts = favorite_counts
 | 
			
		||||
        self.img_id = img_id
 | 
			
		||||
        self.ext = ext
 | 
			
		||||
        self.pages = pages
 | 
			
		||||
@@ -45,6 +46,7 @@ class Doujinshi(object):
 | 
			
		||||
        name_format = name_format.replace('%ag', format_filename(ag_value))
 | 
			
		||||
 | 
			
		||||
        name_format = name_format.replace('%i', format_filename(str(self.id)))
 | 
			
		||||
        name_format = name_format.replace('%f', format_filename(str(self.favorite_counts)))
 | 
			
		||||
        name_format = name_format.replace('%a', format_filename(self.info.artists))
 | 
			
		||||
        name_format = name_format.replace('%g', format_filename(self.info.groups))
 | 
			
		||||
 | 
			
		||||
@@ -63,6 +65,7 @@ class Doujinshi(object):
 | 
			
		||||
            ['Groups', self.info.groups],
 | 
			
		||||
            ['Languages', self.info.languages],
 | 
			
		||||
            ['Tags', self.info.tags],
 | 
			
		||||
            ['Favorite Counts', self.info.favorite_counts],
 | 
			
		||||
            ['URL', self.url],
 | 
			
		||||
            ['Pages', self.pages],
 | 
			
		||||
        ]
 | 
			
		||||
 
 | 
			
		||||
@@ -142,10 +142,11 @@ def doujinshi_parser(id_, counter=0):
 | 
			
		||||
    title = doujinshi_info.find('h1').text
 | 
			
		||||
    pretty_name = doujinshi_info.find('h1').find('span', attrs={'class': 'pretty'}).text
 | 
			
		||||
    subtitle = doujinshi_info.find('h2')
 | 
			
		||||
 | 
			
		||||
    favorite_counts = doujinshi_info.find('span', class_='nobold').find('span', class_='count').text.strip()
 | 
			
		||||
    doujinshi['name'] = title
 | 
			
		||||
    doujinshi['pretty_name'] = pretty_name
 | 
			
		||||
    doujinshi['subtitle'] = subtitle.text if subtitle else ''
 | 
			
		||||
    doujinshi['favorite_counts'] = favorite_counts
 | 
			
		||||
 | 
			
		||||
    doujinshi_cover = html.find('div', attrs={'id': 'cover'})
 | 
			
		||||
    img_id = re.search('/galleries/([0-9]+)/cover.(jpg|png|gif|webp)$',
 | 
			
		||||
 
 | 
			
		||||
@@ -8,6 +8,8 @@ from nhentai.constant import LANGUAGE_ISO
 | 
			
		||||
def serialize_json(doujinshi, output_dir):
 | 
			
		||||
    metadata = {'title': doujinshi.name,
 | 
			
		||||
                'subtitle': doujinshi.info.subtitle}
 | 
			
		||||
    if doujinshi.info.favorite_counts:
 | 
			
		||||
        metadata['favorite_counts'] = doujinshi.favorite_counts
 | 
			
		||||
    if doujinshi.info.date:
 | 
			
		||||
        metadata['upload_date'] = doujinshi.info.date
 | 
			
		||||
    if doujinshi.info.parodies:
 | 
			
		||||
@@ -44,6 +46,7 @@ def serialize_comic_xml(doujinshi, output_dir):
 | 
			
		||||
        xml_write_simple_tag(f, 'PageCount', doujinshi.pages)
 | 
			
		||||
        xml_write_simple_tag(f, 'URL', doujinshi.url)
 | 
			
		||||
        xml_write_simple_tag(f, 'NhentaiId', doujinshi.id)
 | 
			
		||||
        xml_write_simple_tag(f, 'Favorites', doujinshi.favorite_counts)
 | 
			
		||||
        xml_write_simple_tag(f, 'Genre', doujinshi.info.categories)
 | 
			
		||||
 | 
			
		||||
        xml_write_simple_tag(f, 'BlackAndWhite', 'No' if doujinshi.info.tags and
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user