mirror of
				https://github.com/RicterZ/nhentai.git
				synced 2025-11-04 02:50:55 +01:00 
			
		
		
		
	FIX: Use of img2lib even if it is not installed
This commit is contained in:
		@@ -194,8 +194,6 @@ def generate_cbz(output_dir='.', doujinshi_obj=None, rm_origin_dir=False, write_
 | 
				
			|||||||
def generate_pdf(output_dir='.', doujinshi_obj=None, rm_origin_dir=False):
 | 
					def generate_pdf(output_dir='.', doujinshi_obj=None, rm_origin_dir=False):
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        import img2pdf
 | 
					        import img2pdf
 | 
				
			||||||
    except ImportError:
 | 
					 | 
				
			||||||
        logger.error("Please install img2pdf package by using pip.")
 | 
					 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        """Write images to a PDF file using img2pdf."""
 | 
					        """Write images to a PDF file using img2pdf."""
 | 
				
			||||||
        if doujinshi_obj is not None:
 | 
					        if doujinshi_obj is not None:
 | 
				
			||||||
@@ -223,6 +221,8 @@ def generate_pdf(output_dir='.', doujinshi_obj=None, rm_origin_dir=False):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        logger.log(15, 'PDF file has been written to \'{0}\''.format(doujinshi_dir))
 | 
					        logger.log(15, 'PDF file has been written to \'{0}\''.format(doujinshi_dir))
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
					    except ImportError:
 | 
				
			||||||
 | 
					        logger.error("Please install img2pdf package by using pip.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def unicode_truncate(s, length, encoding='utf-8'):
 | 
					def unicode_truncate(s, length, encoding='utf-8'):
 | 
				
			||||||
    """https://stackoverflow.com/questions/1809531/truncating-unicode-so-it-fits-a-maximum-size-when-encoded-for-wire-transfer
 | 
					    """https://stackoverflow.com/questions/1809531/truncating-unicode-so-it-fits-a-maximum-size-when-encoded-for-wire-transfer
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user