epub module¶
-
epub.
URLentry_click
(event)¶ This function is bound to “URLentry” entry widget of GUI. When user FOCUS-IN, it takes appropriate action.
- Parameters
event (call-back event.) –
No Return Values.
-
epub.
delete_temp_folder
(path)¶ Deletes temporary files and folders, if created, that were necessary for the execution and creation of epub document.
- Parameters
path (Path to temporary files and folders; which is same as the path inputted by the user in GUI.) –
No Return values.
-
epub.
downloadImg
(url, pathname)¶ Downloads the image specified by the URL to the temporary images folder.
- Parameters
url (URL of the image contained in the webpage.) –
pathname (Path to the "images" folder inside the temporary directory created.) –
No Return Value
-
epub.
extractPerLink
(url, pathArg)¶ For a given URL, extract HTML contents, save as .html file in a temporary directory created.
- Parameters
url (The URL from which the content is to be extracted.) –
pathArg (Path to the temporary directory created at the path specified by user in GUI for saving epub.) –
- Returns
The name of the html file created.
- Return type
str
-
epub.
extract_contents
(url, path, textfilepath)¶ For each link present in __links__.txt , call extractPerLink() to extract HTML contents.
- Parameters
path (Path to which epub is saved, as given by the user in the GUI.) –
textfilepath (Path to the file __links__.txt that contains the urls to be extracted.) –
- Returns
Status of execution - “Okay” if successful ; Exception otherwise.
- Return type
str
-
epub.
extract_links
(url, path, doctype=1)¶ It fetches the useful links of content from the webpage of given URL.
- Parameters
url (It is URL inputted by the user in the GUI) –
path (Path to which epub is saved, as given by the user in the GUI.) –
doctype (Whether the user wants to convert a "Single Page" or "Complete Tutorial" into epub. By default "Complete Tutorial"(1)) –
- Returns
Status of execution- “Okay” if successful ; Exception otherwise.
- Return type
str
-
epub.
generate_epub
(url, path)¶ Generate epub document at the given path, taking list of html file names of listOfFiles and taking images from listofImg. Each html file is added as a new chapter.
- Parameters
path (Path to which epub is saved, as given by the user in the GUI.) –
- Returns
Status of execution - “Okay” if successful ; Exception otherwise.
- Return type
str
-
epub.
is_valid
(url)¶ Check if the url of image present in the webpage is valid or not.
- Parameters
url (URL of the image to be downloaded.) –
- Returns
True or False
- Return type
bool
-
epub.
multipage
()¶ It is bound to “Complete Tutorial” radio button, indicates contents from the whole tutorial to be extracted.
No Parameters
No Return Values
-
epub.
on_closing
()¶ When user wants to close the application, it displays a prompt, and once user confirms quitting, closes all the windows and terminates all the background processes.
No parameters
No Return Values
-
epub.
resize_image
(event)¶ Resizing the background image to the size of the GUI window.
- Parameters
event (callback event.) –
No return values.
-
epub.
singlepage
()¶ It is bound to “Single Page” radio button, indicates contents from a single page to be extracted.
No Parameters
No Return Values
-
epub.
take_path
()¶ This function is bound to “Browse” button of GUI and it allows the user to browse through all the locations on his computer to select the destination for epub document.
No parameters.
No Return Values.
-
epub.
validate_entries
()¶ This function is bound to “Generate epub” button. It checks if all the input fields are non-empty. Calls extract_links, extract_contents, and generate_epub and handles exceptions. Calls delete_temp_folder at the end.
No parameters.
No Return Values.